Tyralion Posted November 2, 2016 Posted November 2, 2016 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.
spudw2k Posted November 3, 2016 Posted November 3, 2016 (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 November 3, 2016 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF
Tyralion Posted November 4, 2016 Author Posted November 4, 2016 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!
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