Jump to content

Recommended Posts

Posted (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 by PcExpert
Posted

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.

Posted (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 by PcExpert
Posted

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 ?

Posted (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 by SadBunny

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Posted

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.

Posted

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
Posted

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)
Posted

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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...