Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/19/2022 in all areas

  1. Mihai1234, We do not accept behaviour like that - take a week off to decide whether you wish to remain a member of this community. If you do, then when you return you need to do 2 things: Stop posting silly examples. Stop insulting long-term members. Your choice - please choose wisely. Thread locked. M23
    2 points
  2. @mLipok here is a small example demonstrating retrieving an email using either pop3,pop3s,imap,imaps. Ill work on smtp,smtps next ; #FUNCTION# ==================================================================================================================== ; Name ..........: Example_Email_Fetch ; Description ...: Fetch message 1 from inbox ; Parameters ....: $sServer - server address. ex: imap.comcast.net ; $sUser - username/email address ; $sPass - password ; $sProt - protocol. imap,imaps,pop3,pop3s ; =============================================================================================================================== Func Example_Email_Fetch($sServer, $sUser, $sPass, $sProt = 'imaps') Local $Curl = Curl_Easy_Init() If Not $Curl Then Return Local $emsg = $Curl ;Set username and password Curl_Easy_Setopt($Curl, $CURLOPT_USERNAME, $sUser) ; Curl_Easy_Setopt($Curl, $CURLOPT_PASSWORD, $sPass) ; ;This will fetch message 1 (oldest message) from the user's inbox Switch $sProt Case 'imaps' Curl_Easy_Setopt($Curl, $CURLOPT_URL, "imaps://" & $sServer & "/INBOX/;UID=1") ; Case 'imap' Curl_Easy_Setopt($Curl, $CURLOPT_URL, "imap://" & $sServer & "/INBOX/;UID=1") ; Curl_Easy_Setopt($Curl, $CURLOPT_USE_SSL, $CURLUSESSL_ALL) ; Case 'pop3s' Curl_Easy_Setopt($Curl, $CURLOPT_URL, "pop3s://" & $sServer & "/1") ; Case 'pop3' Curl_Easy_Setopt($Curl, $CURLOPT_URL, "pop3://" & $sServer & "/1") ; Curl_Easy_Setopt($Curl, $CURLOPT_USE_SSL, $CURLUSESSL_ALL) ; Case Else Return ConsoleWrite('Invalid Protocol' & @CRLF) EndSwitch ;Set ca bundle for peer verification Curl_Easy_Setopt($Curl, $CURLOPT_CAINFO, @ScriptDir & '\curl-ca-bundle.crt') ; ;Set Callback to recive msg Curl_Easy_Setopt($Curl, $CURLOPT_WRITEFUNCTION, Curl_DataWriteCallback()) Curl_Easy_Setopt($Curl, $CURLOPT_WRITEDATA, $emsg) ;show extra connection info Curl_Easy_Setopt($Curl, $CURLOPT_VERBOSE, 1) ; ;Perform the fetch $Code = Curl_Easy_Perform($Curl) ; If $Code = $CURLE_OK Then ConsoleWrite('email msg:' & @CRLF & BinaryToString(Curl_Data_Get($emsg))) Else ConsoleWrite(Curl_Easy_StrError($Code) & @LF) EndIf ;cleanup Curl_Easy_Cleanup($Curl) Curl_Data_Cleanup($emsg) Return $Code ; EndFunc ;==>Example_Email_Fetch
    2 points
  3. Nice! I just got a custom request working asking for total count of messages in the inbox which falls inline with what we need to do for the EXAMINE command they talk about. I found this link too with a bunch other custom requests that can be used. All the -X ones. https://gist.github.com/akpoff/53ac391037ae2f2d376214eac4a23634 Func Example_Email_Count($sServer, $sUser, $sPass) Local $Curl = Curl_Easy_Init() If Not $Curl Then Return Local $emsg = $Curl ;set options Curl_Easy_Setopt($Curl, $CURLOPT_USERNAME, $sUser) ; Curl_Easy_Setopt($Curl, $CURLOPT_PASSWORD, $sPass) ; Curl_Easy_Setopt($Curl, $CURLOPT_CAINFO, @ScriptDir & '\curl-ca-bundle.crt') ; Curl_Easy_Setopt($Curl, $CURLOPT_WRITEFUNCTION, Curl_DataWriteCallback()) Curl_Easy_Setopt($Curl, $CURLOPT_WRITEDATA, $emsg) ;Curl_Easy_Setopt($Curl, $CURLOPT_VERBOSE, 1) ; ;Request count of messeges in inbox Curl_Easy_Setopt($Curl, $CURLOPT_CUSTOMREQUEST, "STATUS INBOX (MESSAGES)") ; Curl_Easy_Setopt($Curl, $CURLOPT_URL, "imaps://" & $sServer) ; $Code = Curl_Easy_Perform($Curl) ; If $Code = $CURLE_OK Then ConsoleWrite('email count ' & @CRLF & BinaryToString(Curl_Data_Get($emsg)) & @CRLF & '----****------' & @CRLF) Else ConsoleWrite(Curl_Easy_StrError($Code) & @LF) EndIf Curl_Data_Cleanup($emsg) Curl_Easy_Cleanup($Curl) EndFunc ;==>Example_Email_Count Output: email count: * STATUS INBOX (MESSAGES 61)
    1 point
  4. I was able to get a minimal example going for sending an email via smtp/smtps but it does not save to the sent box. Is that how this is actually implemented? Some kind of combination of using both smtp and imap/pop3? I never thought about what actually makes that happen with the sent messages. I'm mainly working of the examples here https://curl.se/libcurl/c/example.html if anyone else wants to tinker with whatever options exist for the protocols. ; #FUNCTION# ==================================================================================================================== ; Name ..........: Example_Email_Send ; Description ...: Send a Email ; Parameters ....: $sServer - server address. ex: smtp.comcast.net ; $sUser - username/email address ; $sPass - password ; $sTo - recepient address ; $sFrom - sender address ; $sSubject - email subject ; $sBody - email body ; $sProt - protocol. smtp/smtps ; =============================================================================================================================== Func Example_Email_Send($sServer, $sUser, $sPass, $sTo, $sFrom, $sSubject, $sBody, $sProt = 'smtp') ;Build email Local $sHeaders = "To: <" & $sTo & ">" & @CRLF $sHeaders &= "From: <" & $sFrom & ">" & @CRLF ;~ $sHeaders &= "CC: <" & $sCC & ">" & @CRLF ;~ $sHeaders &= "BCC: <" & $sBCC & ">" & @CRLF $sHeaders &= "Subject: " & $sSubject & @CRLF Local $sEmail = $sHeaders & @CRLF & $sBody Local $Curl = Curl_Easy_Init() If Not $Curl Then Return ;Set username and password Curl_Easy_Setopt($Curl, $CURLOPT_USERNAME, $sUser) ; Curl_Easy_Setopt($Curl, $CURLOPT_PASSWORD, $sPass) ; ;set server address and protocol If $sProt = "smtp" Then Curl_Easy_Setopt($Curl, $CURLOPT_URL, "smtp://" & $sServer & ":587") ; Curl_Easy_Setopt($Curl, $CURLOPT_USE_SSL, $CURLUSESSL_ALL) ; ElseIf $sProt = "smtps" Then Curl_Easy_Setopt($Curl, $CURLOPT_URL, "smtps://" & $sServer) ; Else Return ConsoleWrite("invalid protocol" & @CRLF) EndIf ;Set ca bundle for peer verification Curl_Easy_Setopt($Curl, $CURLOPT_CAINFO, @ScriptDir & '\curl-ca-bundle.crt') ; ;build and set recipient list Local $recipients = Curl_Slist_Append(0, $sTo) ; ;$recipients = Curl_Slist_Append($recipients, $sCC); ;$recipients = Curl_Slist_Append($recipients, $sBCC); Curl_Easy_Setopt($Curl, $CURLOPT_MAIL_RCPT, $recipients) ; ;set from address Curl_Easy_Setopt($Curl, $CURLOPT_MAIL_FROM, $sFrom) ; ;Set email data and callback Curl_Data_Put($Curl, $sEmail) Curl_Easy_Setopt($Curl, $CURLOPT_UPLOAD, 1) Curl_Easy_Setopt($Curl, $CURLOPT_READFUNCTION, Curl_DataReadCallback()) Curl_Easy_Setopt($Curl, $CURLOPT_READDATA, $Curl) ;show extra connection info Curl_Easy_Setopt($Curl, $CURLOPT_VERBOSE, 1) ; ;Send email Local $Code = Curl_Easy_Perform($Curl) If $Code = $CURLE_OK Then ConsoleWrite('Email Sent!' & @CRLF) Else ConsoleWrite(Curl_Easy_StrError($Code) & @LF) EndIf ;cleanup Curl_Slist_Free_All($recipients) ; Curl_Easy_Cleanup($Curl) ; EndFunc ;==>Example_Email_Send
    1 point
  5. jugador

    Send virtual key codes

    first sets input focus to a given control on a window using ControlFocus then try your virtual key combination
    1 point
  6. jugador

    Send virtual key codes

    virtual key combination (Left CONTROL key + A) DllCall('user32.dll', 'int', 'keybd_event', 'int', 0xA2, 'int', 0, 'int', 0, 'ptr', 0) ;~ Left CONTROL key DllCall('user32.dll', 'int', 'keybd_event', 'int', 0x41, 'int', 0, 'int', 0, 'ptr', 0) ;~ A DllCall('user32.dll', 'int', 'keybd_event', 'int', 0x41, 'int', 0, 'int', 2, 'ptr', 0) DllCall('user32.dll', 'int', 'keybd_event', 'int', 0xA2, 'int', 0, 'int', 2, 'ptr', 0)
    1 point
  7. [OT] Perhaps, because he wants to break the record of 50 posts in one day .
    1 point
  8. Jonatas

    Send virtual key codes

    About _SendMessage, I found this perfect example of Oasis375 #include <SendMessage.au3> #include <WindowsConstants.au3> Run("notepad.exe") $hWnd = WinWait("[CLASS:Notepad]", "", 10) $hControl = ControlGetHandle($hWnd, "", "Edit1") $text = "this is a line" $struct_string = DllStructCreate("char[" & StringLen($text) + 1 & "]") DllStructSetData($struct_string, 1, $text) _SendMessageA($hControl, $WM_SETTEXT, 0, DllStructGetPtr($struct_string))
    1 point
  9. LarsJ

    Rubik's Cube

    The picture shows Rubik's Cube in the middle of a rotation, wherein the layer is rotated 90 degrees. New version for AutoIt 3.3.10 The scripts were flawed. Fixed in this update. 08-01-2013: First post In the Cubes menu there are six cubes from 2*2*2 to 7*7*7: Pocket Cube, Rubik's Cube, Rubik's Revenge, Professor's Cube, V-Cube 6 and V-Cube 7. See http://en.wikipedia.org/wiki/Rubik's_Cube. The Scramble menu scrambles the cube. In the input field in the statusbar you can set the number of scramble steps. The Solve menu automatically solves the cube. In this version it just plays back the undo log. The Build menu shows how the cubes are created. It also shows how the rotation of a layer is simulated. The Scramble, Solve and Build menus puts the program into a Scramble, Solve and Build mode. To leave the Scramble and Solve modes click the menu once more. To leave the Build mode uncheck the menu. The program mode or state appears in the statusbar. See the Help menu for more information about the menus. Rotating a layer in the cube Click an edge of the layer with the left mouse button and hold the button downMove the mouse in the direction you want to rotate the layerRelease the left mouse buttonThe rotating layer in the picture has probably been clicked somewhere on the blue edge. You can't rotate a layer in Scramble, Solve and Build modes. The mouse buttons can be switched in the Options. Rotating the entire cube Click in the window with the right mouse button and hold the button downMove the mouse in the direction you want the cube to rotateRelease the right mouse buttonThe description of the mouse rotations can be found in the Help menu. Using the keyboard Use the arrow keys or <A,a>, <W,w>, <S,s>, <Z,z> to rotate the cube. Use <Home> or <H,h> to place the cube in the start position. Use <Page Up> or <I,i> and <Page Down> or <O,o> to zoom in and out. Use Num 1-6 or 1-6 to show the 6 sides of the cube. The program Inspiration for the program is from this site: http://rubiksim.sourceforge.net/. The graphics is generated with old style OpenGL 1.1. Some OpenGL globals and functions are copied from this thread http://www.autoitscript.com/forum/index.php?showtopic=83581 by trancexx. Especially globals and functions for creating an OpenGL window and a rendering context. Zipfile The zipfile contains a number of files: RubiksCube.au3 - GUI and main loop, run this fileMenuFncs.au3 - implements the menu systemMenuWins.au3 - creates menu system windowsKeyboard.au3 - code for shortcut keysOGLconsts.au3 - OpenGL constantsOGLfuncs.au3 - OpenGL functionsCubes.au3 - creates the cubesTurnLayer.au3 - rotate a layerRotateCube.au3 - rotate the cubeScramble.au3 - scramble functionSolveCube.au3 - solve functionsBuild.au3 - build functionsUtilities.au3 - calculations(The files are edited with Notepad++ with a tabwidth of 2. This doesn't match the default settings in Scite.) 21-01-2013: Update #1 Fixed some errors in the Build menu. Added a log to see the colors of all sides at one time. See picture in post #5. RubiksCube3.3.10.7z Testet on XP 32 bit and Win 7 32/64 bit. Previous versions for AutoIt 3.3.8
    1 point
  10. Melba23

    Send virtual key codes

    socap, Just wrap those 2 lines in a function: _Send_Virtual_Key(0x41) Func _Send_Virtual_Key($iCode) If Not IsInt($iCode) Then Return DllCall('user32.dll', 'int', 'keybd_event', 'int', $iCode, 'int', 0, 'int', 0, 'ptr', 0) DllCall('user32.dll', 'int', 'keybd_event', 'int', $iCode, 'int', 0, 'int', 2, 'ptr', 0) EndFunc How much more convenient would you like it to be? M23
    1 point
  11. Yashied

    Send virtual key codes

    Sends 0x41 ("A") key. DllCall('user32.dll', 'int', 'keybd_event', 'int', 0x41, 'int', 0, 'int', 0, 'ptr', 0) DllCall('user32.dll', 'int', 'keybd_event', 'int', 0x41, 'int', 0, 'int', 2, 'ptr', 0)
    1 point
  12. https://stackoverflow.com/a/37163120/5314940 UID is the unique identification number of a email in a IMAP folder. Each mail in a folder is assigned a uid, it is you can say a index maintained by the mail folder. Whereas message-id is a header part of a email. To understand in a simple term, UID is a unique number which cannot be duplicated within a folder
    0 points
×
×
  • Create New...