SYSTEM call
Moderators: Susan Smith, admin, Gabriel
SYSTEM call
Is there a way to easily set the working directory directory when launching an external program or will I have to create a batch file and launch it?
Maybe...
It depends on what you want to do.
For example, I often load and run Excel and Word and a few other programs through a system call. I used to either put a short-cut .lnk file in my WB directory or crete a batch file to call.
I now use a registry reader to determin the installed location of the external program and do a system call to that program directly from BR with the file locartion and filename following the sytem command. This works particularly well in the client server environment over the internet becasue the location returned is the local install, not the server install.
e.g.
execute "sys -w "&fnmsexe$("winword.exe")&" "&env$("TEMP")"docname.doc"
where fnmsexe$ included in FNSNAP.dll call D Blankenships registry reader, which in turn returns the installed location of WINWORD.EXE
This of course dependes on what command line parameters your external program accepts or requires.
FNGeorge
It depends on what you want to do.
For example, I often load and run Excel and Word and a few other programs through a system call. I used to either put a short-cut .lnk file in my WB directory or crete a batch file to call.
I now use a registry reader to determin the installed location of the external program and do a system call to that program directly from BR with the file locartion and filename following the sytem command. This works particularly well in the client server environment over the internet becasue the location returned is the local install, not the server install.
e.g.
execute "sys -w "&fnmsexe$("winword.exe")&" "&env$("TEMP")"docname.doc"
where fnmsexe$ included in FNSNAP.dll call D Blankenships registry reader, which in turn returns the installed location of WINWORD.EXE
This of course dependes on what command line parameters your external program accepts or requires.
FNGeorge
-
- Posts: 291
- Joined: Fri Jun 19, 2009 9:01 am
- Location: Lawrence, Kansas
- Contact:
If you know the location of the executable you should be able to fire it knowing that.
If program is in \Program Files\wnbrowse\wnbrowse.exe
This should work.
If program is in \Program Files\wnbrowse\wnbrowse.exe
This should work.
Code: Select all
00010 DIM F$*132
00020 LET F$=OS_FILENAME$(":\Program files\wnbrowse\wnbrowse.exe")
00030 IF EXISTS(":"&F$) THEN EXECUTE "system -w "&F$
00040 END
John wrote:I just want to launch an executable, but I need to do it from it's install directory, not mine... Looks like I'll have to use a batch file.
Steve Koger
Computer Specialist
SEKESC-MACS Division
Computer Specialist
SEKESC-MACS Division
-
- Posts: 291
- Joined: Fri Jun 19, 2009 9:01 am
- Location: Lawrence, Kansas
- Contact:
BTW if you want to know where you are currently
Let F$=OS_FILENAME$("\.")
F$ will contain the current working directory the OS thinks your in. If your on Client Server that will tell you the directory on the Server its currently pointing to:
Let F$=OS_FILENAME$("@:\.")
will tell you the current working directory on the client. You can actually use the @:\. on regular non client server and it will return the same result a using us \. So you can have one line of code working for either platform. As long as you know what your receiving in your variable in client server is directory on the client machine then your good.
Let F$=OS_FILENAME$("\.")
F$ will contain the current working directory the OS thinks your in. If your on Client Server that will tell you the directory on the Server its currently pointing to:
Let F$=OS_FILENAME$("@:\.")
will tell you the current working directory on the client. You can actually use the @:\. on regular non client server and it will return the same result a using us \. So you can have one line of code working for either platform. As long as you know what your receiving in your variable in client server is directory on the client machine then your good.
bluesfannoz wrote:If you know the location of the executable you should be able to fire it knowing that.
If program is in \Program Files\wnbrowse\wnbrowse.exe
This should work.
Code: Select all
00010 DIM F$*132 00020 LET F$=OS_FILENAME$(":\Program files\wnbrowse\wnbrowse.exe") 00030 IF EXISTS(":"&F$) THEN EXECUTE "system -w "&F$ 00040 END
John wrote:I just want to launch an executable, but I need to do it from it's install directory, not mine... Looks like I'll have to use a batch file.
Steve Koger
Computer Specialist
SEKESC-MACS Division
Computer Specialist
SEKESC-MACS Division