Tyralion

Unknown Function Pixelsearch

3 posts in this topic

Hello - I'm not a programmer or even close to one, but I'm having some trouble setting up a small script. The network is a mess so I'm trying to use the PixelSearch function from a computer which is then using RDP to access a monitoring application. How I think this should work is that I should get an email and sound and popup when the particular color sets I'm looking for appear. Once I compile the script, however, I get "Error: Unknown function name." when I run it and simulate the color change. Here is my sanitized script (details such as server IP modified):
 

#include <MsgBoxConstants.au3>
Local $i = 0
$email = MsgBox(4, "Email", "Send an Email on error?")
Sleep(10)
If ($email = 6) Then
                $emaildebug = MsgBox(4, "Debug Email", "Debug Email alert on send?")
                Sleep(10)
EndIf
$sound = MsgBox(4, "Sound", "Play a sound on error?")
Sleep(10)
$popup = MsgBox(4, "Popup", "Create a popup on error?")
Do
                Local $aCoord = PixelSearch(5, 101, 90, 110, 16711680, 10)
                If NOT @error Then
                                If ($email = 6) Then
                                                Local $s_smtpserver = "IPADDRESSHERE"
                                                Local $s_fromname = "FROMNAMEHERE"
                                                Local $s_fromaddress = "FROMADDRESSHERE"
                                                Local $s_toaddress = "TOADDRESSHERE"
                                                Local $s_subject = "ERRORMESSAGEHERE"
                                                Local $as_body = "MORESPECIFICERRORMESSAGEHERE"
                                                Local $iresponse = _inetsmtpmail($s_smtpserver, $s_fromname, $s_fromaddress, $s_toaddress, $s_subject, $as_body, "", -1)
                                                Local $ierr = @error
                                                If ($emaildebug = 6) Then
                                                                If $iresponse = 1 Then
                                                                                MsgBox($mb_systemmodal, "Success!", "Mail sent")
                                                                Else
                                                                                MsgBox($mb_systemmodal, "Error!", "Mail failed with error code " & $ierr)
                                                                EndIf
                                                EndIf
                                EndIf
                                If ($sound = 6) Then
                                                SoundPlay(@WindowsDir & "\media\tada.wav")
                                EndIf
                                If ($popup = 6) Then
                                                MsgBox($mb_systemmodal, "WARNING!", "Postmaster is alarming!", 60)
                                EndIf
                                If ($email = 6) Then
                                                Sleep(600000)
                                EndIf
                EndIf
                Sleep(10000)
Until $i = 1

 

Can anyone take a look and help me figure out why it is saying the function name is unknown? Through trial and error I have determined that it is definitely the PixelSearch function which is causing this error but I really don't know why it is messing up beyond that. I don't see the pixelsearch function detailed in the MsgBoxConstants file but I don't see it in any others either, and the samples all include the MsgBoxConstants file so it seems as though pursuing that route must be a red herring, but again I kind of suck at scripting - Any assistance will be appreciated.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

On my machine, the script above is complaining about missing the _inetsmtpmail function, not the PixelGetColor function.

Try including the source UDF that has that function (#include <Inet.au3>)

 

edit: Also, just a tip on posting code, try using the "Code" button when writing your post.  It is next to the Emoticon button and looks like Less-Then and Greater-Then symbols (<>).

Edited by spudw2k

Share this post


Link to post
Share on other sites

You, sir, are officially my hero. I must've made a separate mistake when I tested it without the email function in place. Thank you!

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