PcExpert Posted February 7, 2008 Share Posted February 7, 2008 (edited) Hi all, Autoit is telling me that I need to put a then statement after an if statement. But the if, then and endif statements are already there. When I just run the script or run it once compiled it works just fine, it only gives the error when the program is ran from another autoitscript. Why. RunWait(@TempDir & "\str.exe") Gives this error: Line -1: Error: "If" statements must have a "Then" keyword. Thanks! Edited February 7, 2008 by PcExpert Link to comment Share on other sites More sharing options...
whim Posted February 7, 2008 Share Posted February 7, 2008 Well... with this little information all I can suggest is to recheck all your loops, not only the If/Then ones. In my experience another unmatched loop inside or around an If/Then can provoke this error. Link to comment Share on other sites More sharing options...
PcExpert Posted February 7, 2008 Author Share Posted February 7, 2008 (edited) As I said, it works. But it only doesnt when called by another autoitscript. So I dont think its an error in my loop. Edited February 7, 2008 by PcExpert Link to comment Share on other sites More sharing options...
BrettF Posted February 7, 2008 Share Posted February 7, 2008 (edited) Is that the full code? And is Str.exe the name of the compiled script? Edited February 7, 2008 by Bert 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! Link to comment Share on other sites More sharing options...
PcExpert Posted February 7, 2008 Author Share Posted February 7, 2008 (edited) No the full code from the main program, that calls str.exe is this part: GUICtrlSetState($store, $GUI_DISABLE) RunWait(@TempDir & "\str.exe") GUICtrlSetState($store, $GUI_Enable) thanks Edited February 8, 2008 by PcExpert Link to comment Share on other sites More sharing options...
PcExpert Posted February 8, 2008 Author Share Posted February 8, 2008 *bump* Link to comment Share on other sites More sharing options...
whim Posted February 8, 2008 Share Posted February 8, 2008 You could try to run the source of str.au3 via AutoIt3.exe, then it should at least tell you at which line it errors ? Link to comment Share on other sites More sharing options...
SadBunny Posted February 8, 2008 Share Posted February 8, 2008 (edited) I suspect you forgot to copy a working version of str.exe to your @TempDir. The str code works fine. /edit: yes, I compiled the str.au3 code to an exe and ran it from another script, just like you said Are you sure you don't mean @scriptdir instead of @tempdir? Edited February 8, 2008 by SadBunny Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
PcExpert Posted February 8, 2008 Author Share Posted February 8, 2008 The main script first does a fileinstall() and then runs str.exe from @tempdir where the file is also being installed, when the user clicks a button the str.exe is run. Link to comment Share on other sites More sharing options...
PsaltyDS Posted February 8, 2008 Share Posted February 8, 2008 The main script first does a fileinstall() and then runs str.exe from @tempdir where the file is also being installed, when the user clicks a button the str.exe is run.You didn't try to slip @ScriptDir or some other macro or variable into the FileInstall() source field, did you? I don't see this FileInstall() in the code you posted. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
PcExpert Posted February 8, 2008 Author Share Posted February 8, 2008 The fileinstall part: FileInstall("store.exe", @TempDir & "\str.exe") Run str.exe Case $msg = $store GUICtrlSetState($store, $GUI_DISABLE) RunWait(@TempDir & "\str.exe") GUICtrlSetState($store, $GUI_Enable) Link to comment Share on other sites More sharing options...
SadBunny Posted February 8, 2008 Share Posted February 8, 2008 I would change two things about the fileinstall part: 1. change "store.exe" to "C:\mystuff\store.exe" (full path) 2. use the third parameter (the overwrite flag). It makes sure that the FileInstall overwrites an already present file, so that if you have an old version at the old location it gets overwritten with the new one. That would lead to: FileInstall("c:\mystuff\store.exe", @TempDir & "\str.exe",1) Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
PcExpert Posted February 8, 2008 Author Share Posted February 8, 2008 Thanks, it works now. 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