Jump to content

String from Input box


Rawox
 Share

Recommended Posts

Does anyone know why this isn't working.

I want to have this done:

- Someone fills in information in the input box

- The script opens notepad

- Scripts types what is typed in the input box.

This is what I tried:

#include <GUIConstantsEx.au3>
Opt( "WinTitleMatchMode", 2 )   ; Other Option for WinWaitActive

GUICreate("Title", 260, 260)
$input1 = GuiCtrlCreateInput("", 10, 30, 240, 20)
$ok = GUICtrlCreateButton( "Ok", 100, 100, 100, 25 )
GUISetState(@SW_SHOW)

While 1
  $msg = GUIGetMsg()

  Select
;------------ OK Button - Finished  
    Case $msg = $ok
        Run ( "notepad.exe" )
                Sleep ( 1000 )
    ;WinWaitActive ( "Kladblok", "", 5 )
        Send ( "lol" & $input1 )
        Send ( $input1 )

;------------ Cross - Finished
    Case $msg = $GUI_EVENT_CLOSE
      ExitLoop
  EndSelect
WEnd

But this script always sends just a '3' :S

Link to comment
Share on other sites

Does anyone know why this isn't working.

I want to have this done:

- Someone fills in information in the input box

- The script opens notepad

- Scripts types what is typed in the input box.

This is what I tried:

#include <GUIConstantsEx.au3>
Opt( "WinTitleMatchMode......
.....
.....
.....
    Case $msg = $GUI_EVENT_CLOSE
      ExitLoop
  EndSelect
WEnd

But this script always sends just a '3' :S

When you put variable = control, the variable contains a handle to the control, not the content of the control itself.

$input1 = GuiCtrlCreateInput("", 10, 30, 240, 20)

$input1 now contains a handle to your input box.

When you use "Send ( $input1 )" you are sending the handle and NOT the content.

use this instead:

Send ( GUICtrlRead($input1) )
Edited by andybiochem
- Table UDF - create simple data tables - Line Graph UDF GDI+ - quickly create simple line graphs with x and y axes (uses GDI+ with double buffer) - Line Graph UDF - quickly create simple line graphs with x and y axes (uses AI native graphic control) - Barcode Generator Code 128 B C - Create the 1/0 code for barcodes. - WebCam as BarCode Reader - use your webcam to read barcodes - Stereograms!!! - make your own stereograms in AutoIT - Ziggurat Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Box-Muller Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Elastic Radio Buttons - faux-gravity effects in AutoIT (from javascript)- Morse Code Generator - Generate morse code by tapping your spacebar!
Link to comment
Share on other sites

Rawox

Example:

#include <GUIConstantsEx.au3>

Opt("WinTitleMatchMode", 2) ; Other Option for WinWaitActive

GUICreate("Title", 260, 260)

$input1 = GUICtrlCreateInput("", 10, 30, 240, 20)

$ok = GUICtrlCreateButton("Ok", 100, 100, 100, 25)

GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()

    Select
        ;------------ OK Button    - Finished
        Case $msg = $ok
            Run("notepad.exe")
            WinWait("[CLASS:Notepad]")
            ControlSetText("[CLASS:Notepad]", "", "Edit1", GUICtrlRead($input1))

            ;------------ Cross    - Finished
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
    EndSelect
WEnd
Link to comment
Share on other sites

Tnx man that worked! But now,,, I wanna make this:

#include <GUIConstantsEx.au3>

Opt("WinTitleMatchMode", 2); Other Option for WinWaitActive

GUICreate("Title", 260, 260)
GuiSetFont ( 8.5, 800 )
GuiCtrlCreateLabel ( "Username", 100, 13 )
GuiCtrlCreateLabel ( "Password", 100, 60 )
GuiSetFont ( 8.5, 400 )
;Button
$input1 = GUICtrlCreateInput( "", 10, 29, 240, 20 )
$input2 = GUICtrlCreateInput( "", 10, 76, 240, 20 )
$ok = GUICtrlCreateButton( "Ok", 100, 100, 100, 25 )

GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()

    Select
       ;------------ OK Button  - Finished
        Case $msg = $ok
            Run("notepad.exe")
            WinWait("[CLASS:Notepad]")
            ControlSetText("[CLASS:Notepad]", "", "Edit1", GUICtrlRead($input1))
            Send ( "{ENTER}" )
            Sleep ( 400 )
            ControlSetText("[CLASS:Notepad]", "", "", GUICtrlRead($input2))
            
           ;------------ Cross  - Finished
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
    EndSelect
WEnd
Edited by Rawox
Link to comment
Share on other sites

@Rawox

Example:

#include <GUIConstantsEx.au3>

Opt("WinTitleMatchMode", 2); Other Option for WinWaitActive

GUICreate("Title", 260, 260)
GUISetFont(8.5, 800)

GUICtrlCreateLabel("Username", 100, 13)

GUICtrlCreateLabel("Password", 100, 60)
GUISetFont(8.5, 400)

;Button
$input1 = GUICtrlCreateInput("", 10, 29, 240, 20)

$input2 = GUICtrlCreateInput("", 10, 76, 240, 20)

$ok = GUICtrlCreateButton("Ok", 100, 100, 100, 25)

GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()

    Select
        ;------------ OK Button    - Finished
        Case $msg = $ok
            Run("notepad.exe")
            WinWait("[CLASS:Notepad]")
            $sRead = GUICtrlRead($input1) & @CRLF & GUICtrlRead($input2)
            ControlSetText("[CLASS:Notepad]", "", "Edit1", $sRead)
            ;------------ Cross    - Finished
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
    EndSelect
WEnd

:)

Link to comment
Share on other sites

That worked,

but now I want to make it work for gmail :)

Anyone??

#include <GUIConstantsEx.au3>

Opt("WinTitleMatchMode", 2); Other Option for WinWaitActive

GUICreate("Title", 260, 260)
GUISetFont(8.5, 800)
GUICtrlCreateLabel("Username", 100, 13)
GUICtrlCreateLabel("Password", 100, 60)
GUISetFont(8.5, 400)

;Button
$input1 = GUICtrlCreateInput("", 10, 29, 240, 20)
$input2 = GUICtrlCreateInput("", 10, 76, 240, 20)
$ok = GUICtrlCreateButton("Ok", 100, 100, 100, 25)

GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()
    
    Select
       ;------------ OK Button  - Finished
        Case $msg = $ok
        Run ( "C:\Program Files\Mozilla Firefox\firefox.exe" )
        Sleep ( 4000 )
        Send ( "{F6}" )
        Sleep ( 1200 )
        MouseClick ( "left", 1080, 317 )
            #cs
            Run("notepad.exe")
            WinWait("[CLASS:Notepad]")
            $sRead = GUICtrlRead($input1) & @CRLF & GUICtrlRead($input2)
            ControlSetText("[CLASS:Notepad]", "", "Edit1", $sRead)
            #ce
           ;------------ Cross  - Finished
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
    EndSelect
WEnd
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...