Jump to content

bogus "Varaible used without being declared" script error message


Recommended Posts

The following code results in the error "AutoIt Error" "Line -1: variable used without being declared"

$CmdString = """C:\Program Files\Citrix\ICA Client\pnagent.exe"" /CitrixShortcut: (2) /QLaunch ""PRD1Farm:Muse Editor"""

RunWait($CmdString)

As you can see the variable is declared. The intersting thing to me is that if I run the AU3 file as a parameter of AutoIt3.exe, i get the same bogus "Line: -1" line number message. What is causing the error?

--Donald

Link to comment
Share on other sites

I can see it being defined.. Try Local $CmdString = """C:\Program Files\Citrix\ICA Client\pnagent.exe"" /CitrixShortcut: (2) /QLaunch ""PRD1Farm:Muse Editor"""

RunWait($CmdString).

Or,

Local $CmdString

$CmdString = """C:\Program Files\Citrix\ICA Client\pnagent.exe"" /CitrixShortcut: (2) /QLaunch ""PRD1Farm:Muse Editor"""
RunWait($CmdString)
Edited by snowmaker

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

Link to comment
Share on other sites

The following code results in the error "AutoIt Error" "Line -1: variable used without being declared"

$CmdString = """C:\Program Files\Citrix\ICA Client\pnagent.exe"" /CitrixShortcut: (2) /QLaunch ""PRD1Farm:Muse Editor"""

RunWait($CmdString)

As you can see the variable is declared. The intersting thing to me is that if I run the AU3 file as a parameter of AutoIt3.exe, i get the same bogus "Line: -1" line number message. What is causing the error?

try adding " Local $CmdString " to the top of your line there.

not sure why, but it seems to help. Edit: i see snowmaker and i posted at same time lol. :(

Edited by cueclub
Link to comment
Share on other sites

That error is from a compiled script and does not in fact point to the line where the error is occuring so there is no way of knowing from what you posted where the error is. Try running it as a script from Scite instead of compiled to see what the true error is.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Thanks for the suggestions. Unfortunately putting Local $CmdString above yields the same error. I already knew that the -1 Line number is because the code is compiled and had tried running the script AU3 file (as a parameter of AutoIt3.exe), but oddly, I get the same -1 Line error message. I don't really know how to use SciTE for debugging, but I get the same error using F5 (Go). Even running the command directly without a variable gives the same error message! ShellExecute (or ShellExecuteWait) has the same result as Run (or RunWait). Very strange! Stranger yet, exiting the script after the Citrix connection is made, and then launching a shortcut (that has nothing to do with AutoIt3) results in the same error!

Edited by donald2

--Donald

Link to comment
Share on other sites

Thanks for the suggestions. Unfortunately putting Local $CmdString above yields the same error. I already knew that the -1 Line number is because the code is compiled and had tried running the script AU3 file (as a parameter of AutoIt3.exe), but oddly, I get the same -1 Line error message. I don't really know how to use SciTE for debugging, but I get the same error using F5 (Go). Even running the command directly without a variable gives the same error message!

Is that script calling another compiled file by any chance? If it is then take a good look at the other script for the problem.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Is that script calling another compiled file by any chance? If it is then take a good look at the other script for the problem.

No, its not calling another script. But there certainly do seem to be some strange things happening with AutoIt in memory. Even after rebooting, and no AutoIt script running, I get the AutoIt error when I launch the shortcut after the AutoIt script establishes the Citrix connection.

Edited by donald2

--Donald

Link to comment
Share on other sites

I've determined that the AutoIt error is actually coming from the Citrix server. I'm in the process of gaining access to that.

The error was from teh server on a different AutoIt script that threw the error because I was setting a variable to @OSVersion only for workstation OSs. Didn't know scripts were running on our Citrix servers!

--Donald

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