kisstom Posted July 30, 2015 Share Posted July 30, 2015 Hi,I would like to make a program to check unreaded gmail messages. I find examples work on xp but nothing wich works on win-7-8. Link to comment Share on other sites More sharing options...
water Posted July 30, 2015 Share Posted July 30, 2015 Can you post or link to the example code that runs on XP? I remember that this subject has been discussed on the forum a few times before. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
kisstom Posted July 30, 2015 Author Share Posted July 30, 2015 Here it is:#include <Array.au3> #include <String.au3> $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") ;create a http request object $oHTTP.Open("GET", "https://gmail.google.com/gmail/feed/atom", False) ;get data from the feed $oHTTP.SetCredentials($Username, $Password, 0) ;set the credentials $oHTTP.Send() ;send the data $Response = $oHTTP.ResponseText ;get the responseHere is another method also not works for me:#include <INet.au3> $Response = _INetGetSource("https://" & $Username & ":" & $Password & "@" & "gmail.google.com/gmail/feed/atom")i find a page where says : use 'Msxml2.XMLHTTP.6.0' instead of 'winhttp.winhttprequest.5.1'but not works for me... Link to comment Share on other sites More sharing options...
jvds Posted July 30, 2015 Share Posted July 30, 2015 The gmail script I use to check my email is the one i found in the topic below, its the post number 6 Link to comment Share on other sites More sharing options...
kisstom Posted July 31, 2015 Author Share Posted July 31, 2015 Yeah, 3rd method but not working neither on XP and Win7"error getting URL source", error 404expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Compression=4 #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #AutoIt3Wrapper_Run_Obfuscator=y #Obfuscator_Parameters=/so #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <string.au3> Global $eReturn = _CheckMail("USER@gmail.com", "PASSWORD") Global $Emails = @extended Switch @error Case 0 Switch @extended Case True ConsoleWrite(" 0>"&$eReturn[0][0] & @CR) ConsoleWrite(" "& $Emails & " " & $eReturn[0][1] & @CR) For $x = 1 To $Emails ConsoleWrite("!>Title - " & $eReturn[$x][0] & @CR) ConsoleWrite("+>Name - " & $eReturn[$x][1] & @CR) ConsoleWrite("->Email - " & $eReturn[$x][2] & @CR) ConsoleWrite(">summary - " & $eReturn[$x][3] & @CR & @CR) Next Case Else MsgBox(64,"success!","Success! But you have no new emails :(") EndSwitch Case 1 MsgBox(0,"Error!","Couldn't get your new emails for some reason...") Case 2,3 MsgBox(0,"Error!","you need to enter an user name and password!") Case 4 MsgBox(16,"Error!","Error Getting URL Source!") Case 5 MsgBox(16,"Error!","No response?") Case 6 MsgBox(16,"Error!","Unauthorized access, possibly a wrong username or password!") EndSwitch ; #FUNCTION# ==================================================================================================================== ; Name ..........: _CheckMail ; Description ...: Checks a Google Email for new emails. ; Syntax ........: _CheckMail($UserName, $Pswd[, $UserAgentString = ""]) ; Parameters ....: $UserName - An unknown value. ; $Pswd - An unknown value. ; $UserAgentString - [optional] An unknown value. Default is "". ; Return values .: A 2d array with email information as follows~ ; 1|Title ; 2|Name ; 3|Email ; 4|Summary ; 5|Date ; 6|Time ; ; Author ........: dantay9 ; Modified ......: THAT1ANONYMOUSDUDE ; Remarks .......: ; Related .......: ; Link ..........: http://www.autoitscript.com/forum/topic/111853-gmail-email-checker/page__view__findpost__p__819409 ; Example .......: Yes ; =============================================================================================================================== Func _CheckMail($UserName, $Pswd, $UserAgentString = "") If Not $UserName Then Return SetError(2,0,0) If Not $Pswd Then Return SetError(3,0,0) If $UserAgentString Then HttpSetUserAgent($UserAgentString) Local $source = InetRead("https://" & $UserName & ":" & $Pswd & "@gmail.google.com/gmail/feed/atom",1) If @error Then ConsoleWrite("!>Error Getting URL Source!" & @CR & " 404>@Error =" & @error & @CR & " 404>@Extended =" & @extended & @CR) Return SetError(4,0,0) EndIf If $source Then $source = BinaryToString($source) Else Return SetError(5,0,0) EndIf If StringLeft(StringStripWS($source, 8), 46) == "<HTML><HEAD><TITLE>Unauthorized</TITLE></HEAD>" Then Return SetError(6, 0, 0) If Not Number(StringBetween($source, "<fullcount>", "</fullcount>")) Then Return SetError(0,0,0) Local $Email = _StringBetween($source, "<entry>", "</entry>") If @error Then Return SetError(1, 0, 0) Local $Time Local $Count = UBound($Email) Local $Datum[$Count + 1][6] $Datum[0][0] = StringBetween($source, "<title>", "</title>") $Datum[0][1] = StringBetween($source, "<tagline>", "</tagline>") For $i = 0 To $Count - 1 $Datum[$i+1][0] = StringBetween($Email[$i], "<title>", "</title>") If Not $Datum[$i+1][0] Then $Datum[$i][0] = "(no subject)" $Datum[$i+1][1] = StringBetween($Email[$i], "<name>", "</name>") $Datum[$i+1][2] = StringBetween($Email[$i], "<email>", "</email>") $Datum[$i+1][3] = StringBetween($Email[$i], "<summary>", "</summary>") $Time = StringBetween($Email[$i], "<issued>", "</issued>") $Datum[$i+1][4] = DateFromTimeDate($Time) $Datum[$i+1][5] = TimeFromTimeDate($Time) Next Return SetError(0,$Count,$Datum) EndFunc Func StringBetween($Str, $S, $E) Local $B = _StringBetween($Str, $S, $E) If @error Then Return SetError(1,0,0) Return SetError(0,0,$B[0]) EndFunc ;==>StringBetween ; #FUNCTION# ==================================================================================================================== ; Name ..........: DateFromTimeDate ; Description ...: Returns email sent date. ; Syntax ........: DateFromTimeDate($String) ; Parameters ....: $String - A gmail date string ; Return values .: None ; Author ........: ??? ; Example .......: No ; =============================================================================================================================== Func DateFromTimeDate($String) Local $RegEx = StringRegExp($String, "(?<Year>d{2}|d{4})(?:-)(?<Month>d{1,2})(?:-)(?<Day>d{1,2})", 1) If IsArray($RegEx) Then Return Int($RegEx[0]) & "/" & Int($RegEx[1]) & "/" & Int($RegEx[2]) Else Return SetError(1, 0, 0) EndIf EndFunc ;==>DateFromTimeDate ; #FUNCTION# ==================================================================================================================== ; Name ..........: TimeFromTimeDate ; Description ...: Returns the email sent time. ; Syntax ........: TimeFromTimeDate($String) ; Parameters ....: $String - An unknown value. ; Return values .: None ; Author ........: ??? ; Example .......: No ; =============================================================================================================================== Func TimeFromTimeDate($String) Local $RegEx = StringRegExp($String, "(?<Hour>d{1,2})(?::)(?<Minute>d{1,2})(?::)(?<Second>d{1,2})", 1) If IsArray($RegEx) Then Return (Int($RegEx[0]) - 4) & ":" & Int($RegEx[1]) & ":" & Int($RegEx[2]) ;don't know why I have to subtract 4 Else Return SetError(1, 0, 0) EndIf EndFunc ;==>TimeFromTimeDate Link to comment Share on other sites More sharing options...
kisstom Posted August 4, 2015 Author Share Posted August 4, 2015 So there is no solution...I'm so sad, this is the first i can't solve something with autoit Link to comment Share on other sites More sharing options...
jvds Posted August 5, 2015 Share Posted August 5, 2015 it works, your problem is hereGlobal $eReturn = _CheckMail("USER@gmail.com", "PASSWORD")if your gmail account is for example kisstom@gmail.com then use kisstom as the user not the complete email address Link to comment Share on other sites More sharing options...
kisstom Posted August 5, 2015 Author Share Posted August 5, 2015 Did you tested? Not works for me (i tested before). Link to comment Share on other sites More sharing options...
jvds Posted August 6, 2015 Share Posted August 6, 2015 yes it works you sure it does not work? do you get same error again? what version of internet explorer do you have?did you understand my previous post? I have this UDF script running all day and checking my gmail every30 mins, and then an alarm get triggered when i receive a email with a specific subject lineGlobal $eReturn = _CheckMail("USER", "PASSWORD") ;correctGlobal $eReturn = _CheckMail("USER@gmail.com", "PASSWORD") ;wrong Link to comment Share on other sites More sharing options...
kisstom Posted August 6, 2015 Author Share Posted August 6, 2015 Yes, i understand what you wrote But i got error messages. Now i figoured out i have to enabe 'Allow less secure apps' in my google account. Now it's working.Thank you for your help Link to comment Share on other sites More sharing options...
kisstom Posted August 6, 2015 Author Share Posted August 6, 2015 Now i getting problem if password contains special characters '@', '&'I remember something %40 but i don't know how to do it... Link to comment Share on other sites More sharing options...
guinness Posted August 6, 2015 Share Posted August 6, 2015 Search HTML entity escaping in the Forum UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
kisstom Posted August 6, 2015 Author Share Posted August 6, 2015 I did but not find any answer (maybe i'm lame ) Link to comment Share on other sites More sharing options...
guinness Posted August 6, 2015 Share Posted August 6, 2015 Search in this UDF >> https://www.autoitscript.com/forum/topic/84133-winhttp-functions/ for encoding UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
kisstom Posted August 6, 2015 Author Share Posted August 6, 2015 I find it but not working. For example the password is 'tom@' then i get 'tom%40' (as i remember) but i can't login. Link to comment Share on other sites More sharing options...
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