Jump to content

Compiled script generates error, but uncompiled runs fine


Recommended Posts

I wrote a script that runs just fine, but if I compile it, it generates this error: Screen-Shot-1712794021.jpg

The code can be seen in full here - AutoGAT++, but I can post the script here if need be. I have troubleshot it down to line 35 of the script.

If the line reads as

Local $idRest = TrayCreateItem("Restart", $idAG)

the script, compiled or not, runs just fine. However, if the line reads as

If Not @Compiled Then Local $idRest = TrayCreateItem("Restart", $idAG)

the compiled script when run will generate that error window.

So I guess I just want to know why it errors if I modify that line with that macro and an If statement, and only the compiled version.

 

Oh cheese & crackers, I just figured it out and I feel like a dimwit. I guess variables do need to declared before they're used.. Minutes & minutes of my life have been spent making sure this post is formatted correctly so I don't want to erase all this text. At the very least, this post might make one or many chuckle.

 

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Link to comment
Share on other sites

18 minutes ago, argumentum said:

try that ?

The Restart UDF is constantly called if the script is compiled and run. I had no actual need to check if the script is compiled or not, I was just curious. One thing I did try was to also add the If and the macro to the line where that variable is used. I added it to line 61 but I guess an If..Then statement can't be used in order to declare a Case. Thanks though.

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

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...