xuzo Posted January 10, 2016 Posted January 10, 2016 (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? Edited January 10, 2016 by xuzo
Danyfirex Posted January 10, 2016 Posted January 10, 2016 This way.ControlSend($hWnd, "", "Edit15", "This is some text")Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
scintilla4evr Posted January 10, 2016 Posted January 10, 2016 (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 January 10, 2016 by scintilla4evr Just Monika. Spoiler CompileIt - an experimental AutoIt-to-machine code compiler Apps: Power Calculator | AutoItFX | AudioBox | vPaint 4 | Color Book Editor UDFs: Advanced Math UDF | Blender UDF | Motion Graphics UDF | ColorEx UDF | ChakraCore UDF | CUDA UDF Adobe UDFs: Photoshop | ... Examples & Small Scripts: Distorting GDI+ Paths with other Paths | Combining GDI+ Paths with different combine modes | _WinAPI_DwmEnableBlurBehindWindow in Windows 10 | Running AutoIt code from any web browser
xuzo Posted January 10, 2016 Author Posted January 10, 2016 How about for Firefox?Is this betterOpt("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
InunoTaishou Posted January 10, 2016 Posted January 10, 2016 (edited) How about for Firefox?Is this betterOpt("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 January 10, 2016 by InunoTaishou
xuzo Posted January 10, 2016 Author Posted January 10, 2016 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?
InunoTaishou Posted January 10, 2016 Posted January 10, 2016 (edited) ControlSend("[Class:MozillaWindowClass]", "", "", "{PGUP 6}")ShortenedYou can also do thisLocal $ctrlSend = ControlSend Local $hFireFox = WinGetHandle("[Class:MozillaWindowClass]") Local $sMsg = "{PgUp 6}" $ctrlSend($hFireFox, "", "", $sMsg)And if you want to get really generic with your programmingLocal $aArgs[] = ["CallArgArray", "[Class:MozillaWindowClass]", "", "", "{PgUp 6}"] Call(ControlSend, $aArgs) Edited January 10, 2016 by InunoTaishou
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now