Jump to content
Sign in to follow this  
YpR^

Ling-in Question...

Recommended Posts

YpR^

Can anybody tell me what code to use if i would like to:

Etc. open a box with 2 squares... in the first you write a login and the second a pass.

This data should get stored and used later in the script to log-in to Hotmail etc.

Otherwise.... Where to look in the FAQ ? :)

Thank you


Share this post


Link to post
Share on other sites
buzz44

#include <GUIConstants.au3>

GUICreate(" My GUI input acceptfile", 320,120)
$file = GUICtrlCreateInput ( "", 10,  5, 300, 20)
GUICtrlCreateInput ("", 10,  35, 300, 20)
$btn = GUICtrlCreateButton ("Ok", 40,  75, 60, 20)

GUISetState () 

While 1
       $msg = GUIGetMsg()
       Select
           Case $msg = $btn
               exitloop
       EndSelect
Wend

And for saving it, you have 2 choices, save it to an INI file for which you will need...

IniReadSection ()

IniRead ()

IniWrite ()

Or to save it to the registry and read it, for which you will need...

RegRead ()

RegWrite ()

Look up the above functions in the help file.

Edited by Burrup

qq

Share this post


Link to post
Share on other sites
YpR^

If i would use it for Hotmail... would this be usefull ?:

#include <GUIConstants.au3>

GUICreate(" My GUI input acceptfile", 320,120)

$file = GUICtrlCreateInput ( "Login", 10, 5, 300, 20)

GUICtrlCreateInput ("Password", 10, 35, 300, 20)

$btn = GUICtrlCreateButton ("Ok", 40, 75, 60, 20)

GUISetState ()

While 1

$msg = GUIGetMsg()

Select

Case $msg = $btn

exitloop

EndSelect

Wend

(((Save the entered info somehow)))

Run('explorer http://www.hotmail.com', @WindowsDir)

WinSetState("xxxxx - Microsoft Internet Explorer", "", @SW_MAXIMIZE)

MouseClick("left", xxx, xxx, 1,)

(((Use the first entered info)))

MouseClick("left", xxx, xxx, 1,)

(((Use the second entered info)))

Send({ENTER})

Would this work.. or is it messy ?


Share this post


Link to post
Share on other sites
buzz44

For the password input box use.

$Pass = GUICtrlCreateInput ("Password", 10, 35, 300, 20,$ES_PASSWORD)

The $ES_PASSWORD is so that when you type something in there its hiddden behind asterisk's.

Somethings in you script are a little bit in the wrong place, heres a template for you to fill in :).

#include <GUIConstants.au3>

GUICreate("Hotmail Log-On", 320,120)

$Email = GUICtrlCreateInput ( "Email Address", 10, 5, 300, 20)
$Pass = GUICtrlCreateInput ("Password", 10, 35, 300, 20, $ES_PASSWORD)

$Ok = GUICtrlCreateButton ("Ok", 40, 75, 60, 20)

GUISetState ()

While 1
   $msg = GUIGetMsg()
   Select
      Case $msg = $Ok
        ;IniWrite () ... Look up and use this function
         Exitloop
      Case $msg = $GUI_EVENT_CLOSE
         Exit
   EndSelect
Wend

Run('explorer http://www.hotmail.com', @WindowsDir)

WinSetState("xxxxx - Microsoft Internet Explorer", "", @SW_MAXIMIZE)

MouseClick("left", xxx, xxx, 1,)
Send(GUICtrlRead($Email));Read what was in the above input boxes and type the email
MouseClick("left", xxx, xxx, 1,)
Send(GUICtrlRead($Password));Read what was in the above input boxes and type the password

Send({ENTER})

qq

Share this post


Link to post
Share on other sites
YpR^

Thank you very much for the template :)

Still can't figure out how the Iniwrite works...

IniWrite("C:\Temp\myfile.ini", "section2", "key", "this is a new value")

This is the template in the helpfile - The path is ok - Section doesn't matter ?

Don't know what the "key" and "this is a new value" means...

Should i fill those with a $Pass ?


Share this post


Link to post
Share on other sites
buzz44

A standard ini file looks like:
[SectionName]
Key=Value

eg

IniWrite("C:\Temp\myfile.ini", "Settings", "Email", $Email); Writes the email
IniWrite("C:\Temp\myfile.ini", "Settings", "Pass", $Pass); Writes the password

The ini file will look something like this

[Settings]
Email = blah blah
Pass = blah blah

Parametres for INIWrite()

filename: The filename of the .ini file.

section: The section name in the .ini file.

key: The key name in the in the .ini file.

value: The value to write/change.

Edited by Burrup

qq

Share this post


Link to post
Share on other sites
YpR^

I used your example and entered my login and pass - then i opened the ini fil but it shows:

[settings]

Email=3

Pass=4


Share this post


Link to post
Share on other sites
buzz44

My bad, I forgot you have to read the control first... replace these lines

IniWrite("C:\Temp\myfile.ini", "Settings", "Email", $Email); Writes the email
IniWrite("C:\Temp\myfile.ini", "Settings", "Pass", $Pass); Writes the password

with

IniWrite("C:\Temp\myfile.ini", "Settings", "Email", GUICtrlRead($Email))
IniWrite("C:\Temp\myfile.ini", "Settings", "Pass", GUICtrlRead($Pass))
Edited by Burrup

qq

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  

×