Sign in to follow this  
Followers 0
SmOke_N

Reading 2 GUIinput with 1 button?

7 posts in this topic

#1 ·  Posted (edited)

Here's my question, I'm trying to get a Username and Password entered into a script. The main GUI, will call this script, open all applications that need to be open, log on to said application, and enter password. Where am I going wrong?

#include <GuiConstants.au3>

;GUI
$parent1 = GUICreate("AutoLogin", 300,150)
$ScreenName = GUICtrlCreateInput("Your Sign In Name", 135, 25, 150, 20 )
$Password = GUICtrlCreateInput("Password Here", 135, 65, 150, 20 )
$Button8 = GUICtrlCreateButton("Auto Start", 135, 100, 75,30)


;Pic
$Pic1 = GUICtrlCreatePic("Logo1.gif", 25, 20, 75, 77)

GUISetState(@SW_SHOW)

While 1
   $msg = GUIGetMsg()
   Select
      Case $msg = $GUI_EVENT_CLOSE
      Case $msg = $Button8
         EnvSet("ScreenName", GUICtrlRead($ScreenName))
         Run("C:\Program Files\PPDB 1280-1040\Login.exe" & " " & GUICtrlRead($ScreenName))

      Case $msg = $Button8
         EnvSet("Pass", GUICtrlRead($Password))
         Run("C:\Program Files\PPDB 1280-1040\Login.exe" & " " & GUICtrlRead($Password))
         ExitLoop
     EndSelect
WEnd

I'm sure the fact that i have 2 $Button8's is helping "alot".  But i've done with a button under the button, without the 2nd $Button8 (which brings up double applications), and done it with adding another button.  I know the codes horrible, but i'm trying.

My script is calling for these cases as such:

;___Logging in your Screen Name
   $ScreenName = EnvGet("ScreenName")
   WinActivate("Login")
   MouseMove(761, 416)
   MouseDown("left")
   MouseMove(613, 416)
   MouseUp("left")
   Sleep(300)
   Send($ScreenName, 1)
   Send("{ENTER}")
   
  ;___Logging in your Password
   $Password = EnvGet("Pass")
   WinActivate("Login")
   MouseClick("Left", 615, 447)
   Sleep(300)
   Send($Password, 1)
   Send("{ENTER}")
EndFunc  ;==>do_logon

Any Laymen :) suggestions are greatly appreciated. Thanks

Ron

Edited by ronsrules

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

#2 ·  Posted (edited)

         Run("C:\Program Files\PPDB 1280-1040\Login.exe" & " " & GUICtrlRead

should be

Run("C:\Program Files\PPDB 1280-1040\Login.exe")

hmmmmmmmmm... look at the correct syntax for run

Run ( "filename" [, "workingdir" [, flag]] )

Parameters

filename    The name of the executable (EXE, BAT, COM, or PIF) to run. 
workingdir    [optional] The working directory. 
flag    [optional] The "show" flag of the executed program:
  @SW_HIDE = Hidden window
  @SW_MINIMIZE = Minimized window
  @SW_MAXIMIZE = Maximized window

why do u have GUICtrlRead($ScreenName)) ??, you cant have that . incorrecnt syntax . if u want to enter the values in the $screenname ans $password you could use Winwait to wait for ur "Login.exe" to open then u could "send($screenname) etc .. or sumthing similar

Edited by burrup

[u]Old Projects:[/u]A3MORGB2Hex[u]Old Functions:[/u]_TimeAdd/_TimeSub_AddComma_BubbleSort _RippleSort "He who does not understand your silence will probably not understand your words." - Elbert Hubbard.

Share this post


Link to post
Share on other sites

why do u have GUICtrlRead($ScreenName)) ??, you cant have that . incorrecnt syntax . if u want to enter the values in the $screenname ans $password you could use Winwait to wait for ur "Login.exe" to open then u could "send($screenname) etc .. or sumthing similar

<{POST_SNAPBACK}>

in the 2nd script there is an EnvGet. The 1st script (gui) has a label (username) varies often, and (password) that varies often. Dependent on these usernames and passwords, is what controls the functions in the 2nd script.

I've decided just to make another script for the password, and add a password button, since it looks like everyone is tired of trying to help (gawd i understand that), or don't know what the heck i'm talking about.

Thanks

Ron


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Yes, login.exe runs perfectly. well for the first action $ScreenName. Just doesn't take action for $Password. I've created another script, but would have been nice to see it work with just the 1 script.


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

As usual, Great Job!, Thanks :)


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

:D Wow, Larry I tried to run that script above that you helped me w/ in an executable and got a horrible CmdLine error.

Anyway, I figured out :) !! Hooray me!

I don't know if anyone can benefit from this, but It helped me tremendously.

GUI script 1:

#include <GuiConstants.au3>

;GUI
$parent1 = GUICreate("AutoLogin", 300,150)
$ScreenName = GUICtrlCreateInput("Your Sign In Name", 135, 25, 150, 20 )
$Password = GUICtrlCreateInput("Password Here", 135, 65, 150, 20 )
$Button8 = GUICtrlCreateButton("Auto Start", 135, 100, 75,30)


;Pic
$Pic1 = GUICtrlCreatePic("Logo1.gif", 25, 20, 75, 77)

GUISetState(@SW_SHOW)

While 1
   $msg = GUIGetMsg()
   Select
      Case $msg = $GUI_EVENT_CLOSE
      Case $msg = $Button8
         EnvSet("foo", GUICtrlRead($ScreenName))
         EnvSet("pass", GUICtrlRead($Password))
         Run("C:\Program Files\PPDB 1280-1040\Login.exe" & " " & GUICtrlRead($ScreenName) & " " & GUICtrlRead($Password))
         ExitLoop
   EndSelect
WEnd

The 2 EnvSet's did it.

2nd script reading the GUI:

;___Logging in your Screen Name
   $ScreenName = EnvGet("foo")
   WinActivate("Login")
   MouseMove(761, 416)
   MouseDown("left")
   MouseMove(613, 416)
   MouseUp("left")
   Sleep(300)
   Send($ScreenName, 1)
   Send("{ENTER}")
   
;___Logging in your Password
   $Password = EnvGet("pass")
   WinActivate("Login")
   MouseClick("Left", 615, 447)
   Sleep(300)
   Send($Password, 1)
   Send("{ENTER}")
EndFunc;==>do_logon

Best part is 1 script can read as many combo/input/labels as you want as long as you GUICtrlSetData(). I'm sure I'll get flammed for something being in the wrong syntax or calling the wrong thing or whatever anyone can find, but remember this is the 1st time in my life ever messing w/ something like this (scripting). Been a month, and purty near finished my entire program (sure it would of only taken ya'll a few hours...lol. :D

Thanks so much for all the help!

Ron


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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