xuzo

What is "Edit1" in control send?

7 posts in this topic

#1 ·  Posted (edited)

I'm looking at the example for controlsend from the example:

ControlSend ( "title", "text", controlID, "string" [, flag = 0] )

It's like this in the script:

ControlSend($hWnd, "", "Edit1", "This is some text")

But the actual control ID is 15....

ControlSend($hWnd, "", "15", "This is some text")

And that doesn't work.

I do see:

 

Advanced Mode [CLASS:Edit; INSTANCE:1]

But that is not the ID of the control tab....15 is...

 

What is the logic behind this?

Can I use control ID with other windows? Is this a notepad anomally?

 

auto-it.png

Edited by xuzo

Share this post


Link to post
Share on other sites



This way.

ControlSend($hWnd, "", "Edit15", "This is some text")

Saludos

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

ControlSend can receive many types of control identifiers. One of them is ClassNN (class + instance), which, in this example, is the mysterious "Edit1". If you want to use ControlID instead of the ClassNN or other string, you can't put it between quotation marks:

ControlSend($hWnd, "", 15, "This is some text")
Edited by scintilla4evr

Share this post


Link to post
Share on other sites

How about for Firefox?

Is this better

Opt("WinTitleMatchMode", 2)
Local $hWnd = WinWait("Firefox")
  WinActivate($hWnd)
  ControlSend("Mozilla Fireox", "", "", "{PGUP}{PGUP}{PGUP}{PGUP}{PGUP}{PGUP}")

Than this?

Opt("WinTitleMatchMode", 2)
Local $hWnd = WinWait("Firefox")
  WinActivate($hWnd)
  Send("{PGUP}{PGUP}{PGUP}{PGUP}{PGUP}{PGUP}")

I was told to use controlsend for more reliable scripts

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

How about for Firefox?

Is this better

Opt("WinTitleMatchMode", 2)
Local $hWnd = WinWait("Firefox")
  WinActivate($hWnd)
  ControlSend("Mozilla Fireox", "", "", "{PGUP}{PGUP}{PGUP}{PGUP}{PGUP}{PGUP}")

Than this?

Opt("WinTitleMatchMode", 2)
Local $hWnd = WinWait("Firefox")
  WinActivate($hWnd)
  Send("{PGUP}{PGUP}{PGUP}{PGUP}{PGUP}{PGUP}")

I was told to use controlsend for more reliable scripts

 

Send is a function that can be interrupted by, or interrupt, the user. If you do Send("Hello world! This is some text that I am sending") to Notepad then, while send is sending that string, the user can interrupt the script, or vise versa. ControlSend is going to send, to that window, the message you want to send it. The program is going to process that message in the background from ControlSend in the background and not interrupt anything.

Look up PostMessage and SendMessage on MSDN and check out https://msdn.microsoft.com/en-us/library/windows/desktop/ms644927(v=vs.85).aspx#windows_messages if you want to understand more.

Just a quick note though, if you were wanting to do send, instead of doing Send("Long string") you might want to store your string in clipboard (ClipPut("long string")) and then Send{"^{v}").

Edited by InunoTaishou

Share this post


Link to post
Share on other sites

This string:

ControlSend("Mozilla Fireox", "", "", "{PGUP}{PGUP}{PGUP}{PGUP}{PGUP}{PGUP}")

Is much longer than:

Send("{PGUP}{PGUP}{PGUP}{PGUP}{PGUP}{PGUP}")

Can I create a variable for:

ControlSend("Mozilla Fireox", "", "", "

Like this:

$c_t_r_l_send = ControlSend[("Mozilla Firefox", "", "", "

And then use:

$var("{PGUP}{PGUP}{PGUP}{PGUP}{PGUP}{PGUP}")

My Syntax is wrong I know, but first I want to know if this is even possible?

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

ControlSend("[Class:MozillaWindowClass]", "", "", "{PGUP 6}")

Shortened

You can also do this

Local $ctrlSend = ControlSend
Local $hFireFox = WinGetHandle("[Class:MozillaWindowClass]")
Local $sMsg = "{PgUp 6}"
$ctrlSend($hFireFox, "", "", $sMsg)

And if you want to get really generic with your programming

Local $aArgs[] = ["CallArgArray", "[Class:MozillaWindowClass]", "", "", "{PgUp 6}"]
Call(ControlSend, $aArgs)

 

Edited by InunoTaishou

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