failedtocompile Posted June 13, 2009 Posted June 13, 2009 Greetings Im a novice with AutoIT and have been struggling with an element within my script. I have read the Help file "CMDline" "DOS" and have read over 20 different forum posts with regards to the issue im having. Not one of the avenues I have tried to source for support has helped, possibly due to my lack of understanding. This is what Im working on #Majority of the leading code has been removed, as this is a private not for profit project {failedtocompile} Run("""""C:\Program Files\???\WIZ.EXE""/q /s ""%HomeDrive%%homepath%\folder\folder""""") ;RunWait("""C:\Program Files\???\WIZ.EXE""/q /s ""%HomeDrive%%homepath%\folder\folder""") <<temporraly commented out while testing both methods sleep(10000) EndSwitch WEnd The GUI executes perfectly the only issue I am having is trying to Run or RunWait "ROFLWIZ.EXE" with arguments /q /s {/q for silent} {/s for file to save to} Have also looked at $CmdLine[0] is number of parameters $CmdLine[1] is param 1 (after the script name) $CmdLine[2] is param 2 etc ... $CmdLine[$CmdLine[0]] is one way to get the last parameter... But I'm not sure how to apply this correctly to suit my porpose. If I remove the /q it works very well but just adding that additional argument nothing happens, No errors and doesnt create the file. I have also tried adding triple quotes quad quotes. I will be eventually changing %HomeDrive%HomePath% to just %homePath% I have spent over 5hrs today learning to create GUI and trying to progress further with AutoIT, I must say I have enjoyed it thus far If anyone could shine a "light" for a poor and distressed Novie, It would be greatly appreciated Kind Regards failedtocompile
martin Posted June 13, 2009 Posted June 13, 2009 Greetings Im a novice with AutoIT and have been struggling with an element within my script. I have read the Help file "CMDline" "DOS" and have read over 20 different forum posts with regards to the issue im having. Not one of the avenues I have tried to source for support has helped, possibly due to my lack of understanding. This is what Im working on #Majority of the leading code has been removed, as this is a private not for profit project {failedtocompile} Run("""""C:\Program Files\???\WIZ.EXE""/q /s ""%HomeDrive%%homepath%\folder\folder""""") ;RunWait("""C:\Program Files\???\WIZ.EXE""/q /s ""%HomeDrive%%homepath%\folder\folder""") <<temporraly commented out while testing both methods sleep(10000) EndSwitch WEnd The GUI executes perfectly the only issue I am having is trying to Run or RunWait "ROFLWIZ.EXE" with arguments /q /s {/q for silent} {/s for file to save to} Have also looked at $CmdLine[0] is number of parameters $CmdLine[1] is param 1 (after the script name) $CmdLine[2] is param 2 etc ... $CmdLine[$CmdLine[0]] is one way to get the last parameter... But I'm not sure how to apply this correctly to suit my porpose. If I remove the /q it works very well but just adding that additional argument nothing happens, No errors and doesnt create the file. I have also tried adding triple quotes quad quotes. I will be eventually changing %HomeDrive%HomePath% to just %homePath% I have spent over 5hrs today learning to create GUI and trying to progress further with AutoIT, I must say I have enjoyed it thus far If anyone could shine a "light" for a poor and distressed Novie, It would be greatly appreciated Kind Regards failedtocompileLooks like you need a space added which could be part of the problem " /q..." ;instead of "/q..." Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
failedtocompile Posted June 13, 2009 Author Posted June 13, 2009 (edited) Looks like you need a space added which could be part of the problem " /q..." ;instead of "/q..." Thanks martin, its one step closer Problem I have still and forgot to mention is that when executed it saves it to: C:\Program Files\?? ??\WIZ.EXE\%HomeDrive%%homepath%\folder\folder instead of %HomeDrive%%Homepath%\folder\folder {C:\Documents and settings\profile\my documents\folder\filename} If i run the same Exe in a dos prompt Dos: "C:\Program Files\?? ???\WIZ.EXE"/q /s "desired folder destination\file" {/q directly after the " no spaces /s one space after /q} It works great, I have a working batch file I have tried multiple combination of adding and removing "" , which i dont really understand I also saw a post someone wanted to know how to run an .msi with arguments for silent install, i thought it was similar but was unable to apply it to mine Cheers Edited June 14, 2009 by failedtocompile
failedtocompile Posted June 14, 2009 Author Posted June 14, 2009 (edited) I have just tried RunWait('"C:\Program Files\?? ??\?? ??\WIZ.EXE" /q /s ' & 'c:\test123') This seems to have worked only problem is that it doesnt work if the folder path has spaces in it example RunWait('"C:\Program Files\?? ??\?? ??\WIZ.EXE" /q /s ' & '"%homedrive%%HomePath%\My Documents\test101"') Anyone able to help me? do i need to place more quotes somehere? Cheers Edited June 14, 2009 by failedtocompile
BrettF Posted June 14, 2009 Posted June 14, 2009 Are you sure everything is fine with %homedrive% and the like? Try something like so: Opt('ExpandEnvStrings', 1) RunWait('"C:\Program Files\BLAH\WIZ.EXE" /q /s "%homedrive%%HomePath%\My Documents\test101"') Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
failedtocompile Posted June 14, 2009 Author Posted June 14, 2009 (edited) Are you sure everything is fine with %homedrive% and the like? Try something like so: Opt('ExpandEnvStrings', 1) RunWait('"C:\Program Files\BLAH\WIZ.EXE" /q /s "%homedrive%%HomePath%\My Documents\test101"') Hi BrettF I tried you example obviosuy amending, but nothing happens. for a split second show hr glass as if it was thinking about executing the command. RunWait('"C:\Program Files\?? ??\folder\WIZ.EXE" /q /s "%homedrive%%HomePath%\My Documents\test101"') It all seems to come back to having spaces in destination path and have multiple arguments /q /s as mentioned prior works in batch file format and both /s and /q are vaild arguments Edited June 14, 2009 by failedtocompile
BrettF Posted June 14, 2009 Posted June 14, 2009 @MyDocumentsDir FTW Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
failedtocompile Posted June 14, 2009 Author Posted June 14, 2009 (edited) Does this work? RunWait("C:\Program Files\?? ??\folder\WIZ.EXE /q /s " & @MyDocumentsDir & "\test101") Bah, I was looking for that, but I guess I didn't scroll down far enough. No sorry didnt have desired effect What it did do tho was pop up a window detailing vaild arguments like what would happen if you droped a M$ .exe in cmd and tacked /? at the end e.g. "C:\Program Files\?? ??\folder\WIZ.EXE"/? would produce a window detailing vaild arguments and what they do ect... Have attached SS of window that pops up. Thnx thus far for your assistance Edited June 14, 2009 by failedtocompile
failedtocompile Posted June 14, 2009 Author Posted June 14, 2009 Okay, if I understand that correctly, the problem is that you need to specify an "OPS file" for the "/s" parameter. Right now you only have a directory. Try this. RunWait("C:\Program Files\?? ??\folder\WIZ.EXE /q /s " & @MyDocumentsDir & "\test101\Test.OPS") Thnx Thanubis but doesnt @MyDocumentsDir define a directory structure hence @MyDocumentsDir & "\test101\ = c:\documents and settings\profile\my documents\test101 Also your example unfortunatly didnt work again displays the screen shot a posted. the problem seems to be when having 2x arguments and "if" the folder structure i want to save the file to has spaces in the name. This problem seems like a real douzy currently clocked up 7hrs reading forum posts trying to find relevence
failedtocompile Posted June 14, 2009 Author Posted June 14, 2009 Some Google searching revealed that the /s parameter file path must be enclosed in quotes if it contains a space. I don't know why I didn't notice it sooner (maybe because it's 4AM), but my quotes have been screwed this whole time. Also, /s and / q can be used together without a problem. I think I've got it right this time. RunWait('"C:\Program Files\?? ??\folder\WIZ.EXE" /q /s "' & @MyDocumentsDir & '\test101\Test.OPS"') WOOOOT Thanks so much Thanubis you are a bloody star that worked, also you shouldnt stay up too late on my account that is a bit obsessive lol Have posted ss of my first application i have ever created in Autoit, will add ur name to the code for assisting me with this one mate
rajeshontheweb Posted June 14, 2009 Posted June 14, 2009 (edited) if u feel u will have spaces in the directory names it is BETTER to use short names only for dos prompt as even in windows xp (which case spaces are supported) there is a chance some times the path fails due to some minor errors ..use the functionFileGetShortName ( "file" [, flag] )try to see if this works Local $ProgramFile, $argFile $ProgramFile = FileGetShortName("C:\Program Files\?? ??\folder\WIZ.EXE") $argFile = FileGetShortName(@MyDocumentsDir & "\test101\Test.OPS") $command = "'" & chr(34) & $ProgramFile & Chr(34) & " /q /s " & chr(34) & $argFile & chr(34) & "'" Runwait($command)but one catch is there , which is usually ignored - shortnames differ from one pc to other so they better not be hard coded into a variable that is used in different situations, it should be called on the host computer and at the time of execution only, which will cover any unexpected errors due to a deleted file or some thing like that Edited June 14, 2009 by rajeshontheweb Started late is much better than having never started it!!!!Failure is another step towards success. I've been messing around with: Adding Entry to 'Hosts'File Information Lister (Logger)Yet Another AutoIT Error Handler Yet Another AutoIT Error Handler & Debugger Control your App's TaskBar Button YCurrency Ticker (Latest Release : 16 Apr 2009)_WinInetInternetCheckConnection UDF Symantec Definitions Lister UDF _GetLocalIPAddresses UDF UDF to get Special Folder Information WMI_NetworkAdapterConfiguration2Array WMI_CDRomDriveCapabilities _ScriptExists - Check if your au3 script is running!! Uninstaller UDF Get Version for your application (at script level or compiled stage) Uninstaller Pro - faster alternative to windows application removal applet
failedtocompile Posted June 14, 2009 Author Posted June 14, 2009 if u feel u will have spaces in the directory names it is BETTER to use short names only for dos prompt as even in windows xp (which case spaces are supported) there is a chance some times the path fails due to some minor errors .. use the functionFileGetShortName ( "file" [, flag] ) try to see if this works Local $ProgramFile, $argFile $ProgramFile = FileGetShortName("C:\Program Files\?? ??\folder\WIZ.EXE") $argFile = FileGetShortName(@MyDocumentsDir & "\test101\Test.OPS") $command = "'" & chr(34) & $ProgramFile & Chr(34) & " /q /s " & chr(34) & $argFile & chr(34) & "'" Runwait($command) but one catch is there , which is usually ignored - shortnames differ from one pc to other so they better not be hard coded into a variable that is used in different situations, it should be called on the host computer and at the time of execution only, which will cover any unexpected errors due to a deleted file or some thing like that Thanks rajeshontheweb Will keep that snipet for latter implementation. all computers are goign to be in a standard environment XPSP3 all with Mydocuments being stored on a server e.g. \\server2003\userprofile\My Documents. Will be doing more testing tomorrow,
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