Solomon Posted October 14, 2006 Share Posted October 14, 2006 Im trying to create an installer for Microsoft Virtual PC. The setup.exe file has several subfolders. Ive compiled the setup and subfolders into a sfx file, "VirtualPC2004SP1.exe". This extracts it's contents into c:\virtual pc\, and then the script runs c:\virtual pc\setup.exe. FileInstall("VirtualPC2004SP1.exe", @UserProfileDir & "\local settings\temp\VirtualPC2004SP1.exe") Run(@ComSpec & ' /c "' & @UserProfileDir & '\Local Settings\Temp\VirtualPC2004SP1.exe"', '', @SW_HIDE) WinWait("7-Zip self-extracting archive","E&xtract to:") If Not WinActive("7-Zip self-extracting archive","E&xtract to:") Then WinActivate("7-Zip self-extracting archive","E&xtract to:") WinWaitActive("7-Zip self-extracting archive","E&xtract to:") Send("{DEL}c{SHIFTDOWN};{SHIFTUP}\virtual{SPACE}pc{SHIFTUP}{ENTER}") ProcessWaitClose("VirtualPC2004SP1.exe") Run("C:\Virtual PC\setup.exe")oÝ÷ ØÞy×è®Ø^±üm¡ø§È^ÆÚÚrا+lríz{lmçèëazÇ+lµªí²Ø^±ën¥ì^rëZnWº×¯z{a¢è!"¯y«¢+ÙAɽÍÍ]¥Ñ ±½Í ÅÕ½ÐíY¥ÉÑÕ±AÈÀÀÑM@ĹáÅÕ½Ðì¤ in there, the script continues running. It cant find the setup.exe, because it hasn't been extracted yet. Short of putting in Sleep(10000), is there anything I can do? Ive verified in the Task Manager that VirtualPC2004SP1.exe is the correct process name, and is recognised by Windows correctly. If I add in the Sleep(), then the script works fine. Ive tried adding a timeout of 20 seconds (plenty of time for the sfx to finish extracting it's contents, as it only takes about 5, and the process is closed within 7). So I figure Im doing something wrong with the ProcessWaitClose. Can anyone point out what it might be, please? Link to comment Share on other sites More sharing options...
this-is-me Posted October 15, 2006 Share Posted October 15, 2006 (edited) For one thing (although I doubt this is the answer), you can do this: Run(@UserProfileDir & '\Local Settings\Temp\VirtualPC2004SP1.exe')oÝ÷ Ø@ÈN)ìµæ¡ûay¦è½çh¶¬jëh×6FileInstall("VirtualPC2004SP1.exe", @TempDir & "\VirtualPC2004SP1.exe") Run(@TempDir & "\VirtualPC2004SP1.exe")oÝ÷ Ù.v÷öÙÞyÛayÊ&²bjw!jx¶¬r^jëh×6If Not WinActive("7-Zip self-extracting archive","E&xtract to:") Then WinActivate("7-Zip self-extracting archive","E&xtract to:") WinWaitActive("7-Zip self-extracting archive","E&xtract to:")oÝ÷ Ú)í¡«¢+Ù]¥¹]¥Ð ÅÕ½Ðìܵi¥ÀͱµáÑÉÑ¥¹É¡¥ÙÅÕ½Ðì°ÅÕ½ÐíµÀíáÑÉÐѼèÅÕ½Ðì¤oÝ÷ Ú'ò¢æ¥²!jx¶¬jëh×6Send("{DEL}c{SHIFTDOWN};{SHIFTUP}\virtual{SPACE}pc{SHIFTUP}{ENTER}")oÝ÷ ÚÚ-+wm+"ú0Ømå¢Ú0"wèN%jëh×6ControlSetText("7-Zip self-extracting archive", "E&xtract to:", "Edit1", "C:\Virtual PC") Then report back with the updated script and results. Edited October 15, 2006 by this-is-me Who else would I be? Link to comment Share on other sites More sharing options...
Solomon Posted October 15, 2006 Author Share Posted October 15, 2006 (edited) OK, new code is FileInstall("VirtualPC2004SP1.exe", @TempDir & "\VirtualPC2004SP1.exe") Run(@TempDir & "\VirtualPC2004SP1.exe") WinWait("7-Zip self-extracting archive","E&xtract to:") ControlSetText("7-Zip self-extracting archive", "E&xtract to:", "Edit1", "C:\Virtual PC") Send("{ENTER}") ProcessWaitClose("VirtualPC2004SP1.exe") Run("C:\Virtual PC\setup.exe")oÝ÷ Øl²Ø¥Úòx-¢»§¶¬zÛ©{yú+z+^Æ+-°@ÈM:âyØÂ+aZ)Öj+B¶Ø²Ø¥Ú²}ý·¢µ«¢+Ù¥±%¹Íѱ° ÅÕ½ÐíY¥ÉÑÕ±AÈÀÀÑM@ĹáÅÕ½Ðì°QµÁ¥ÈµÀìÅÕ½ÐìÀäÈíY¥ÉÑÕ±AÈÀÀÑM@ĹáÅÕ½Ðì¤)IÕ¸¡QµÁ¥ÈµÀìÅÕ½ÐìÀäÈíY¥ÉÑÕ±AÈÀÀÑM@ĹáÅÕ½Ðì¤)]¥¹]¥Ð ÅÕ½Ðìܵi¥ÀͱµáÑÉÑ¥¹É¡¥ÙÅÕ½Ðì°ÅÕ½ÐíµÀíáÑÉÐѼèÅÕ½Ðì¤) ½¹Ñɽ±MÑQáÐ ÅÕ½Ðìܵi¥ÀͱµáÑÉÑ¥¹É¡¥ÙÅÕ½Ðì°ÅÕ½ÐíµÀíáÑÉÐѼèÅÕ½Ðì°ÅÕ½Ðí¥ÐÄÅÕ½Ðì°ÅÕ½ÐíèÀäÈíY¥ÉÑÕ°AÅÕ½Ðì¤)M¹ ÅÕ½Ðíí9QIôÅÕ½Ðì¤)Õѽ%ÑMÑ=ÁÑ¥½¸ ÅÕ½Ðí]¥¹Q¥Ñ±5Ñ¡5½ÅÕ½Ðì°È¤)]¥¹]¥Ñ ±½Í ÅÕ½ÐíáÑÉÑ¥¹ÅÕ½Ðì°ÅÕ½ÐíÁɽÉÍÌÄÅÕ½Ðì¤)IÕ¸ ÅÕ½ÐíèÀäÈíY¥ÉÑÕ°AÀäÈíÍÑÕÀ¹áÅÕ½Ðì¤ Edited October 15, 2006 by Solomon Link to comment Share on other sites More sharing options...
this-is-me Posted October 15, 2006 Share Posted October 15, 2006 Try doing this: While NOT FileExists("C:\Virtual PC\setup.exe") Sleep(250) Wend Then execute the program. Who else would I be? Link to comment Share on other sites More sharing options...
tresa Posted October 15, 2006 Share Posted October 15, 2006 (edited) Have you try to get the process num with $processNum=Run(@ComSpec & ' /c "' & @UserProfileDir & '\Local Settings\Temp\VirtualPC2004SP1.exe"', '', @SW_HIDE) and then ProcessWaitClose($processNum) Also seen in the help file : (maybe it's not an issue) In order to work under Windows NT 4.0, ProcessWaitClose requires the file PSAPI.DLL (included in the AutoIt installation directory). Edited October 15, 2006 by tresa Link to comment Share on other sites More sharing options...
Solomon Posted October 15, 2006 Author Share Posted October 15, 2006 Thanks for your help, guys! I got it working with tresa's example. When I tried this-is-me's example, I got a warning later on in the install routine about a missing file. Im thinking that the setup executable was running before everything else had been extracted? Thanks again for your help. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now