I have some code along these lines.. its not finished.. but the intention was to build up an email-checker (an addy i dont use anywhere but for this..) that I can send to via my SMS/email (phone), and then get responses back to my phone from the pc .. like weather etc etc
Maybe you can use parts of it for your project
Again.. its certainly not finished, so dont laugh you guys.. lol
You can put string filters in at the "Commands:" section, etc to branch off your exe run files.. and even work some blat in there to send confirmation back to your cell.
edit (Jul1/ 12:15e): worked on it more, now it actually works.. sorry about that !
edit again, added the "Hide" function to the getmail command
Code:
#SingleInstance
;
;Check existance of getmail.exe and blat.dll
;
IfNotExist, getmail.exe
{
GoSub, MissingGetMail
}
IfNotExist, blat.dll
{
GoSub, MissingBlat
}
IfNotExist, SMSER.ini
{
Goto, SMSERConfig
}
ReadINI:
IniRead, Server, SMSER.ini, User, Server
IniRead, UserName, SMSER.ini, User, UserName
IniRead, Password, SMSER.ini, User, Password
IniRead, Authorized, SMSER.ini, User, Authorized
IniRead, CheckPeriod, SMSER.ini, User, CheckPeriod
EnvMult, CheckPeriod, 1000
CheckMail:
Run, "getmail.exe" -u %UserName% -pw %password% -s %server% -delete,, Hide
WinWaitClose, getmail.exe
Sleep, 1000 ; allow time for txt files to get written to hd before proceeding, inc/dec as required..
Loop, *.txt
{
AuthPass = ""
Loop, Read, %A_LoopFileName%
{
If A_LoopReadLine Contains Subject:
Subject = %A_LoopReadLine%
If A_LoopReadLine Contains Date:
Date = %A_LoopReadLine%
IfInString, A_LoopReadLine, %authorized%
AuthPass = %A_LoopReadLine%
}
StringTrimLeft, Date, Date, 5
StringTrimRight, Date, Date, 6
StringTrimLeft, Subject, Subject, 8
IfNotEqual,AuthPass,""
{
GoSub, Commands
}
}
FileDelete, MSG???.txt
Sleep, CheckPeriod
Goto, CheckMail
ExitApp
Commands:
FileAppend, %Date% %Subject% %AuthPass% `n, commandlog.log
StringReplace, AuthOps, AuthPass, %Authorized%, ; strips the password from the commands/etc
; now you would have the commands as issued, minus the password
Msgbox, %AuthOps%
Return
MissingGetMail:
MsgBox, 1, File Missing, File Needed: GetMail.exe `n Click OK to download getmail.exe to this program's working directory.`n Extract Getmail.exe then restart this program to Continue.
IfMsgBox, Cancel
ExitApp
IfMsgBox, OK
URLDownloadToFile, http://www.interlog.com/~tcharron/getmail.zip, Getmail.zip
Run, %A_WorkingDir%
Return
MissingBlat:
MsgBox, 1, File Missing, File Needed: Blat.dll `n Click OK to download blat.dll to this program's working directory.`n Extract Blat.dll then restart this program to Continue.
IfMsgBox, Cancel
ExitApp
IfMsgBox, OK
URLDownloadToFile, http://downloads.sourceforge.net/blat/blat262.full.zip, Blat.zip
Run, %A_WorkingDir%
Return
SMSERConfig:
Gui, Add, Text, x26 y0 w340 h30 , Configure User - Enter server`, username and password for email account to be monitored.
Gui, Add, Text, x26 y30 w140 h20 , Server (ie mail.someisp.com)
Gui, Add, Edit, x166 y30 w200 h20 vServer
;GuiControl,,Server, %Server%
Gui, Add, Text, x26 y60 w140 h20 , Username
Gui, Add, Edit, x166 y60 w200 h20 vUserName
;GuiControl,,UserName, %UserName%
Gui, Add, Text, x26 y90 w140 h20 , Password
Gui, Add, Edit, x166 y90 w200 h20 password vPassword
;GuiControl,, Password, %Password%
Gui, Add, Text, x26 y120 w140 h20, Authorizing Word
Gui, Add, Edit, x166 y120 w200 h20 authorized vAuthorized
;GuiControl,,Authorized, %Authorized%
Gui, Add, Text, x26 y150 w140 h20, Checking delay in seconds
Gui, Add, Edit, x166 y150 w200 h20 CheckPeriod vCheckPeriod
Gui, Add, Button, x36 y200 w120 h30 , OK
Gui, Add, Button, x216 y200 w120 h30 , Cancel
Gui, Add, Text, x96 y240 w190 h20 , Note`, data will be stored in SMSER.ini
; Generated using SmartGUI Creator 4.0
Gui, Show, x131 y91 h268 w394, SMSER Configuration
return
ButtonCancel:
ExitApp
ButtonOK:
GuiClose:
Gui, Submit, NoHide
IniWrite, %Server%, SMSER.ini, User, Server
IniWrite, %UserName%, SMSER.ini, User, UserName
IniWrite, %Password%, SMSER.ini, User, Password
IniWrite, %Authorized%, SMSER.ini, User, Authorized
IniWrite, %CheckPeriod%, SMSER.ini, User, CheckPeriod
Gui, Destroy
Sleep, 1000
Goto, ReadINI