Sign in to follow this  
Followers 0
Matthy

having trouble understanding how controlsend works

5 posts in this topic

he opens notepad but doesnt do something with it

actualy i want to send controls to cmd but i thought i could better try it in notepad first

$notepad = run("notepad")

sleep(500)

ControlSend($notepad, "", "", "This is a line of text in the notepad window")

what is wrong with this :D can someone help me

Thx Matthy

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

You haven't set the "controlID". Use the Window Info tool which comes

with AutoIt and check the classname. In your example it's "Edit1".

Edit : Also, you can't use the PID returned by Run for use as the title.

Try "Notepad" instead, or whatever window-title that your notepad have.

Edited by Helge

Share this post


Link to post
Share on other sites

he opens notepad but doesnt do something with it

actualy i want to send controls to cmd but i thought i could better try it in notepad first

$notepad = run("notepad")

sleep(500)

ControlSend($notepad, "", "", "This is a line of text in the notepad window")

what is wrong with this :D can someone help me

Thx Matthy

Check your window title. I'm not on a Windows box, so I can't check, but when you run Notepad itsn't the title of window actually "Untitled - " something? You seem to be using the process ID, and I don't think that works. Also, when you use ControlSend(), you need to specify the Contol ID, which is probably something like "Edit1", and I don't think that is optional. Might be easier to use regular Send().

Now for the bad news.... None of that works with a CMD console window. All is not lost. Check out the use of Run() with STDIN/STDOUT flags and combine with StdOutRead() and StdInWrite().

:wacko:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

this is for notepad

Press CTRL-ALT-F to pause the display.

>>>>>>>>>>>> Window Details <<<<<<<<<<<<<
Title:  Naamloos - Kladblok
Class:  Notepad
Size:   X: 479  Y: 117  W: 787  H: 692

>>>>>>>>>>> Mouse Details <<<<<<<<<<<
Window: X: 438  Y: 503
Cursor ID:  5

>>>>>>>>>>> Pixel Color Under Mouse <<<<<<<<<<<
RGB:    Hex: 0xECE9D8   Dec: 15526360

>>>>>>>>>>> Control Under Mouse <<<<<<<<<<<
Size:       X: 0    Y: 0    W: 779  H: 638
Control ID: 15
ClassNameNN:    Edit1
Text:       
Style:      0x50200104
ExStyle:        0x00000200

>>>>>>>>>>> Status Bar Text <<<<<<<<<<<
(1): 
(2):    Ln 1, Col 1  

>>>>>>>>>>> Visible Window Text <<<<<<<<<<<

>>>>>>>>>>> Hidden Window Text <<<<<<<<<<<

and this is for cmd

Press CTRL-ALT-F to pause the display.

>>>>>>>>>>>> Window Details <<<<<<<<<<<<<
Title:  Selecteren C:\WINDOWS\System32\cmd.exe
Class:  ConsoleWindowClass
Size:   X: -10  Y: 186  W: 669  H: 338

>>>>>>>>>>> Mouse Details <<<<<<<<<<<
Window: X: 928  Y: 489
Cursor ID:  5

>>>>>>>>>>> Pixel Color Under Mouse <<<<<<<<<<<
RGB:    Hex: 0xECE9D8   Dec: 15526360

>>>>>>>>>>> Control Under Mouse <<<<<<<<<<<
Size:
Control ID:
ClassNameNN:
Text:

>>>>>>>>>>> Status Bar Text <<<<<<<<<<<


>>>>>>>>>>> Visible Window Text <<<<<<<<<<<

>>>>>>>>>>> Hidden Window Text <<<<<<<<<<<

sow for notpad i should use this

$notepad = run("notepad")

sleep(500)

ControlSend("Naamloos - Kladblok", "", "15", "This is a line of text in the notepad window")

but that doesnt work :D

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Might be easier to use regular Send().

Now for the bad news.... None of that works with a CMD console window. All is not lost. Check out the use of Run() with STDIN/STDOUT flags and combine with StdOutRead() and StdInWrite().

ow shit dude i am not an pro you know i thougth it was not that hard because i yust wanted to make an dos @ distance program :D

because all my friends are so noob that it is easyer to do it yourself then explain it to them how to repair soething like deleting an mod

and for bigger things like still using your pc on an other pc

Edited by Matthy

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