trids Posted September 13, 2006 Share Posted September 13, 2006 How do I Send() or ControlSend() a string back to an application that launches a script? The application is a Multi Document Interface (MDI) .. in this case TextPad. The script is meant to lookup a word in an INI file, matching the currently selected word in TextPad, and display the results in a listbox. The user then selects an item from the listbox, to send back to TextPad. I have everything working up to where I have to send results back to TextPad (see attached script if necessary).TextPad can provide all sorts of interesting contextual values when calling the script, including: $SelWord-- The word containing the cursor. I'm using this in the script to lookup values in an INI file$AppWnd-- The handle of the main application window. This is a decimal number. $DocWnd-- The handle of the active document's window. This is a decimal number. I sense that the answer is very simple .. I just can't see it I'm not itching to use $AppWnd or $DocWnd .. I'd be happy to somehow reactivate the last active window and just Send() there, if I could!Any ideas?TIASQL_popup.zip Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 13, 2006 Moderators Share Posted September 13, 2006 Have you gandered at the Std*() + ConsoleWrite() functions ? Might be as easy as the 2 of them catching what the other is doing, and the one updating itself. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
trids Posted September 13, 2006 Author Share Posted September 13, 2006 Thanks Smokey, but the ConsoleWrite() ends up in a special window within TextPad .. not the document currently open. And there doesn't seem to be a way to get the results of the Std*() functions into the current document either. First prize would be some way to reactivate the last window beneath the script, so I can simply Send() the string back to it wherever the cursor is. Fallback option is to have the script ClipPut() the string, then leave it to the user to Paste it into TextPad .. but this is very clunky and unbefitting of an AU3 script Any more ideas? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 13, 2006 Moderators Share Posted September 13, 2006 Thanks Smokey, but the ConsoleWrite() ends up in a special window within TextPad .. not the document currently open. And there doesn't seem to be a way to get the results of the Std*() functions into the current document either. First prize would be some way to reactivate the last window beneath the script, so I can simply Send() the string back to it wherever the cursor is. Fallback option is to have the script ClipPut() the string, then leave it to the user to Paste it into TextPad .. but this is very clunky and unbefitting of an AU3 script Any more ideas? You probably couldn't make heads or tails of this, I'm exhausted, but I tried to make it to where I understood what you were asking._LaunchNextAu3('AtSciptPath\ScriptName.au3') Func _LaunchNextAu3($hNextAu3) Local $hWnd = WinGetHandle('');Get the handle of the window your working in Local $sCID = 'Edit1' ; ClassNameNN of Control To be read Run(@AutoItExe & ' /AutoIt3ExecuteScript ' & $hNextAu3 & ' ' & $hWnd & ' ' & $sCID, '', @SW_HIDE) EndFunc ;~======================= Au3 launched ============================ ;Next Au3 Global $hWnd, $sCID, $sCIDText If $cmdline[0] Then $hWnd = $cmdline[1] $sCID = $cmdline[2] $sCIDText = ControlGetText($hWnd, '', $sCID) EndIf ;Do my thing ;Now set the text of the entire control before exit $allNewInfo = $sCIDText & ' all the new stuff I would set' ControlSetText($hWnd, '', $sCID, $allNewInfo) This is all based on both scripts being .au3's or at least your own Au3.exe's Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
trids Posted September 13, 2006 Author Share Posted September 13, 2006 Woo-hoo! Solved I was trying things like the following (where $hWndSend is TextPad's $DocWnd):WinActivate( $hWndSend ) Send( $sSend ) oÝ÷ Ûbrbv}ý· +¶§!جrÞç¢Z+£M4Ñ÷쥩ì·)^ I'll keep your _LaunchNextAu3 UDF in mind, Smokey, when I want to communicate between scripts. But for communicating back to a non-script app that launches a script, it wasn't quite what I was after. But thanks for trying! Link to comment Share on other sites More sharing options...
jftuga Posted September 14, 2006 Share Posted September 14, 2006 I am glad I read this post. I was having a similar problem (with Outlook) a while ago but never found a solution. Maybe I will retry it when I have the time. -John Admin_Popup, show computer info or launch shellRemote Manager, facilitates connecting to RDP / VNCProc_Watch, reprioritize cpu intensive processesUDF: _ini_to_dict, transforms ini file entries into variablesUDF: monitor_resolutions, returns resolutions of multiple monitorsReport Computer Problem, for your IT help deskProfile Fixer, fixes a 'missing' AD user profile Link to comment Share on other sites More sharing options...
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