Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Run an EXE and wait
Message
From
15/04/2019 10:47:30
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
14/04/2019 05:49:27
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01667388
Message ID:
01668081
Views:
104
>I need to run an exe with a parameter passed to it. Tried to look into this AppRun API but can figure it out. What is the command to run the exe (CreateObject and then ?)
>
>[UPDATE] - I have a solution. Thanks.

Parameters are just lined up after the executable, separated by spaces. Actually, for more complicated command lines I generate a batch file and run that - comes handy for debugging the command itself. Here's my line to zip files (where pretty much everything is prepared beforehand):
	PROCEDURE doZip
		LOCAL lnWA, lcZipName, listfile, lcbatFile, logfile, lcPKZ, lcThere
		IF EMPTY(THIS.FILES)
			alert("No fresh files to zip")
			RETURN
		ENDIF
		lnWA=SELECT()
		IF NOT DIRECTORY("zips")
			MD zips
		ENDIF

		lcZipName=THIS.zipname
		listfile=FULLPATH(".\zip.lst")
		STRTOFILE(THIS.FILES, listfile)
		lcbatFile=FULLPATH(FORCEEXT(SYS(2015),"bat"))
		logfile=FORCEEXT(lcbatFile,"log")
		THIS.logfile=logfile
		lcPKZ=FULLPATH("pkzip25.exe")

		TEXT textmerge noshow to lcBat
"<<lcPkz>>" -add=update -dire "<<lcZipName>>"  @"<<listfile>>" >"<<logfile>>"
		ENDTEXT
		lcThere=FULLPATH(".")
		STRTOFILE(lcBat, lcbatFile)
		LOCAL oprocess AS api_apprun OF PROCESS.vcx
		oprocess=NEWOBJECT('api_apprun','process', '', lcbatFile, lcThere, 'HID')
		oprocess.LaunchAppAndWait()
		RELEASE oprocess
		ERASE (lcbatFile)
		SELECT (lnWA)
		RETURN
	ENDPROC

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform