AutoHotkey Community

It is currently May 27th, 2012, 11:31 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: September 30th, 2009, 8:20 pm 
Offline

Joined: May 15th, 2009, 7:02 pm
Posts: 4
I'm trying to enter text into a gui and run a comparison against a predefined variable and if they match do one thing and if not do another.

Here is what I'm trying(trying being the keyword).

USER1:=username
PASS1:=password

Hotkey,F1 & F2,,OFF
Gui, Add, Edit, x81 y10 w75 h20 vUSER,
Gui, Add, Edit, x81 y40 w75 h20 Password vPASS,
Gui, Add, Text, x6 y10 w75 h20,Username:
Gui, Add, Text, x6 y40 w75 h20,Password:
Gui, Add, Button, x6 y70 w75 h20,OK
Gui, Add, Button, x81 y70 w75 h20,CANCEL
Gui, Show, AutoSize Center, User Login
return

ButtonOK:
Gui, Submit
if (USER1 = %USER% AND PASS1 = %PASS%)
{
Hotkey,F1 & F2,,ON
}
Else if (USER1 <> %USER% AND PASS1 <> %PASS%)
{
ExitApp
}


If anyone can explain what I'm doing wrong I would very much appreciate it.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 30th, 2009, 8:43 pm 
Offline

Joined: April 19th, 2005, 10:26 am
Posts: 2250
Location: switzerland
I tried this
Code:
USER1=test1
PASS1:=1234

Gui,2:Add, Edit, x81 y10 w75 h20 vUSER,%user1%
Gui,2:Add, Edit, x81 y40 w75 h20 Password vPASS,
Gui,2:Add, Text, x6 y10 w75 h20,Username:
Gui,2:Add, Text, x6 y40 w75 h20,Password:
Gui,2:Add, Button, x6 y70 w75 h20 gOK1,OK
Gui,2:Show, AutoSize Center, User Login
GuiControl,2:Focus,PASS
return

OK1:
Gui,2:Submit,nohide
if (USER1=USER AND PASS1=PASS)
   msgbox,OK
Else
   msgbox, NOT OK
return

2Guiclose:
exitapp


Last edited by garry on October 1st, 2009, 6:16 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 30th, 2009, 8:49 pm 
Offline

Joined: May 15th, 2009, 7:02 pm
Posts: 4
Thank you very much that worked perfect.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], Google Feedfetcher, Yahoo [Bot] and 21 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group