Sign in to follow this  
Followers 0
Beginner321

Help on Email logger

10 posts in this topic

I am trying to make an email logger. You just basically put in your user and pass and select the type of email you want to log in to. I've made everything, but I'm stuck on one part. I can't make the url in the _IECreate func a variable. This is related the checkbox issue. Basically, the program has 2 radio boxes, one gmail, and the other hotmail.

i want it to be something like this:

if radio2 is checked then $WEB is "www.hotmail.com"

and if radio3 is checked the $WEB is" www.gmail.com"

this is my first autoit program, so i just want to keep the script simple, so I can still understand it.

i used the method that i saw Valuator use to get the value for the radio boxes, but it still wont work.

heres my script:

#include <GUIConstants.au3>
#include <IE.au3>

Global $WEB

$ES_PASSWORD=0x0020

#Region ### START Koda GUI section ### Form=C:\Documents and Settings\bryani\My Documents\Form1.kxf
$Form1 = GUICreate("Email Login", 312, 337, 193, 125)
$Group1 = GUICtrlCreateGroup("Choose Email Account", 16, 16, 241, 121)
$Radio2 = GUICtrlCreateRadio("Hotmail", 32, 40, 105, 25)
$Radio3 = GUICtrlCreateRadio("Gmail", 32, 88, 113, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Input1 = GUICtrlCreateInput("Username", 32, 184, 129, 21)
$Input2 = GUICtrlCreateInput("Password", 32, 216, 129, 21,$ES_PASSWORD)
$Button1 = GUICtrlCreateButton("Cancel", 200, 264, 89, 25, 0)
$Button2 = GUICtrlCreateButton("OK", 104, 264, 81, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###



While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
            
        Case $Button1
            Exit
        
        Case $Button2
            Launch()
            Exit

    EndSwitch
WEnd
if _IsChecked($Radio2) Then
    $WEB="www.hotmail.com"
ElseIf _IsChecked($Radio3) Then
    $WEB="www.gmail.com"
EndIf


Func Launch()
    _IECreate($WEB)
    Send(GUIctrlread($Input1))
    Send("{TAB}")
    Send(GuiCtrlRead($Input2))
    Send("{ENTER}")
        MsgBox(1"","Error4")
    
EndFunc


Func _IsChecked($control)   
    Return BitAND(GUICtrlRead($control), $GUI_CHECKED) = $GUI_CHECKED
EndFunc  ;==>_IsChecked

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Put this part inside the Launch() function ahead of the _IECreate()

if _IsChecked($Radio2) Then
    $WEB="www.hotmail.com"
ElseIf _IsChecked($Radio3) Then
    $WEB="www.gmail.com"
EndIf

EDIT: Actually you could also shorten that If statement

if _IsChecked($Radio2) Then
    $WEB="www.hotmail.com"
Else
    $WEB="www.gmail.com"
EndIf

Edit 2: This is even better

Func Launch()
    $WEB = "www.hotmail.com"
    If _IsChecked($Radio3) Then $WEB="www.gmail.com"
    _IECreate($WEB)
    Send(GUIctrlread($Input1))
    Send("{TAB}")
    Send(GuiCtrlRead($Input2))
    Send("{ENTER}")
        MsgBox(1"","Error4")
    
EndFunc
Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

EDIT: Actually you could also shorten that If statement

yes, but what then happens when neither is selected?

answer: it tries to open http://password/

Edited by mdiesel

Share this post


Link to post
Share on other sites

yes, but what then happens when neither is selected?

answer: it tries to open http://password/

New answer .... Read Edit 2

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Thanks alot. I just tried it right now, and it really works.

I was just wondering if it is possible to open Firefox with autoit, rather than Internet Explorer. (Its not really important though)

Anyway, thanks again.

Share this post


Link to post
Share on other sites

@beginner321

When using Radios it's normal to set the default radio which would have prevented what @mdiesel refered to above

$Radio2 = GUICtrlCreateRadio("Hotmail", 32, 40, 105, 25)
GUICtrlSetState($Radio2, $GUI_CHECKED)

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Thanks alot. I just tried it right now, and it really works.

I was just wondering if it is possible to open Firefox with autoit, rather than Internet Explorer. (Its not really important though)

Anyway, thanks again.

use shellexecute instead of IECreate.

MDiesel

Share this post


Link to post
Share on other sites

yes, but what then happens when neither is selected?

answer: it tries to open http://password/

Thats what kept happening before, my password kept coming up in the url feild. But the Edit 2 by Geo soft solves it.

Share this post


Link to post
Share on other sites

@beginner321

When using Radios it's normal to set the default radio which would have prevented what @mdiesel refered to above

$Radio2 = GUICtrlCreateRadio("Hotmail", 32, 40, 105, 25)
GUICtrlSetState($Radio2, $GUI_CHECKED)
Not when using the IE functions.

However if FF is your default browser then you could simply use

ShellExecute($WEB)


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

use shellexecute instead of IECreate.

MDiesel

k, thanks. Ill try that

Share this post


Link to post
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
Sign in to follow this  
Followers 0