Jump to content

new to Autoit need help wih GUI


Recommended Posts

I have a GUI with 10 buttons, each button sends a line of text based on the {ENTER} key being pressed

after I sent the text I want to redisplay the GUI and allow another button to be pressed without ending and restarting the GUI. Can anyone help me

Link to comment
Share on other sites

; Includes the GuiConstants (required for GUI function usage)

#include <GuiConstants.au3>
#include <StaticConstants.au3>
#Include <Misc.au3>

; Hides tray icon

#NoTrayIcon
; Change to OnEvent mode
Opt('GUIOnEventMode', 1)
; Varibles
Global $name = "Michael Shevchik"
Global $fname = "Michael"
Global $lname = "Shevchik"
Global $email = "mshevchik@aol.com"
Global $zip = "27603"
Global $add1 = "1012 Turner Meadow Drive"
Global $city = "Raleigh"
Global $state = "NC"
Global $tel = "919-771-0233"
Global $dob = "12/06/1949"
Global $ans = 0


GuiCreate("KPS Ventures, West Caldwell NJ", 400, 700)
GuiSetIcon("logo1.jpg")

; Runs the GUIExit() function if the GUI is closed

GUISetOnEvent($GUI_EVENT_CLOSE, 'GUIExit')

; Logo / Pic

GuiCtrlCreatePic("kps logo1.jpg",120,5,156,160)

; Instructions

GUICtrlCreateLabel("Please Choose an Option Below:", 50, 180, 300, 15, $SS_CENTER)

GUICtrlSetColor(-1,0xFF0000) 
; Makes instructions Red

; Button1

GUICtrlCreateButton($name, 100, 210, 200, 30)

GUICtrlSetOnEvent(-1, 'Name') ; Runs Name() when pressed

; Button2

GUICtrlCreateButton($fname, 100, 250, 200, 30)

GUICtrlSetOnEvent(-1, 'fname') ; Runs email() when pressed



; Button3

GUICtrlCreateButton($lname, 100, 280, 200, 30)

GUICtrlSetOnEvent(-1, 'Lname') ; Runs Lname() when pressed

Func Name()

; Hides the GUI while the function is running

GUISetState(@SW_HIDE)
While 1
    Sleep ( 250 )
If _IsPressed("0D") Then
    Send($name)
    ExitLoop
EndIf
WEnd
Exit

EndFunc

Func Fname()

; Hides the GUI while the function is running

GUISetState(@SW_HIDE)
While 1
    Sleep ( 250 )
If _IsPressed("0D") Then
    Send($fname)
    ExitLoop
EndIf
WEnd
Exit

EndFunc


Func Lname()

; Hides the GUI while the function is running

GUISetState(@SW_HIDE)
While 1
    Sleep ( 250 )
If _IsPressed("0D") Then
    Send($lname)
    ExitLoop
EndIf
WEnd
Exit

EndFunc

Link to comment
Share on other sites

I'm not sure about the information displayed but you should never post your address, tel etc. on the internet!

Why ?

If anyone wanna do identity theft they can just grab a phonebook, thousands of similar info in those.

(well, ok, except for the date of birth thing :mellow: )

Some guy's script + some other guy's script = my script!

Link to comment
Share on other sites

You are setting GUISetState(@SW_HIDE) but never setting it back to @SW_SHOW. For every function add the line GUISetState(@SW_SHOW) at the end of the function. I'm not sure why you are bothering to hide it anyway.

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!"

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...