Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

How to create GUI to prompt for username and password and then reference this in script?



  • Please log in to reply
2 replies to this topic
genepaton
  • Members
  • 28 posts
  • Last active: Aug 22 2013 02:03 AM
  • Joined: 04 Mar 2013

Hi all,
 
I've included my script below, and although i've tried having a play i can't get my head around creating GUI's.
I was wondering if someone could help me write into the script a pop up that prompts for the users username and password the first time either hotkeys are run (eg first use after the script is loaded) and then stores/refers to this at the appropriate points in the script. That way different users are able to take advantage of my script. When they've finished with the script, if they right click and exit the script from the taskbar the next person to load it will be prompted again.

 

I know its a big ask, but after trying to find tutorials or reverse engineer other peoples examples i've had no luck =(

#MaxThreadsPerHotkey 1 ;prevents someone executing the hotkey whilst its already running

#1::
IfWinExist New-Entry 
{
    WinActivate ;activate the window
    send, {F11 2}{F1 4} ;send keystrokes F11 x2 F1 x4
}
else
{
    Run, C:\RFW\entry.exe 
    WinWait New-Entry
    WinActivate
    Sleep, 500
    Send, live{ENTER}
    Sleep, 500
    Send, 1{ENTER}
    Sleep, 500
    Send, username{ENTER} ;GUI to prompt for this entry and then refer to it (store it in memory) until the script is ended from the taskbar
    Sleep, 500
    Send, password{ENTER} ;GUI again
} ;end if
Sleep, 500
Send, LOC{ENTER}
KeyWait, Enter, D ;wait for the Enter ket to be pressed and released
Send, {F11}
Send, I{ENTER}
Send, {ENTER 3}
Send, DELPT19{ENTER}
Send, {ENTER 2}
Send, F{ENTER}
Send, username{ENTER} ;GUI reference
Send, password{ENTER} ;GUI reference
return ;ends this script routine

#2::
IfWinExist New-Entry
{
    WinActivate
    send, {F11 2}{F1 4}
}
else
{
    Run, C:\RFW\entry.exe
    WinWait New-Entry
    WinActivate
    Sleep, 500
    Send, live{ENTER}
    Sleep, 500
    Send, 1{ENTER}
    Sleep, 500
    Send, username{ENTER} ;GUI reference
    Sleep, 500
    Send, password{ENTER} ;GUI reference
} 
Sleep, 500
Send, 2 1 2{ENTER}
Send, {ENTER 3}
Send, DELPT19{ENTER}
Send, {ENTER 2}
KeyWait, F11, D
Sleep, 500
WinActivate, New-Entry
Send, F{ENTER}
Send, username{ENTER} ;GUI reference
Send, password{ENTER} ;GUI reference
return 

#IfWinActive, New-Entry ;If new-entry is activated then the hotkey Esc makes the script close and reload. I understand this will also make the user have to re-enter their username and password.
Esc::
reload
return
#IfWinActive ;ends the if active command


kon
  • Members
  • 1652 posts
  • Last active:
  • Joined: 04 Mar 2013
✓  Best Answer
#MaxThreadsPerHotkey 1 ;prevents someone executing the hotkey whilst its already running
Gui, add, Edit, vName x10 w180, Username
Gui, add, Edit, vPass x10 w180, Password
Gui, add, Button, Default gSubmit x10 w180, OK
Gui, show
return

Submit:
Gui, Submit, NoHide
Gui, Destroy
return

#1::
IfWinExist New-Entry 
{
WinActivate ;activate the window
send, {F11 2}{F1 4} ;send keystrokes F11 x2 F1 x4
}
else
{
Run, C:\RFW\entry.exe 
WinWait New-Entry
WinActivate
Sleep, 500
Send, live{ENTER}
Sleep, 500
Send, 1{ENTER}
Sleep, 500
Send, %Name%{ENTER} ;GUI to prompt for this entry and then refer to it (store it in memory) until the script is ended from the taskbar
Sleep, 500
Send, %Pass%{ENTER} ;GUI again
........
.....


genepaton
  • Members
  • 28 posts
  • Last active: Aug 22 2013 02:03 AM
  • Joined: 04 Mar 2013

Kon Kon Kon..... Is there no end to your outstanding higher intelligence!?

Are you actually the developer of this app? Is Kon a pseudonym for Bill Gates, Bobby Fischer, Marilyn vos Savant or Kim Ung-Yong? (had to Google those last couple for people with the highest IQ).

I'll PM you with an offer.

 

Many many thanks, and i formally nominate Kon for the Forums top poster and all round problem solver!

 

Gene

 

 

#MaxThreadsPerHotkey 1 ;prevents someone executing the hotkey whilst its already running
Gui, add, Edit, vName x10 w180, Username
Gui, add, Edit, vPass x10 w180, Password
Gui, add, Button, Default gSubmit x10 w180, OK
Gui, show
return

Submit:
Gui, Submit, NoHide
Gui, Destroy
return

#1::
IfWinExist New-Entry 
{
WinActivate ;activate the window
send, {F11 2}{F1 4} ;send keystrokes F11 x2 F1 x4
}
else
{
Run, C:\RFW\entry.exe 
WinWait New-Entry
WinActivate
Sleep, 500
Send, live{ENTER}
Sleep, 500
Send, 1{ENTER}
Sleep, 500
Send, %Name%{ENTER} ;GUI to prompt for this entry and then refer to it (store it in memory) until the script is ended from the taskbar
Sleep, 500
Send, %Pass%{ENTER} ;GUI again
........
.....