Jump to content

Recommended Posts

Its because I made it that way, you can modify it to accept from other email address too.

Change as follows

Func RemoteGmail()
    ;Check the Main for any New Mails
    Local $eReturn = _CheckGmail($__rg__sUsername, $__rg__sPassword, 'Phoenix XL')
    Local $Emails = @extended
    If @error Then Return SetError(1, @error, -1)
    For $x = 1 To $Emails
;       If $eReturn[$x][0] = $__rg__sEmail Then
            ;Check if the Email is from the Same Address
            If Not _CompareID($eReturn[$x][2]) Then
                If IsArray($__rg__pMessage_Array) Then
                    $__rg__iCount = $__rg__pMessage_Array[0]
                Else
                    $__rg__iCount += 1
                EndIf
                If IniWrite($__rg__sIniFile, $__rg__sSectionName, $__rg__iCount, $eReturn[$x][2]) Then _
                _AddToVar($__rg__pMessage_Array, $eReturn[$x][2])   ;Add the New Message ID
                ;Execute the Function or Script [after downloading]
                _ExecuteFromEmail($eReturn[$x][1])
                If @error Then Return SetError(2, @error, -1)
            EndIf
;       EndIf
    Next

EndFunc   ;==>RemoteGmail
Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites

PhoenixXL,

would you be kind enough to edit the script.  I am new to autoIT and im still struggling on this.  I just wanted to have like a list of email address that can accept and process the command aside from the monitored account.  Maybe you can make it to ver. 1.5 with the variable email address to accept.   It would be faster for you to update it than me, might take me a lot of thinking how to do that :)  I just want it to process command from username+canned.response@gmail.com 

thank you and appreciate your assistance

rike

 

Its because I made it that way, you can modify it to accept from other email address too.

Change as follows

Func RemoteGmail()
    ;Check the Main for any New Mails
    Local $eReturn = _CheckGmail($__rg__sUsername, $__rg__sPassword, 'Phoenix XL')
    Local $Emails = @extended
    If @error Then Return SetError(1, @error, -1)
    For $x = 1 To $Emails
;       If $eReturn[$x][0] = $__rg__sEmail Then
            ;Check if the Email is from the Same Address
            If Not _CompareID($eReturn[$x][2]) Then
                If IsArray($__rg__pMessage_Array) Then
                    $__rg__iCount = $__rg__pMessage_Array[0]
                Else
                    $__rg__iCount += 1
                EndIf
                If IniWrite($__rg__sIniFile, $__rg__sSectionName, $__rg__iCount, $eReturn[$x][2]) Then _
                _AddToVar($__rg__pMessage_Array, $eReturn[$x][2])   ;Add the New Message ID
                ;Execute the Function or Script [after downloading]
                _ExecuteFromEmail($eReturn[$x][1])
                If @error Then Return SetError(2, @error, -1)
            EndIf
;       EndIf
    Next

EndFunc   ;==>RemoteGmail
Edited by rikeman

Share this post


Link to post
Share on other sites

version 1.5 released.

Changes in the parameter of RemoteGmail() for additional flexibility of execution of commands from any Email-ID.

Regards :)

Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites

PhoenixXL,

thanks but were can i get the v.1.5 :) sorry i tried the link on 1st page and it still says 1.4

version 1.5 released.

Changes in the parameter of RemoteGmail() for additional flexibility of execution of commands from any Email-ID.

Regards :)

Share this post


Link to post
Share on other sites

Maybe some error in the upload, I have again uploaded, do try again.

Regards :)

Phoenix XL


My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites

Thank you PhoenixXL. Works great for my purpose.   There might be issue when running saying $f_UserEmail not declared but that is easy fix and can easilly be updated ... just an FYI.. 

Share this post


Link to post
Share on other sites

Hi,

 

I'm looking at Example1_RemoteGmail.au3 and see that you are able to run notepad.exe from withing @SystemDir and I am able to run any other exe that is located in @SystemDir

eg: SendEmail2Gmail('PXLRun:(s)calc.exe|(m)@SystemDir/PXL', '', 0, 'Execute')

What I am trying to figure out is how to launch an exe or bat that is not in the @SystemDir

eg: C:\Program Files (x86)\UltraEdit\UEDIT32.EXE
eg: C:\my.exe

I have been able to copy an exe to @SystemDir and have it work but I'm not sure of the syntax to get this to work with a custom path.

I'm using this on:

Win7X64

AutoIT=3.3.10.2
Scite=3.3.7.0

 

Simply running an exe like this does not seem to work (even if I
add dubble quotes around the path:

  eg: SendEmail2Gmail('PXLRun:(s)C:\Program Files (x86)\UltraEdit\UEDIT32.EXE /PXL', '', 0, 'Execute')

Could someone give me an example of how to craft the email for the above examples?

Share this post


Link to post
Share on other sites

Use it as follows

; Example  - RemoteGmail  |  Phoenix XL

#include <RemoteGmail.au3>
Opt('TrayIconDebug', 1)

Global $sString = 'C:\Program Files (x86)\UltraEdit\UEDIT32.EXE' ;Variable which will be evaluated

;Assign the Username and the Password
RemoteGmail_Startup("username", "password")

;Send A Email to your Email Address Using your own Email Address
SendEmail2Gmail('PXLRun:(v)sString/PXL', '', 0, 'Execute')
If @error Then Exit ConsoleWrite('Error Code:' & @error & @CR) <> 0

;Call the function once
RemoteGmail()

Using a variable type will work here. As ':' is reserved for internal use, using it in C:... will cause malfunctioning.

Regards :)

Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites

That worked...

One typeo...

Use:

Global $sString = 'C:Program Files (x86)UltraEditUEDIT32.EXE' ;Variable which will be evaluated

Instead of:

Global $sString = 'C:Program Files (x86)UltraEditUEDIT32.EXE/PXL' ;Variable which will be evaluated

Remove the extra ---> /PXL

kudos for the code and help...

Share this post


Link to post
Share on other sites

hello guys. Can you guys help me with a quick question about the gmail listner? I got this from the post on the first page of this thread. It's not working for me. I'm not getting any errors. The script is just running. I'm testing it using Example Script 1's syntax in the body of the email. 

PXLRun:(s)Notepad.exe|(m)@SystemDir/PXL

 

Here's the script listener

;For Version 1.2 only
;Check Continuously
Opt('TrayIconDebug', 1)


Global $sUsername = 'myusername' ; Your Username for Example if phoenixxl@gmail.com is your Gmail Address then phoenixxl would be your username
Global $sPassword = 'mypassword' ; Your Password for your Gmail Account
Global $iTimeOut = 12000
#include <RemoteGmail.au3>

;The Function would be executed every 12 Seconds.
;Hence all the New mails would be checked and executed every 12000 milli Seconds
AdlibRegister('RemoteGmail',$iTimeOut)

;Our Infinite Loop
While 1
Sleep(10)
WEnd 

I notice at the beginning of the script it states it's for v1.2 only. I don't know why it won't work for the current version though. 

 

Any help is appreciated. Thanks

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By pat4005
      A tiny UDF that can shoot magic packets at your computers to wake them the heck up. All credits to Olish.
      The only parameter it needs to be specified – is your machine's MAC-address (ip address (the second parameter), at which you will be sending magic packet is generating automatically from @IPAddress1 macro)
      Example:
      _WoL_WakeDevice('001CC0CAED7A') ; the second parameter (if necessery) must be a broadcast address of your local network segment (i.e. 192.168.0.255 for a network 192.168.0.0)  
      _WakeOnLan.au3
    • By diff
      Hello,
      still learning and trying to understand AutoIT but having problem in filling my PDF file.
       
      So my code looks like similar to this:
      Global $1 = "text text 44444444" Global $2 = "texting2 texting2" Global $3 = "newtext3 next3" ShellExecute ("C:\Users\XXX\Desktop\myPDF.pdf") WinWaitActive("MyPDF.pdf - Adobe Acrobat Reader DC") Send ("{TAB}") ClipPut($1) Send ("^v") Send ("{TAB 3}") ClipPut($2) Send("^v") Send ("{TAB}") ClipPut($3) Send("^v") So its fill my PDF form, the first field looks good, the code add the text text 4444, then second should be $2 with texting2 texting2 but for some reason the code uses for second and third field after TAB only variable $3.
      So, I receive in $2 and $3 for some reason same newtext3 next3 in both, why its skipping the variable $2? Maybe there also much better solution for instant text? Because Send writes with delay by letters which I don't like.
      Thanks!
    • By MrCreatoR
      This UDF allows to create formatted label using pseudo element RichLabel (RichEdit actually). Formating is set by using special modificator similar to <font> tag in Html.
      Notes: This UDF is a transformation-continuation of related UDF


      Example:
      Download:
      GUIRichLabel_1.2.zip
      Small syntax related fix: GUIRichLabel_1.1.zip
      GUIRichLabel_1.1.zip
       
      History version:
    • By Yodavish
      My AutoIt script works fine, for the most part, however, if it goes idle for roughly 30 minutes, it will won't be able to send data to a 3rd party application window titled, "Case #". 
      The problem lies within the function "SendFusion", it's able to see the handle for the "WinActivate" and "WinWaitActivate" (I've also tried putting in 10 seconds in the WinWaitActivate as well, doesn't work). However, if we have been idle, it will always fail to send data afterward. On what I've tried so far:
      "Send" function with the data and a {ENTER} i.e. Send($CaseTxt & "{ENTER}"), this won't even hit the enter key  ControlSetText, tried passing the handle from WinActivate, using the title "Case #" that was copied directly from the Autoit Window Info, hard coding the title, Using CLASS:WindowsForms10... always returns a 0 ControlCommand (same as above) always returns a 0 ControlGetFocus always returns a 0 ControlFocus, always returns a 0 Creating a new and simple Au3 script that just sends data to "Case #", also fails NOTE: If I close the Au3 script and just scan the data directly into the "Case #" or even type it, it works fine with no issues. I'm confused as to why it would not work after a long idle period?
      Below are the essential parts of the script, I can provide the entire thing if needed. Any suggestions would be greatly appreciated!
      #include <AutoItConstants.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <Process.au3> #include <Misc.au3> #include <IE.au3> ;--------------------------------------------------------------- ; Only one instance can run ;--------------------------------------------------------------- If _Singleton("gross.exe", 1) = 0 Then MsgBox($MB_SYSTEMMODAL, "Warning", "Gross.exe is already running. Please exit the existing version first (check the icons in the lower right corner of your screen) before running it again.") Exit EndIf ;--------------------------------------------------------------- ; AutoIt Options ;--------------------------------------------------------------- Opt("GUIOnEventMode", 1) ; Change to OnEvent mode Opt("WinWaitDelay", 0) ; Alters how long a script should briefly pause after a successful window-related operation. Time in milliseconds to pause (default=250). Opt("WinTextMatchMode", 1) ; Alters the method that is used to match window text during search operations. 2 = Quick mode Opt("SendKeyDelay", 0) ; Alters the length of the brief pause in between sent keystrokes. A value of 0 removes the delay completely. Time in milliseconds to pause (default=5). if ($fusionWindowTitle="NONE" or $fusionCaseNumWinTitle="NONE" or $appWindowTitle="NONE" or $winActivateTimeout="NONE" or $winCloseTimeout="NONE" or $winWaitTimeout="NONE" or $pdfViewerWidth="NONE" or $pdfViewerHeight="NONE" or $pdfViewerLeft="NONE" or $pdfViewerWindowName="NONE" or $pdfViewerExeName="NONE" or $pdfUrl="NONE" or $pdfDownloadCommand="NONE") Then Msgbox(0,"ERROR", "gross.ini is missing or does not contain all settings. Please contact Help Desk with this information") Exit -1 EndIf ;--------------------------------------------------------------- ; application settings/constants ;--------------------------------------------------------------- Global Const $[VARIABLE] = IniRead("gross.ini", "default", "[TitleOfVariable]", "NONE") Global Const $[VARIABLE] = IniRead("gross.ini", "default", "[TitleOfVariable]", "NONE") Global Const $[VARIABLE] = IniRead("gross.ini", "default", "[TitleOfVariable]", "NONE") Global Const $[VARIABLE] = IniRead("gross.ini", "default", "[TitleOfVariable]", "NONE") ;--------------------------------------------------------------- ; create the main window ;--------------------------------------------------------------- Local $mainWindow = GUICreate($appWindowTitle, 380, 190) ; create the main GUI window GUISetOnEvent($GUI_EVENT_CLOSE, "handleCloseClick") ; when the click the windows close button call handleCloseClick() WinSetOnTop($appWindowTitle, '', 1) ; Sets main GUI always on top ;--------------------------------------------------------------- ; create the controls on the main window ;--------------------------------------------------------------- Local $okButton = GUICtrlCreateButton("OK", 160, 160, 54,24) ; create OK button GUICtrlSetOnEvent($okButton, "validateInput") ; when they click ok, call handleInputProcessRequest() GUICtrlCreateLabel("Scan Input", 10, 10) ; create a label Global $inputScan = GUICtrlCreateInput("", 10,134,358) ; create the input scan box GUICtrlSetOnEvent($inputScan, "validateInput") ; when they press enter in the scan input box, call handleInputProcessRequest() GUICtrlSetState($inputScan,$GUI_FOCUS) ; automatically sets focus on the input field GUISetState(@SW_SHOW) ; main GUI loop that runs at all times ;--------------------------------------------------------------- While 1 ;---------------------------------------------------------- ; If sumatraPDF active, resets focus back to GUI ;---------------------------------------------------------- If WinActive($pdfViewerWindowName) Then consoleWrite('While Loop sumatraPDF was active' & @CRLF) setMainWindow() ;---------------------------------------------------------- ; After data sent to ProTracker, check for mismatch ; save button to trigger the event handler when clicked ;---------------------------------------------------------- ElseIf WinActive($proTrackerWindowTitle) Then $ie = _IEAttach("ProTracker") $mismatchButton = _IEGetObjByName($ie, $proTrackerMisMatchButtonId) $oEvent = ObjEvent($mismatchButton, "mismatchButton_") If @error Then setMainWindow() ;--------------------------------------------------------------------- ; If Fusion is prompting for the case #, focus back to main GUI input ; If second GUI 'Unknown' detect do nothing ;--------------------------------------------------------------------- ElseIf WinExists($fusionWindowTitle) and WinExists($fusionCaseNumWinTitle) and Not WinActive($mainWindow) and Not WinExists('Unknown Input') Then setMainWindow() EndIF ;--------------------------------------------------------------------- ; Checks if $processFlag = Done, if so, shows PDF viewer and clears ; processFlag for next iteration ;--------------------------------------------------------------------- IF WinExists($pdfViewerWindowName) and $processFlag == 'Done' Then WinSetState ($pdfViewerWindowName, '', @SW_SHOW) $processFlag = '' setMainWindow() EndIF Sleep(100) ; Sleep to reduce CPU usage WEnd Func handleInputProcessRequest($input) $processFlag = True Local $hTimer = TimerInit() consoleWrite('> handleInputProcessRequest: ' & @CRLF) Local $idInput = identifyInput($input) ; Select a proccess to run based on id input Select Case $idInput = "container" ; regex that captures only the case number $caseTxt = StringUpper(StringRegExpReplace($strippedInputData, '\??(\w*\d*-\d*|\d*).*$','$1')) If WinExists($fusionWindowTitle) and WinExists($fusionCaseNumWinTitle) Then sendProTracker(StringUpper($strippedInputData)) sendFusion($caseTxt) ; gets pdf for sumatraPDF in seperate script, since that function is the slowest Run("viewPDF.exe " & $caseTxt) ;getSumatraPDF($caseTxt) $lastCaseNum = $caseTxt Else ; Checks to make sure the previous "Container" case num is the same ; to the current Container case num, before sending to ProTracker If($lastCaseNum <> $caseTxt) Then ; If not the same case number send alert sound SoundPlay("error.wav") Else sendProTracker($strippedInputData) EndIf EndIf Case $idInput = "user" sendProTracker($strippedInputData) Case $idInput = "cassette" sendProTracker(StringUpper($strippedInputData)) Case $idInput = "unknown" selectUnknown() EndSelect Local $fDiff = TimerDiff($hTimer) $processFlag = 'Done' consoleWrite('> handleInputProcessRequest Completed Total time: ' & $fDiff & ' ' &@CRLF&@CRLF&@CRLF) EndFunc Func sendFusion($caseTxt)     Local $hTimer = TimerInit()     consoleWrite('+ sendFusion initiated: ' & $caseTxt & @CRLF)     If $caseTxt = "" Then         MsgBox(0, "Error", "Not a valid case number")     Else         ;$fusionCaseNumWinTitle = "Case #"         $retVal1 = WinActivate($fusionCaseNumWinTitle, "")         consoleWrite("ReturnValue WinActivate " & $retVal1 & @CRLF)         $retVal2 = WinWaitActive($fusionCaseNumWinTitle,"",$winActivateTimeout)         consoleWrite("ReturnValue WinWaitActive: " & $retVal2 & @CRLF)         $retVal3 = ControlSetText($fusionCaseNumWinTitle, "", "", $caseTxt)         ;$retVal3 = ControlCommand($fusionCaseNumWinTitle, "", "", "EditPaste", $caseTxt)         consoleWrite("ReturnValue ControlSetText: " & $retVal3 & @CRLF)         ;Send($caseTxt & "{ENTER}")         WinWaitClose($fusionCaseNumWinTitle, "", $winCloseTimeout)         consoleWrite('+ sendFusion WinWaitClose: ' & @CRLF)     EndIf     Local $fDiff = TimerDiff($hTimer)     ConsoleWrite('+ sendFusion Completed Total time:' & $fDiff & ' ' & @CRLF) EndFunc
      Console logs from the SciTLE
      Window (x86) Info matches the correct handle for the WinActivate and WinWaitActivate

      Window Control (x86) Info, I've tried the CLASS, the ID, also I just noticed that the "handle" in "Control" and "Window" appear to be different as well.

       
      So far the only work-around is to close down the 3rd party application and the AutoIt script, re-open them and it works all completely fine. But this is a pain for the end-user since it's all touch screen and it slows down their workflow, which they can be extremely sensitive about.
       
×
×
  • Create New...