CoolBreeze Posted February 16, 2010 Posted February 16, 2010 1st of all I would like to say hi to everyone herem very good program you got here , happy to be part of the community now.. i'm trying to write a program that has an input box, and an edit box. The reason i'm doing this is becouse i want the users of my program to be able to register. Now, i got a HTML page that looks like: <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Registration</title> </head> <body> <div style="text-align: center;"> <form method="POST" action="http://thisismysite/registration.php"> <input type="text" name="subject" size="19"><br> <br> <textarea rows="9" name="message" cols="30"></textarea> <br> <br> <input type="submit" value="Submit" name="submit"> </form> </div> </body> </html> now this html sends data to my PHP: <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Registration</title> </head> <body> <?php if(isset($_POST['submit'])) { $to = "mymail@site.com"; $subject = $_POST['subject']; $message = $_POST['message']; $body = "$name_field\n $message"; echo "Data has been submitted to $to!"; mail($to, $subject, $body); } else { echo "Error!"; } ?> </body> </html> thats on my site server and it send me registration information to my e-mail, and all that works perfectly well. BUT (theres always a but), i was wondering if i can make a GUI that will do the same thing as the HTLM, but without it loging on any server or loading any html. so basicly i need a GUI that will send the data inserted in the boxes like the html to the PHP.Ive done something but dont know how to make it work like a HTML: #include <GUIConstants.au3> #include <INet.au3> $GUI = GUICreate("Email Sender", 400, 279, -1, -1) GUISetBkColor(0xFFFFFF) $Subject = GUICtrlCreateInput("", 88, 32, 233, 21) $Message = GUICtrlCreateEdit("", 88, 64, 233, 145) $SEND_button = GUICtrlCreateButton("SEND", 176, 224, 73, 25, 0) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Subject ;i want this variable to link to the PHP variable with the same name. Case $Message ;i want this variable to link to the PHP variable with the same name Case $SEND_button ;this is my send button that does the works :) EndSwitch WEnd Thank you all in advance for all your help.
lordicast Posted February 16, 2010 Posted February 16, 2010 Check Helpfile for the rest. Its Pretty useful expandcollapse popup#include <GUIConstants.au3> #include <INet.au3> $GUI = GUICreate("Email Sender", 400, 279, -1, -1) GUISetBkColor(0xFFFFFF) $Subject = GUICtrlCreateInput("", 88, 32, 233, 21) $Message = GUICtrlCreateEdit("", 88, 64, 233, 145) $SEND_button = GUICtrlCreateButton("SEND", 176, 224, 73, 25, 0) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $SEND_button Sendit() EndSwitch WEnd Func Sendit() $Subject1 = GUICtrlRead($Subject) ;- Key is GuiCtrlRead Use F1 for Quick Help $Message1 = GUICtrlRead($Message) $s_SmtpServer = "mysmtpserver.com.au" ;-From Help $s_FromName = "My Name" $s_FromAddress = "From eMail Address" $s_ToAddress = "To eMail Address" $Response = _INetSmtpMail($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $Subject1, $Message1) $err = @error If $Response = 1 Then MsgBox(0, "Success!", "Mail sent") Else MsgBox(0, "Error!", "Mail failed with error code " & $err) EndIf EndFunc ;==>Sendit [Cheeky]Comment[/Cheeky]
weaponx Posted February 16, 2010 Posted February 16, 2010 (edited) I'm not sure how mail became a factor... You need to use the winhttprequest COM object. Example: http://www.autoitscript.com/forum/index.php?showtopic=74557&view=findpost&p=542401 Edited February 16, 2010 by weaponx
lordicast Posted February 16, 2010 Posted February 16, 2010 I'm not sure how mail became a factor...You need to use the winhttprequest COM object.Example:http://www.autoitscript.com/forum/index.php?showtopic=74557&view=findpost&p=542401Gui name was Email Sender so I figured it was going that direction... [Cheeky]Comment[/Cheeky]
CoolBreeze Posted February 16, 2010 Author Posted February 16, 2010 tnx aloth for the help, but i dont need it to go throu SMTP, i literaly need to make a GUI that will act like that HTLM
CoolBreeze Posted February 17, 2010 Author Posted February 17, 2010 i'm trying to explain what i want in this example. the "global variables" need to go from the script directly to the PHP. sorry for the confusion, but i dont know how to exactly explain what i want in english tnx again expandcollapse popup============================== php <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Registration</title> </head> <body> <?php if(isset($_POST['submit'])) { $to = "mymail@site.com"; $subject = $_POST['subject']; $message = $_POST['message']; $body = "$name_field\n $message"; ?> </body> </html> ======================================== Global variables: subject --- php message --- php submit --- php html form -- <form method="POST" action="http://thisismysite/registration.php"> <input type="text" name="subject" size="19"><br> <br> <textarea rows="9" name="message" cols="30"></textarea> <br> <br> <input type="submit" value="Submit" name="submit"> </form> ============================== au.3 #include <GUIConstants.au3> $GUI = GUICreate("Email Sender", 400, 279, -1, -1) GUISetBkColor(0xFFFFFF) $Subject = GUICtrlCreateInput("", 88, 32, 233, 21) $Message = GUICtrlCreateEdit("", 88, 64, 233, 145) $SEND_button = GUICtrlCreateButton("SEND", 176, 224, 73, 25, 0) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Subject ; link to this var < subject --- php > Case $Message ; link to this var < message --- php > Case $SEND_button send --> action = "http://thisismysite/registration.php" ; link to this var < submit --- php > EndSwitch WEnd ========================================
kaotkbliss Posted February 17, 2010 Posted February 17, 2010 (edited) maybe check into tcp/ip functions in autoit. that might be the dirrection you want to go. **edit** it's under network management in the help file Edited February 17, 2010 by kaotkbliss 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy!
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