Jump to content
Sign in to follow this  
NoDark

Outputting User Input In Notepad Or Any Window Specified?

Recommended Posts

NoDark

hey this is very confusing to me i have been trying to figure this out

i want to create and input box that when the user inputs "blahblahblah" into an input box then clicks ok,

i then want it to close the input box then output "blahblahblah" or whatever the user types in a certain window

i know i have to use the GUICtrlRead function but dont know exactly how

Edited by NoDark

Share this post


Link to post
Share on other sites
Pain

Please give more information, what is this "ceratin window", is one of your own GUI's?

Also do you mean GUICtrlCreateInput or InputBox?

Here is some small examples:

$text = InputBox("Title", "Write something")
MsgBox(0, "", $text)

GUICreate("test")
$i = GUICtrlCreateInput("", 10, 10)
$b = GUICtrlCreateButton("OK", 10, 50)
GUISetState(@SW_SHOW)


$gui2 = GUICreate("another window")
$l = GUICtrlCreateLabel("",10, 10, 100, 100)
GUISetState(@SW_HIDE)
    
While 1
    Sleep(10)
    If GUIGetMsg() = $b Then
        GUICtrlSetData($l, GUICtrlRead($i))
        GUISetState(@SW_SHOW, $gui2)
    EndIf
WEnd

Share this post


Link to post
Share on other sites
NoDark

i have this flash game contained in gui, now i used au3recorder to record the mouse movements and then turned that into a function all works well it simulates the mouse movements exactly and i canget it to type back in box whatever the macro recording me typing and then hit the submit button like i want it too but i want it to pause right before it would send the txt that i wrote and and open up and input box for the user to enter txt then continue on and hit the submit button

trying to explain it so you guys can be more helpful to me as im trying to explain it the best i can

and thanks for your help :)

Edit:

the code you have as you example is almost what i was looking for except i would like to output that where ever the "blinking Cursor" i guess it would be easier to do whereever text can be written?

i guess something like this example i found except i want it like your code when you press the okay button it closes and the writes the text instead of not closing the input box at all and just waiting while still waiting for the key to be pressed would be it. trying not to make this complicated all i want is a way to do this and i cant figure out how im using this project im working on to learn. any help and id be thankful thank you so much for your help so far Pain

Example()

Func Example()
    Local $file, $btn, $msg

    GUICreate(" My GUI input ", 320, 120, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45, -1, 0x00000018); WS_EX_ACCEPTFILES
    $file = GUICtrlCreateInput("", 10, 5, 300, 20)
    GUICtrlSetState(-1, $GUI_DROPACCEPTED)
    $btn = GUICtrlCreateButton("Ok", 40, 75, 60, 20)

    GUISetState()

    $msg = 0
    While $msg <> $GUI_EVENT_CLOSE
        $msg = GUIGetMsg()
        Select
            Case $msg = $btn
                Do
                    Sleep(10)
                Until _IsPressed("01")
                Send(GUICtrlRead($file) & "  This is a line of text in the notepad window")
        EndSelect
    WEnd
EndFunc
Edited by NoDark

Share this post


Link to post
Share on other sites
iHonda

hey this is very confusing to me i have been trying to figure this out

i want to create and input box that when the user inputs "blahblahblah" into an input box then clicks ok,

i then want it to close the input box then output "blahblahblah" or whatever the user types in a certain window

i know i have to use the GUICtrlRead function but dont know exactly how

look up:

GUIcreate

GUICtrlCreateInput

GUICtrlCreateButton

WinActivate

Send

if you still cant figure it out let me know


A great place to start Autoit 1-2-3

Share this post


Link to post
Share on other sites
NoDark

look up:

GUIcreate

GUICtrlCreateInput

GUICtrlCreateButton

WinActivate

Send

if you still cant figure it out let me know

thank you so much, im learning from you guys help :) anyway this is what i got

GUICreate("Name")
$i = GUICtrlCreateInput("", 10, 10)
$b = GUICtrlCreateButton("OK", 10, 50)
GUISetState(@SW_SHOW)

While 1
    Sleep(10)
    If GUIGetMsg() = $b Then
        Send(GUICtrlRead($i) & "")
        exit
    EndIf
WEnd

but its not sending the text to the window im guessing because im missing something vital maybe winactive because i did not tell it what window i wanted it to wait for and then send the text to?

Edited by NoDark

Share this post


Link to post
Share on other sites
iHonda

thank you so much, im learning from you guys help :) anyway this is what i got

GUICreate("Name")
 $i = GUICtrlCreateInput("", 10, 10)
 $b = GUICtrlCreateButton("OK", 10, 50)
 GUISetState(@SW_SHOW)
 
 While 1
     Sleep(10)
     If GUIGetMsg() = $b Then
         Send(GUICtrlRead($i) & "")
         exit
     EndIf
 WEnd

but its not sending the text to the window im guessing because im missing something vital maybe winactive because i did not tell it what window i wanted it to wait for and then send the text to?

mk u need to make the window u wanna send the text to active thats why i said WinActivate ^^


A great place to start Autoit 1-2-3

Share this post


Link to post
Share on other sites
NoDark

prefect thank you for all your help this is my working test code

GUICreate("Name")
$i = GUICtrlCreateInput("", 10, 10)
$b = GUICtrlCreateButton("OK", 10, 50)
GUISetState(@SW_SHOW)

While 1
    Sleep(10)
    If GUIGetMsg() = $b Then
        WinWaitActive("Untitled - Notepad", "")
        Send(GUICtrlRead($i) & "")
        Exit
    EndIf
WEnd
Edited by NoDark

Share this post


Link to post
Share on other sites
iHonda

gratz ^^ i take it this was was your first code


A great place to start Autoit 1-2-3

Share this post


Link to post
Share on other sites
NoDark

gratz ^^ i take it this was was your first code

not exactly, BUT im still a newbie and im still learning i needed some guidance since i have never used the input box before in combination with those functions so i got confused thank you for all your help and being friendly :)

Share this post


Link to post
Share on other sites
iHonda

ah no prob let us know if u need anymore help


A great place to start Autoit 1-2-3

Share this post


Link to post
Share on other sites
NoDark

Opt("WinWaitDelay", 100)
Opt("WinTitleMatchMode", 4)
Opt("WinDetectHiddenText", 1)
Opt("MouseCoordMode", 0)


GUICreate("Name")
$i = GUICtrlCreateInput("", 10, 10)
$b = GUICtrlCreateButton("OK", 10, 50)
GUISetState(@SW_SHOW)

While 1
    Sleep(10)
    If GUIGetMsg() = $b Then
        WinWait("MPR V2.0 By NoDark", "")
        If Not WinActive("MPR V2.0 By NoDark", "") Then WinActivate("MPR V2.0 By NoDark", "")
        WinWaitActive("MPR V2.0 By NoDark", "")
        MouseMove(101, 65)
        MouseDown("left")
        MouseUp("left")
        MouseMove(375, 205)
        MouseDown("left")
        MouseMove(373, 207)
        MouseUp("left")
        Send(GUICtrlRead($i) & "")
        MouseMove(546, 198)
        MouseDown("left")
        MouseUp("left")
        Send("H")
        Exit
    EndIf
WEnd

my full code i would love to be able to use that mouse plus udf...i forget what its call to simulate mouse movements so it does not take over the mouse and i can keep it minimized

Edited by NoDark

Share this post


Link to post
Share on other sites
Pain

Try with ControlSend :)

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  

×