Jump to content

Reading Gui Text


Recommended Posts

I'm trying to create a GUI that allows a user to enter text into a text box then type the text they entered into an open program in Windows. Is that possible? Here is my current code.

#include <GUIConstants.au3>
GuiCreate("PRIDE", 200, 100)

GuiCtrlCreateLabel("Enter 1st Named Insured:", 15, 10)
$input1 = GUICtrlCreateInput ("", 10, 30, 175, 22)
GUISetState()

$okbutton = GUICtrlCreateButton ("OK",  40, 70, 50)
$cancelbutton = GUICtrlCreateButton ( "Cancel",  100, 70, 50)

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    

    Select
        Case $msg = $GUI_EVENT_CLOSE Or $msg = $cancelbutton
            ExitLoop

        Case $msg = $okbutton
            GUICtrlRead($input1)
            GUIDelete()
            Sleep (2000)
            Run(GUICtrlRead($input1))
            Exit            

    EndSelect
Wend

GUIDelete()

Exit
Link to comment
Share on other sites

  • Moderators

#include <GUIConstants.au3>
GuiCreate("PRIDE", 200, 100)

GuiCtrlCreateLabel("Enter 1st Named Insured:", 15, 10)
$input1 = GUICtrlCreateInput ("", 10, 30, 175, 22)

$okbutton = GUICtrlCreateButton ("OK",  40, 70, 50)
$cancelbutton = GUICtrlCreateButton ( "Cancel",  100, 70, 50)

GUISetState(); moved this under the all controls being made
; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    

    Select
        Case $msg = $GUI_EVENT_CLOSE Or $msg = $cancelbutton
            ExitLoop

        Case $msg = $okbutton
            $INPUT1DATA = GUICtrlRead($input1);<< You could store the input in a variable
           ;GUIDelete() << your deleteing the GUI so your run doesn't read anything because your trying to read a non-existing GUI
            Sleep (2000)
           ;Run($INPUT1DATA)
        ;ControlSend('WINDOW NAME', '', 'CONTROL ID', $INPUT1DATA)
            MsgBox(0, 'Testing Value', $INPUT1DATA)
            Exit            

    EndSelect
Wend

GUIDelete()

Exit

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.

Link to comment
Share on other sites

#include <GUIConstants.au3>
GuiCreate("PRIDE", 200, 100)

GuiCtrlCreateLabel("Enter 1st Named Insured:", 15, 10)
$input1 = GUICtrlCreateInput ("", 10, 30, 175, 22)

$okbutton = GUICtrlCreateButton ("OK",  40, 70, 50)
$cancelbutton = GUICtrlCreateButton ( "Cancel",  100, 70, 50)

GUISetState(); moved this under the all controls being made
; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    

    Select
        Case $msg = $GUI_EVENT_CLOSE Or $msg = $cancelbutton
            ExitLoop

        Case $msg = $okbutton
            $INPUT1DATA = GUICtrlRead($input1);<< You could store the input in a variable
          ;GUIDelete() << your deleteing the GUI so your run doesn't read anything because your trying to read a non-existing GUI
            Sleep (2000)
          ;Run($INPUT1DATA)
    ;ControlSend('WINDOW NAME', '', 'CONTROL ID', $INPUT1DATA)
            MsgBox(0, 'Testing Value', $INPUT1DATA)
            Exit            

    EndSelect
Wend

GUIDelete()

Exit
it looks like smoke beat me to this one, but forgot to welcome you to the forums. welcome aboard.
Link to comment
Share on other sites

it looks like smoke beat me to this one, but forgot to welcome you to the forums. welcome aboard.

How about this one ? You have a input control that allows multiple lines - how to you use a button to capture the text into a variable?

Thanks in advance - also thought it fit right with this post.

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

How about this one ? You have a input control that allows multiple lines - how to you use a button to capture the text into a variable?

Thanks in advance - also thought it fit right with this post.

does this have anything to do with it - $BS_DEFPUSHBUTTON ?

********edit

nevermind that will not work

I need it to copy all text at time of button press, not on enter as this will - in my example - do a @cr

Edited by nitekram

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

does this have anything to do with it - $BS_DEFPUSHBUTTON ?

********edit

nevermind that will not work

I need it to copy all text at time of button press, not on enter as this will - in my example - do a @cr

The line in smoke's code does just that, if it's an edit control it should still get all the text

$INPUT1DATA = GUICtrlRead($input1);<< You could store the input in a variable

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

The line in smoke's code does just that, if it's an edit control it should still get all the text

$INPUT1DATA = GUICtrlRead($input1);<< You could store the input in a variable

Sorry, about that - I was using the wrong function.

GUISetOnEvent($VAR, "function1") not the right command

GUICtrlSetOnEvent($VAR, "function1") - write command

I guess I copied the wrong part - it all works good now. I should of tested the button press - just to make sure it was doing something, which after further test showed. I then looked at the command and compared it with my older code and Hurray - I found it.

Thanks for making me triple check - I guess third time is the charm.

Again, thanks for your help, Iwas going crazy.

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

Now that I am able to read the data - is there a way to post data? I have tried the following but it will stop and not go to the next line. Any ideas on how to make this happen - the field itself is able to send multiline data back to clipboard. Do I have to paste the data to clipboard first and then get it from there and then paste it to the textbox.

GUICtrlSetData ( $GUI_TEXT_USER, "What is the persons first and last name?:::::" & @CR & "What customer and site is the person calling from?:::::" & @CR & "What is the customer stating is wrong?:::::")

edit

fixed grammar

Edited by nitekram

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

Now that I am able to read the data - is there a way to post data? I have tried the following but it will stop and not go to the next line. Any ideas on how to make this happen - the field itself is able to send multiline data back to clipboard. Do I have to paste the data to clipboard first and then get it from there and then paste it to the textbox.

GUICtrlSetData ( $GUI_TEXT_USER, "What is the persons first and last name?:::::" & @CR & "What customer and site is the person calling from?:::::" & @CR & "What is the customer stating is wrong?:::::")

edit

fixed grammar

edit 1

Never mind I think I found it under - _GUICtrlEditReplaceSel - if I cannot get this I hope someone will still be able to help me.

edit 2

Well that does not look like it going to work either.

edit 3

found it this time - @CRLF - can you believe the time it takes me to find the things that you guys know like the back of your hand

Edited by nitekram

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

found it this time - @CRLF - can you believe the time it takes me to find the things that you guys know like the back of your hand

it takes time to learn anything new, man. just about everyone here started at the same place, and had to learn all the same stuff. you'll pick it up quickly i'm sure.
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...