Sign in to follow this  
Followers 0
HockeyFan

HELP! Script no longer works...

14 posts in this topic

Can someone please help me with this!

I had a script that was working on a Windows 2003 server...created and compiled on a Vista PC...until I upgraded to version 3.20.10.0. I made a simple change (added @ComputerName to Line 42 & 61) then recompiled the script and now when it runs, I get the following error message:

Line -1:

Error: Unknown function name.

; Script Start
Opt("TrayIconHide", 0)
Opt("TrayIconDebug", 1)
Break(1)
RunAsSet("xxxxxx", @ComputerName, "xxxxxx")

#include <Process.au3>
Call("ProxyHostService")
Exit


Func ProxyHostService()
 $PID = ProcessExists("PhSvc.exe"); Will return the PID or 0 if the process isn't found.
 Do
  Sleep(60000)
  $PID = ProcessExists("PhSvc.exe"); Will return the PID or 0 if the process isn't found.
 Until $PID = 0
 Call("SendEmailStopped")
 Call("RestartProxyHostService")
EndFunc  ;==>ProxyHostService

Func SendEmailStopped()
 $ProgramPath1 = "C:\Software\Blat\Blat.exe";Path to Program executable.
 $MessageBody1 = "C:\Software\Blat\PhSvc_Stopped.txt";File to put in the body of the emial message.
 $To1 = "username[email="username@domain.org"]@domain.org[/email]"
 $From1 = @ComputerName & " Server"
 $Subject1 = "Stopped: " & @ComputerName & " Proxy Host Service"
 $RunProgram1 = $ProgramPath1 & " " & $MessageBody1 & " -to " & $To1 & " -s " & '"' & $Subject1 & '"' & " -From " & '"' & $From1
 RunWait(@ComSpec & " /c " & $RunProgram1)
EndFunc  ;==>SendEmailStopped

Func RestartProxyHostService()
 RunWait(@ComSpec & " /c " & 'net start "ProxyHostService"')
 ProcessWait("PhSvc.exe")
 Call("SendEmailStarted")
 Call("ProxyHostService")
EndFunc  ;==>RestartProxyHostService

Func SendEmailStarted()
 $ProgramPath2 = "C:\Software\blat\Blat.exe";Path to Program executable.
 $MessageBody2 = "C:\Software\blat\PhSvc_Started.txt";File to put in the body of the emial message.
 $To2 = "username[email="username@domain.org"]@domain.org[/email]"
 $From2 = @ComputerName & " Server"
 $Subject2 = "Started: " & @ComputerName & " Proxy Host Service"
 $RunProgram2 = $ProgramPath2 & " " & $MessageBody2 & " -to " & $To2 & " -s " & '"' & $Subject2 & '"' & " -From " & '"' & $From2
 RunWait(@ComSpec & " /c " & $RunProgram2)
EndFunc  ;==>SendEmailStarted

Can someone explain why I am now getting this error???

Share this post


Link to post
Share on other sites



When I ran your script through syntaxcheck I received two errors dealing with the $to1 and $to2. I'm assuming that you changed those when you posted it on the forum.

the Call feature is not needed, you could just put in "ProxyHostService()" instead of "Call("RestartProxyHostService")"


Kerros===============================================================How to learn scripting: Figure out enough to be dangerous, then ask for assistance.

Share this post


Link to post
Share on other sites

You really don't need to use Call()

Call("SendEmailStarted")

Call("ProxyHostService")

-->

SendEmailStarted()

ProxyHostService()

Why are you including Process.au3??

#include <Process.au3>

Share this post


Link to post
Share on other sites

When I ran your script through syntaxcheck I received two errors dealing with the $to1 and $to2. I'm assuming that you changed those when you posted it on the forum.

the Call feature is not needed, you could just put in "ProxyHostService()" instead of "Call("RestartProxyHostService")"

That's odd...when I run it through SyntaxCheckprod on v3.2.10.0 I don't receive any errors! And no, I didn't change $To1 nor $To2. What errors did you get?

Thanks for you help.

Share this post


Link to post
Share on other sites

You really don't need to use Call()

Call("SendEmailStarted")

Call("ProxyHostService")

-->

SendEmailStarted()

ProxyHostService()

Why are you including Process.au3??

#include <Process.au3>

Ooops...I pulled this snippet of code from another script that I had created that used Process.au3. I just missed removing it when I was cleaning it up. Thanks for the tip on not using the "Call" function.

Share this post


Link to post
Share on other sites

I'm running 3.2.10.0 as well. here is the output from AU3Check

>Running AU3Check (1.54.10.0) from:C:\Program Files\AutoIt3

C:\Autoit_scripts\test.au3(25,25) : ERROR: syntax error

$To1 = "username[email="username

~~~~~~~~~~~~~~~~~~~~~~~~^

C:\Autoit_scripts\test.au3(42,25) : ERROR: syntax error

$To2 = "username[email="username

~~~~~~~~~~~~~~~~~~~~~~~~^

C:\Autoit_scripts\test.au3 - 2 error(s), 0 warning(s)

username@domain.org isn't defined anywhere, and unless I'm mistaken (which is possible) Autoit is going to need to have that information to do the email.


Kerros===============================================================How to learn scripting: Figure out enough to be dangerous, then ask for assistance.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

I'm running 3.2.10.0 as well. here is the output from AU3Check

username@domain.org isn't defined anywhere, and unless I'm mistaken (which is possible) Autoit is going to need to have that information to do the email.

Thats not the problem, the problem is that he is nesting double quotes inside each other. Use single quotes on the outside of this line:

$To1 = "username[email="username@domain.org"]@domain.org[/email]"

-->

$To1 = 'username[email="username@domain.org"]@domain.org[/email]'
Edited by weaponx

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

I'm running 3.2.10.0 as well. here is the output from AU3Check

username@domain.org isn't defined anywhere, and unless I'm mistaken (which is possible) Autoit is going to need to have that information to do the email.

OK, I see why. When the code was processed for the forum it added the extra text. The original line is just an email address, which I changed before I posted. The original line is just:

$To1 = "xxxxxxx@xxxxxxx.org"

>>>of course, the x's mask the actual data....just an email address.

That now makes sense as to why you received the error.

Edited by HockeyFan

Share this post


Link to post
Share on other sites

Why the extra text was added during the post, I don't know. It is not is my script!! ...that's why I'm not getting any syntax errors; so...

Where's the unknown function name?

Where is line -1?

Can anyone tell me??

Share this post


Link to post
Share on other sites

I get no errors once I cleaned up the email addresses. Did you take out the #include?

Share this post


Link to post
Share on other sites

Why the extra text was added during the post, I don't know. It is not is my script!! ...that's why I'm not getting any syntax errors; so...

Where's the unknown function name?

Where is line -1?

Can anyone tell me??

The line -1 only shows up if there is an error in a compiled script and it could be any line number in the au3 script. Compiled scripts always return it as -1

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!"

Share this post


Link to post
Share on other sites

I get no errors once I cleaned up the email addresses. Did you take out the #include?

Yes...verified, saved, and recompiled. I still get the error! ARGH!!!! :)

Share this post


Link to post
Share on other sites

The line -1 only shows up if there is an error in a compiled script and it could be any line number in the au3 script. Compiled scripts always return it as -1

Thanks for that info! Now I can concentrate on the "unknown function name" where ever that may be.

Share this post


Link to post
Share on other sites

OK! :)

I'm happy to report that the issue has been resolved. I copied the script text to another instance of AutoIt on a "WINDOWS XP SP2" PC with the same AutoIt v3.2.10.0 and recompiled it. It now works without any error. It must have been some sort of compile error on Vista!

Thanks everyone for you assistance!

Share this post


Link to post
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
Sign in to follow this  
Followers 0