somdcomputerguy Posted April 11, 2024 Posted April 11, 2024 I wrote a script that runs just fine, but if I compile it, it generates this error: 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.
argumentum Posted April 11, 2024 Posted April 11, 2024 Local $idRest = "" If Not @Compiled Then $idRest = TrayCreateItem("Restart", $idAG) try that ? Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
somdcomputerguy Posted April 11, 2024 Author Posted April 11, 2024 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.
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