Files with %USERPROFILE% Path and how to execute bat file from Omnis.
Hi An,
> On 16 Mar 2018, at 12:00 am, omnisdev-en-request@lists.omnis-dev.com wrote:
>
> I’m trying to create a file on a windows machine with FileOps. The local path I’m using is %userprofile%appdatalocaldaveexportpdf. The reason I use this is because we are on a terminal server and I want to temporarily create some files in the temp folder to than later copy them to a file server.
>
> Now when I do FileOps.$createdir( %userprofile%appdatalocaldaveexportpdf) I get the error -43 (File Not Found).
> When I do the same methode with FileOps.$createdir(C:Usersan.bayensappdatalocaldaveexportpd) which is the exact same folder it works.
> Is it possible that FileOps cannot translate %userprofile%?
That’s correct – as far as I know, you can’t use %userprofile% like that in FileOps. Is that an environment variable? You can use getenv(‘userprofile’) to return the value of %userprofile%, and then put this into your batch.
> Then after my files are created in the temp folder I want to copy the whole folder to a network drive. Because I don’t see an function in Omnis to copy a complete folder I created a script to do this.
> Now I want to run this script from Omnis but I’m not really sure how to do this.
> I tried this but it doesn’t work.
> So I have my move.bat which needs 2 parameters. When I just execute this command in a terminal windows it works perfectly.
>
> Switch sys(6)
> Case ‘N’
> Calculate script as con(‘”C:DavePrefsmove.bat ‘,iListPrefs.4.C2,’ ‘,iListPrefs.1.C2,'”‘)
> Start program maximized {[script]}
> If flag false
> OK message (Icon,Sound bell) {Copy failed}
> End If
> End Switch
When you want to run batchfiles/apps with parameters you need to use something like this:
Start program normal {cmd.exe /C “[batch_file_name]”}
Hope this helps.
Regards,
Paul.
—
Paul W. Mulroney We Don’t Do Simple Pty Ltd
pmulroney@logicaldevelopments.com.au Trading as Logical Developments
www.logicaldevelopments.com.au ACN 161 009 374
Ph: +61 8 9458 3889 86 Coolgardie Street
BENTLEY WA 6102
_____________________________________________________________
Manage your list subscriptions at lists.omnis-dev.com
Start a new message -> mailto:omnisdev-en@lists.omnis-dev.com