Jump to content

InputBox (please help)


Recommended Posts

Hi everybody,

I need a help from you!  :(

If I have a script, for example registration questionnare:

  I need to know:

    ¤ How to make more than 1 InputBox in one window, I wrote InputBox("Registration", "Enter your username:") and I need password

        and some more things too.

    ¤ How to send the data from the boxes to my email or something EASILY.

Thanks for help,

MilanSpinka  :)

Edited by MilanSpinka
Link to comment
Share on other sites

Welcome to the Forums !

  Along with Unc3nZureD suggestion and a quick stop at Koda for the GUI here is the easiest way I know to do what you have asked.

The email server info and addresses must be updated for this to work... Have Fun !

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Inet.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 362, 269, 192, 124)
$Input1 = GUICtrlCreateInput("Input1", 48, 24, 161, 21)
$Input2 = GUICtrlCreateInput("Input2", 48, 56, 161, 21)
$UserName = GUICtrlCreateLabel("UserName", 224, 24, 70, 17)
$Password = GUICtrlCreateLabel("PassWord", 224, 56, 53, 17)
$Send = GUICtrlCreateButton("Send", 128, 104, 97, 33)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Send
            _sendEmail()
    EndSwitch
WEnd



Func _sendEmail()

    Local $s_SmtpServer = "smtp.something.com"
    Local $s_FromName = "You"
    Local $s_FromAddress = "email@address.com"
    Local $s_ToAddress = "mail@address.com"
    Local $s_Subject = "Your Subject"
    Local $as_Body[2]
    $as_Body[0] = GUICtrlRead($Input1)
    $as_Body[1] = GUICtrlRead($Input2)
    Local $Response = _INetSmtpMail($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
    Local $err = @error
    If $Response = 1 Then
        MsgBox(0, "Success!", "Mail sent to: " & $s_ToAddress, 2)
    Else
        MsgBox(0, "Error!", "Mail failed with error code " & $err)
    EndIf

EndFunc   ;==>_sendEmail

Bill

Link to comment
Share on other sites

Welcome to the Forums !

  Along with Unc3nZureD suggestion and a quick stop at Koda for the GUI here is the easiest way I know to do what you have asked.

The email server info and addresses must be updated for this to work... Have Fun !

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Inet.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 362, 269, 192, 124)
$Input1 = GUICtrlCreateInput("Input1", 48, 24, 161, 21)
$Input2 = GUICtrlCreateInput("Input2", 48, 56, 161, 21)
$UserName = GUICtrlCreateLabel("UserName", 224, 24, 70, 17)
$Password = GUICtrlCreateLabel("PassWord", 224, 56, 53, 17)
$Send = GUICtrlCreateButton("Send", 128, 104, 97, 33)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Send
            _sendEmail()
    EndSwitch
WEnd



Func _sendEmail()

    Local $s_SmtpServer = "smtp.something.com"
    Local $s_FromName = "You"
    Local $s_FromAddress = "email@address.com"
    Local $s_ToAddress = "mail@address.com"
    Local $s_Subject = "Your Subject"
    Local $as_Body[2]
    $as_Body[0] = GUICtrlRead($Input1)
    $as_Body[1] = GUICtrlRead($Input2)
    Local $Response = _INetSmtpMail($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
    Local $err = @error
    If $Response = 1 Then
        MsgBox(0, "Success!", "Mail sent to: " & $s_ToAddress, 2)
    Else
        MsgBox(0, "Error!", "Mail failed with error code " & $err)
    EndIf

EndFunc   ;==>_sendEmail

Bill

Thanks, I added some Inputs, $Input5 "Email Adress", then I wrote "Local $s_FromAddress = GUICtrlRead($Input5)" but I don't know what should I put in "Local $s_SmtpServer = "" ".....

Link to comment
Share on other sites

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Inet.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 362, 269, 192, 124)
$Input1 = GUICtrlCreateInput("Enter your username", 48, 24, 161, 21)
$Input2 = GUICtrlCreateInput("Enter your password", 48, 56, 161, 21)
$Input3 = GUICtrlCreateInput("Enter value of crystals now", 48, 88, 161, 21)
$Input4 = GUICtrlCreateInput("Enter value of crystals then", 48, 120, 161, 21)
$Input5 = GUICtrlCreateInput("Enter your GOOGLE email adress", 48, 152, 161, 21)
$UserName = GUICtrlCreateLabel("UserName", 224, 24, 53, 17)
$Password = GUICtrlCreateLabel("PassWord", 224, 56, 53, 17)
$CurrentValue = GUICtrlCreateLabel("Current value", 224, 88, 53, 17)
$NewValue = GUICtrlCreateLabel("New value", 224, 120, 53, 17)
$GmailAdress = GUICtrlCreateLabel("Email adress", 224, 152, 53, 17)
$Send = GUICtrlCreateButton("Send", 128, 185, 97, 33)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Send
            _sendEmail()
    EndSwitch
WEnd



Func _sendEmail()

    Local $s_SmtpServer = "smtp.gmail.com"
    Local $s_FromName = "Change Value"
    Local $s_FromAddress = GUICtrlRead($Input5)
    Local $s_ToAddress = "imilan@spinka.cz"
    Local $s_Subject = "Change Value"
    Local $as_Body[4]
    $as_Body[0] = GUICtrlRead($Input1)
    $as_Body[1] = GUICtrlRead($Input2)
    $as_Body[2] = GUICtrlRead($Input3)
    $as_Body[3] = GUICtrlRead($Input4)
    Local $Response = _INetSmtpMail($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
    Local $err = @error
    If $Response = 1 Then
        MsgBox(0, "Success!", "Succesfully changed value. May take several hours, don't play now!")
    Else
        MsgBox(0, "Error!", "Error :(")
    EndIf

EndFunc   ;==>_sendEmail

Help me, I tried to enter google smtp server and wrote into $Input5 "Enter GOOGLE mail adress"... :( Still says error when I'm testing...

Link to comment
Share on other sites

Please help me :) I need to send a mail from input fields like this, but I don't know what to put in "Local $s_SmtpServer = "" "... I put in smtp.google.com and wrote "$Input5 = GUICtrlCreateInput("Enter your GOOGLE email adress", 48, 152, 161, 21)" but when I'm testing, it still says error... :(

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Inet.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 362, 269, 192, 124)
$Input1 = GUICtrlCreateInput("Enter your username", 48, 24, 161, 21)
$Input2 = GUICtrlCreateInput("Enter your password", 48, 56, 161, 21)
$Input3 = GUICtrlCreateInput("Enter value of crystals now", 48, 88, 161, 21)
$Input4 = GUICtrlCreateInput("Enter value of crystals then", 48, 120, 161, 21)
$Input5 = GUICtrlCreateInput("Enter your GOOGLE email adress", 48, 152, 161, 21)
$UserName = GUICtrlCreateLabel("UserName", 224, 24, 53, 17)
$Password = GUICtrlCreateLabel("PassWord", 224, 56, 53, 17)
$CurrentValue = GUICtrlCreateLabel("Current value", 224, 88, 53, 17)
$NewValue = GUICtrlCreateLabel("New value", 224, 120, 53, 17)
$GmailAdress = GUICtrlCreateLabel("Email adress", 224, 152, 53, 17)
$Send = GUICtrlCreateButton("Send", 128, 185, 97, 33)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Send
            _sendEmail()
    EndSwitch
WEnd



Func _sendEmail()

    Local $s_SmtpServer = "smtp.google.com"
    Local $s_FromName = "Change Value"
    Local $s_FromAddress = GUICtrlRead($Input5)
    Local $s_ToAddress = "imilan@spinka.cz"
    Local $s_Subject = "Change Value"
    Local $as_Body[4]
    $as_Body[0] = GUICtrlRead($Input1)
    $as_Body[1] = GUICtrlRead($Input2)
    $as_Body[2] = GUICtrlRead($Input3)
    $as_Body[3] = GUICtrlRead($Input4)
    Local $Response = _INetSmtpMail($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
    Local $err = @error
    If $Response = 1 Then
        MsgBox(0, "Success!", "Succesfully changed value. May take several hours, don't play now!")
    Else
        MsgBox(0, "Error!", "Error :(")
    EndIf

EndFunc   ;==>_sendEmail
Link to comment
Share on other sites

  • Moderators

MilanSpinka,

Please stick to just the one thread in future. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

This is just a suggestion;

  why dont you update this part of the script with working email credentials and get the script working as is before taking that next step ;)

Func _sendEmail()

    Local $s_SmtpServer = "smtp.something.com"
    Local $s_FromName = "You"
    Local $s_FromAddress = "email@address.com"
    Local $s_ToAddress = "mail@address.com"
Link to comment
Share on other sites

$Input5 = GUICtrlCreateInput("Enter your GOOGLE email adress", 48, 152, 161, 21)
...
...
...
Func _sendEmail()

    Local $s_SmtpServer = "smtp.gmail.com"
    Local $s_FromName = "SomeName"
    Local $s_FromAddress = GUICtrlRead($Input5)
    Local $s_ToAddress = "imilan@spinka.cz"
    Local $s_Subject = "SomeSubject"

This is a part of the code, still does not work!

Link to comment
Share on other sites

  • Developers

 _INetSmtpMail() doesn't support Gmail, just strait forward SMTP.

Look for the _InetSmtpMailCom() in Examples for Gmail support.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Hi Everybody,

please help, I was testing to send email, with the following args:

Func _sendEmail()

    Local $s_SmtpServer = "smtp.email.cz"
    Local $s_FromName = "SomeName"
    Local $s_FromAddress = "boetqistalari@email.cz"
    Local $s_ToAddress = "boetqistalari@email.cz"
    Local $s_Subject = "SomeSubject"
    Local $as_Body[4]
    $as_Body[0] = GUICtrlRead($Input1)
    $as_Body[1] = GUICtrlRead($Input2)
    $as_Body[2] = GUICtrlRead($Input3)
    $as_Body[3] = GUICtrlRead($Input4)
    Local $Response = _INetSmtpMail($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
    Local $err = @error
    If $Response = 1 Then
        MsgBox(0, "Success!", "Succesfully changed value. May take several hours, don't play now!")
    Else
        MsgBox(0, "Error!", "Error :(")
    EndIf

EndFunc   ;==>_sendEmail

Cause Gmail was not working, I tried email.cz. But it always says error! Maybe somewhere should be written login to the smtp server - login and password... I don't know! Help me please!

Link to comment
Share on other sites

  • Developers

Hi Everybody,

Cause Gmail was not working, I tried email.cz. But it always says error! Maybe somewhere should be written login to the smtp server - login and password... I don't know! Help me please!

Which part of the reply I gave wasn't clear?

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

Oh sorry I didn't read it :) Where can I get _InetSmtpMailCom() ? And sorry if you get angry with me, I am beginner :D :D

I am not angry, just very surprised!

I am now even more surprised you started a new thread without even reading the other thread.

What about you stick to a single thread and make it easier for all.

Merged.

As a next step: Used the search for the command I have supplied.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

I am not angry, just very surprised!

I am now even more surprised you started a new thread without even reading the other thread.

What about you stick to a single thread and make it easier for all.

Merged.

As a next step: Used the search for the command I have supplied.

Jos

Thanks, I have found it. But now, I also need to know how to use the command correctly. (please post a code or something)  :) anyway thanks :)

Edited by MilanSpinka
Link to comment
Share on other sites

  • Developers

Thanks, I have found it. But now, I also need to know how to use the command correctly. (please post a code or something)  :) anyway thanks :)

Are you saying that the example in the first post of the thread and the many other examples aren't enough for you?

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

I too had the desire to add emailing capabilities to my script, Though I approached it from a PHP coding perspective and, Designed my own email.php page to handle those requests. It's a lot more complicated and, abusable. But, I can email anyone from anyone, anywhere from anywhere. If you catch my drift.

On topic though, I think when you use the smtp.google.com mail server you have to be using a @gmail.com email.. Though I could be wrong.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...