Buklerx Posted September 8, 2011 Share Posted September 8, 2011 (edited) Hi everybody, I' d like to send an e-mail using an auto-it program and using the php script. This is my PHP code: <?php $header = "From: $email\r\nReply-to: $email\r\n"; $mymail = "MYEMAIL"; $sub = "Oggetto"; mail($mymail,$sub,"Mittente: $email\r\nText: $text",$header); ?> And I' ve done the AutoIt GUI with KODA: #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <IE.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Send Text", 250, 162, 192, 124) $Button1 = GUICtrlCreateButton("Send", 80, 128, 97, 25) $Input1 = GUICtrlCreateInput("", 48, 32, 161, 21) $Input2 = GUICtrlCreateInput("", 48, 88, 161, 21) $Label1 = GUICtrlCreateLabel("Mail", 112, 8, 23, 17) $Label2 = GUICtrlCreateLabel("Text", 104, 64, 50, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd How can I connect them? Edited September 8, 2011 by Buklerx Link to comment Share on other sites More sharing options...
KaFu Posted September 8, 2011 Share Posted September 8, 2011 (edited) This might work (without ANY error checking)... expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <IE.au3> #region ### START Koda GUI section ### Form= $Form1 = GUICreate("Send Text", 250, 162, 192, 124) $Button1 = GUICtrlCreateButton("Send", 80, 128, 97, 25) $Input1 = GUICtrlCreateInput("", 48, 32, 161, 21) $Input2 = GUICtrlCreateInput("", 48, 88, 161, 21) $Label1 = GUICtrlCreateLabel("Mail", 112, 8, 23, 17) $Label2 = GUICtrlCreateLabel("Text", 104, 64, 50, 17) GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### Global $email, $text While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 GUISetState(@SW_HIDE) ProgressOn("Email", "Sending Email...") $email = GUICtrlRead($Input1) $text = GUICtrlRead($Input2) $oIE = _IECreate("www.yourdomain.com/email_script.php?email=" & $email & "&text=" & $text, 0, 0, 1) Switch @error Case 0 ProgressOn("Email", "Email sent successfully...") Case Else ProgressOn("Email", "Email NOT sent successfully...") EndSwitch Sleep(500) ProgressOff() GUISetState(@SW_SHOW) _IEQuit($oIE) EndSwitch WEnd Maybe the php script sould return a status to check against... Edited September 8, 2011 by KaFu OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21)HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Buklerx Posted September 8, 2011 Author Share Posted September 8, 2011 Hi, thanks for the fast reply but i would like to ask you if there is a way not let the IE windows pops up... Link to comment Share on other sites More sharing options...
Tvern Posted September 8, 2011 Share Posted September 8, 2011 (edited) Something like this: (untested) email.php: <?php $header = "From: $email\r\nReply-to: $email\r\n"; $mymail = "MYEMAIL"; $sub = "Oggetto"; if (mail($mymail,$sub,"Mittente: ".$_GET['email']."\r\nText: ".$_GET['text'],$header)){ echo 1; } else{ echo 0; } ?> expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <IE.au3> #region ### START Koda GUI section ### Form= $Form1 = GUICreate("Send Text", 250, 162, 192, 124) $Button1 = GUICtrlCreateButton("Send", 80, 128, 97, 25) $Input1 = GUICtrlCreateInput("", 48, 32, 161, 21) $Input2 = GUICtrlCreateInput("", 48, 88, 161, 21) $Label1 = GUICtrlCreateLabel("Mail", 112, 8, 23, 17) $Label2 = GUICtrlCreateLabel("Text", 104, 64, 50, 17) GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### Global $email, $text While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 GUISetState(@SW_HIDE) ProgressOn("Email", "Sending Email...") $email = GUICtrlRead($Input1) $text = GUICtrlRead($Input2) If BinaryToString(InetRead("http://www.yousite.com/email.php?email=" & $email & "&text=" & $text)) Then ProgressOn("Email", "Email sent successfully...") Else ProgressOn("Email", "Email NOT sent successfully...") EndIf Sleep(500) ProgressOff() GUISetState(@SW_SHOW) EndSwitch WEnd edit: forgot to remove _IEQuit() Edited September 8, 2011 by Tvern Link to comment Share on other sites More sharing options...
Buklerx Posted September 9, 2011 Author Share Posted September 9, 2011 It works rlly nice thanks for the help! Have 2 questions: Question 1: I have $Form1 that is the GUI of the main program but I want an other form $Form2 to show the info of the program, what' s the code? I wrote something like this: Case $fileitem4 $Form2 = GUICreate("Info", 242, 74, 192, 124) $Label1 = GUICtrlCreateLabel("Program v 1.0", 67, 16, 104, 17) $Label2 = GUICtrlCreateLabel("Created by Buklerx", 64, 48, 114, 17) GUISetState(@SW_SHOW) But when i close the Info form it closes all the program. Question 2: If I put an image in a program, when I sed it to my friend they don't see it, what was the code to include the picture in the exe? Link to comment Share on other sites More sharing options...
Tvern Posted September 12, 2011 Share Posted September 12, 2011 Q1: You can set GuiGetmsg() to advanced. That way you can check what GUI window send the $GUI_EVENT_CLOSE message. See the helpfile for details. You could also disable the standard x button on the info GUI and add a close button. Experiment with window styles to find a style that you like. Q2 The easiest way to include an image is to fileinstall the image to the temp folder. It is possible to use images directly when included in the exe, but it get's a little more tricky. If you want to do so, I believe the recource UDF you can find in the examples forum has some usefull functions. 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