Jump to content

notepad Send help please


Recommended Posts

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?

Link to comment
Share on other sites

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
Link to comment
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 :)

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...