Jump to content

Weird problem with if and then


 Share

Recommended Posts

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

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

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...