Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Run an EXE and wait
Message
De
15/04/2019 10:47:30
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
14/04/2019 05:49:27
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01667388
Message ID:
01668081
Vues:
105
>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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform