Jump to content
Sign in to follow this  
MikeShevchik

new to Autoit need help wih GUI

Recommended Posts

MikeShevchik

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

Share this post


Link to post
Share on other sites
Bot
Can you provide an example (shorten) of your code there?

Share this post


Link to post
Share on other sites
MikeShevchik

; 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

Share this post


Link to post
Share on other sites
Rawox

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

Share this post


Link to post
Share on other sites
Werty

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: )

Share this post


Link to post
Share on other sites
GEOSoft

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

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.