dms Posted October 17, 2005 Share Posted October 17, 2005 I have a script which provides some hotkeys to jump to various apps people are running on their desktop. I've already got hold of the window handles on creation, so I can jump to them when someone types in the correct hotkey sequence. Now I'd like to do the same when someone clicks on a section of a powerpoint slide. I can see how to run a script to do the same, but what is the best way of passing the handle from the main script to these others that may run at any time? I'm sort of thinking saving the handle in an environment variable and then reading that back and using it, but I'm very open to other ideas Link to comment Share on other sites More sharing options...
/dev/null Posted October 17, 2005 Share Posted October 17, 2005 I'm sort of thinking saving the handle in an environment variable and then reading that back and using it, but I'm very open to other ideasThis question has been asked in the forum. Just search for "+environment +parameter". There are at least three ways to solve yout problem.1.) Write them to a config / INI file2.) Write them to the registry3.) Use environement variablesI'd prefer the registry.CheersKurt __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
dms Posted October 17, 2005 Author Share Posted October 17, 2005 Thanks for the prompt response. I guess my question is more specifically to do with passing window handles between scripts. The docs say these handles are not strings or numbers. I have to use handles because the apps I use have the same window names and also because at various points the windows change their titles. So I've tried to write a reg variable out and back in but something seems to be happening to transform it. In the enclosed test sample shows what I mean $Outlook = WinGetHandle("Inbox - Microsoft Outlook") ; Save handle so we can use it later RegWrite ("HKEY_CURRENT_USER\SOFTWARE\Mine","Email","REG_SZ",$Outlook) ... later ... msgbox (4096,"Handle is ", $Outlook) $Outlook = RegRead("HKEY_CURRENT_USER\SOFTWARE\Mine","Email") msgbox (4096,"Handle is ", $Outlook) If $Outlook <> "" and winexists ($Outlook) Then winactivate ($Outlook) Else If I comment out the ReadReg, the fragment indeed activates my outlook window. Allow the ReadReg to run and it fails to find the window. Both msgboxes produce exacly the same value on inspection, so I'm thinking these special windows handles need special handling. I get the same results with REG_BINARY as well So any thoughts on passing these handles between different scripts?? Link to comment Share on other sites More sharing options...
DaleHohm Posted October 17, 2005 Share Posted October 17, 2005 In recent betas, there is a new HWnd statement that converts a variant into an HWnd. I did a quick test and I think you should be able to convert your HWND to a string, store it in the registry or where ever, read it back and convert it back into an HWND. If you original HWND value is stored in $hHwnd, then in the code below, $hHwnd and $hHwnd2 should be identical:$sHwnd = String($hHwnd) $hHwnd2 = HWnd($sHwnd) Dale PoojaKrishna 1 Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
dms Posted October 18, 2005 Author Share Posted October 18, 2005 That worked like a dream - many thanks Link to comment Share on other sites More sharing options...
Skruge Posted October 19, 2005 Share Posted October 19, 2005 Glad you found a solution. If your scripts create GUIs, you could also use GUICtrlCreateDummy and GUICtrlSendToDummy to exchange data. [font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font] 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