ShaneK6555 Posted November 5, 2009 Share Posted November 5, 2009 Hi, I am very new to this scripting language. I am trying to just open a program. The code I'm using is below: ; Prompt the user to run the script - use a Yes/No prompt (4 - see help file) $answer = MsgBox(4, "AutoIt Example (English Only)", "This script will run the Face Generator program and then quit. Run?") ; Check the user's answer to the prompt (see the help file for MsgBox return values) ; If "No" was clicked (7) then exit the script If $answer = 7 Then MsgBox(0, "AutoIt", "OK. Bye!") Exit EndIf ; Run the calculator Run("C:\Program Files\Singular Inversions\FaceGen Modeller 3.4 Free\FaceGenDemo.exe") ; Wait for the calulator become active - it is titled "Calculator" on English systems ;WinWaitActive("FaceGen Modeller 3.4 Free") ; Now that the calc window is active type 2 x 4 x 8 x 16 ; Use AutoItSetOption to slow down the typing speed so we can see it ;AutoItSetOption("SendKeyDelay", 400) ;Send("2*4*8*16=") ;Sleep(2000) ; Now quit by sending a "close" request to the calc ;WinClose("FaceGen Modeller 3.4 Free") ; Now wait for calc to close before continuing ;WinWaitClose("FaceGen Modeller 3.4 Free") ; Finished! This is shamelessly modfied from the calculator example. When I execute this program I get an error cannot find si.ctl. And then the program I am trying to run crashes. What am I doing wrong? thanks. ~Shane Link to comment Share on other sites More sharing options...
GEOSoft Posted November 6, 2009 Share Posted November 6, 2009 Since your code does not reference that file then we can assume it's a file required by FaceGenDemo.exe and it has nothing to do with the script. To clean up the script a bit you can use this If MsgBox(4, "AutoIt Example (English Only)", "This script will run the Face Generator program and then quit. Run?") = 7 Then MsgBox(0, "AutoIt", "OK. Bye!") Exit EndIf Run(@ProgramFilesDir & "\Singular Inversions\FaceGen Modeller 3.4 Free\FaceGenDemo.exe") George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
ShaneK6555 Posted November 6, 2009 Author Share Posted November 6, 2009 Figured it out: I needed to change the Run() command to Run("C:\Program Files\Singular Inversions\FaceGen Modeller 3.4 Free\FaceGenDemo.exe","C:\Program Files\Singular Inversions\FaceGen Modeller 3.4 Free\") ~Shane Link to comment Share on other sites More sharing options...
GEOSoft Posted November 6, 2009 Share Posted November 6, 2009 (edited) Figured it out: I needed to change the Run() command to Run("C:\Program Files\Singular Inversions\FaceGen Modeller 3.4 Free\FaceGenDemo.exe","C:\Program Files\Singular Inversions\FaceGen Modeller 3.4 Free\") ~Shane That can do it. Edit: It would actually be better if you wrote it as $sRunPath = @ProgramFilesDir & "\Singular Inversions\FaceGen Modeller 3.4 Free\" Run ($sRunPath & "FaceGenDemo.exe", $sRunPath) There are really several ways of doing it including this one $sRunPath = @ProgramFilesDir & "\Singular Inversions\FaceGen Modeller 3.4 Free" $sEnvPath = EnvGet("path") EnvSet("Path", $sEnvPath & ";" & $sRunPath Run("FaceGenDemo.exe") EnvSet("Path", $sEnvPath) Just use what works best for you but remember there are usually options available for doing almost anything. Edited November 6, 2009 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" 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