Sign in to follow this  
Followers 0
fred666777

notepad Send help please

4 posts in this topic

im trying to send what the user types to notepad so if my program says your name:

i want it to

run("notepad.exe")

WinWaitActive("Untitled - Notepad")

Send("Hello 'what user typed in input box'")

i have all of my code done but i cant get what is in the input box i tried

Send("Hello $name")

Send("Hello " $name)

and

Send("Hello "($name))

but obviously they are all wrong... can someone please provide the right code?

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

didnt work now it gives me #'s

here is a sample of what i am trying to do.

#include <GUIConstants.au3>

GUICreate("test", 265, 125, -1, -1)

$name = GuiCtrlCreateInput("", 85, 2, 170, 20)
$button1 = guictrlcreatebutton("test", 20, 30, 30, 20)
$namelabel = GuiCtrlCreateLabel("Your Name:", 24, 5, 60, 20)

GuiSetState ()

While 1
    $msg = GUIGetMsg()
    Select
         Case $msg = $button1
            Run("notepad.exe")
            WinWaitActive("Untitled - Notepad")
            Send("Hello " & $name)
      EndSelect
   If $msg = $GUI_EVENT_CLOSE Then ExitLoop
   Wend
Edited by fred666777

Share this post


Link to post
Share on other sites

To read the input of a Input control, use GuictrlRead.

#include <GUIConstants.au3>

GUICreate("test", 265, 125, -1, -1)

$name = GuiCtrlCreateInput("", 85, 2, 170, 20)
$button1 = guictrlcreatebutton("test", 20, 30, 30, 20)
$namelabel = GuiCtrlCreateLabel("Your Name:", 24, 5, 60, 20)

GuiSetState ()

While 1
    $msg = GUIGetMsg()
    Select
         Case $msg = $button1
            Run("notepad.exe")
            WinWaitActive("Untitled - Notepad")
            Send("Hello " & GUICtrlRead($name))
      EndSelect
   If $msg = $GUI_EVENT_CLOSE Then ExitLoop
   Wend

Works now :)

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