FTS Posted August 19, 2011 Share Posted August 19, 2011 I do have a problem with a script that I used for years. After migrating itto Win7 using the latest version of AutoIt (3.3.6.1) it does no longer workcorrectly. The script moves the currently active window from screen1 to screen2 andvice versa when using multiple display. Besides the necessary calculationsit is basically doing a WinMove("","",0,0)(x,y) are 0 for the sake of this example.After compiling the script I created a shortcut to the executable on thewindows desktop. The executable can be invoked by a keyboard shortcut (in mycase ctrl+shift+T), which I added to the link by editing its properties (right click, Properties, Shortcut Key). So, each time I use the shortcutkeys the currently active window moves from screen1 to screen2 and vice versa.As I said. I've been using this for a long time (startingWindowsXP, AutoIt2.0). It used to work just fine.After installing the latest AutoIt on windows7 it stopped working. It seems as if the focus gets removed from the active window everytime I hit theshortcut key. The script itself works. I can launch it from within theexplorer. I had to go back to an old version of AutoIt (3.0.100) to get it workingagain. All newer versions won't work. Can everyone think of a reason why I see this behavior on newer versions ofAutoIt?Thanks Link to comment Share on other sites More sharing options...
JohnOne Posted August 19, 2011 Share Posted August 19, 2011 Best to look at script breaking changes, see if they apply to any part of your whole script. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
FTS Posted August 19, 2011 Author Share Posted August 19, 2011 The change that broke my script happend in release 3.0.102. I've looked through the changelog for this release but couldn't see anything that looked suspicous.Here is a little code snipped that bahaves differently using the shortcut key scenario described in my original post.$size=WinGetPos("") $title=WinGetTitle("")MsgBox(0,"Active Window Title", $title)MsgBox(0,"Window position:","(x,y,w,h): " & $size[0] & "," & $size[1] & "," & $size[2] & "," & $size[3])Current window: Explorer (Folder AutoIt):Using 3.0.101: Msg1: Autoit Msg2: (x,y,w,h): 627,287,1200,750Using 3.0.102: Msg1: "" Msg2: (x,y,w,h): 0,1040,1920,40It looks as if the latter is the position of the windows taskbar. Any ideas? Link to comment Share on other sites More sharing options...
bogQ Posted August 19, 2011 Share Posted August 19, 2011 (edited) did you try to use HotKey func from autoit instead "which I added to the link by editing its properties ", we dono if there is anything in your code that can mess things up because you did not geave code that can replicate problem. (well at leasn formy xp i cant) you did probably create your script to fit latest version and post heare small script that will work and will recreate problem but its had to beleave that it dont work. edit: try to use "[ACTIVE]" instead of "" who knows, basicly "" shud detect active win but i dono what will happend if you have win with no name. or use winactivate before takeing coordinates, or using title instead of "" ? whats your goal, only to detect any window that is active using the key combination or to detect specific win position? HotKeySet("^+t","test") While 1 Sleep(10) WEnd Func test() $hwnd = WinGetHandle("[ACTIVE]") $size=WinGetPos($hwnd) $title=WinGetTitle($hwnd) MsgBox(0,"Active Window Title", $title) MsgBox(0,"Window position:","(x,y,w,h): " & $size[0] & "," & $size[1] & "," & $size[2] & "," & $size[3]) EndFunc Edited August 19, 2011 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
FTS Posted August 19, 2011 Author Share Posted August 19, 2011 Thanks for your help. Using the hotkey function works. The only disadvantage to my method is, that the script has to run in the background. I think I can live with it. You said, you cannot reproduce the issue in xp? I don't have access to an XP machine anymore. Are you basically saying that the example I gave earlier, works in XP even with a recent AutoIt version? Link to comment Share on other sites More sharing options...
bogQ Posted August 19, 2011 Share Posted August 19, 2011 well i hope its a ricent, after i post that msg you reminded me to update autoit version on this comp on my work ^^ but did not make note what version it whas. btw you can set tryicon to hide using if you cant leave with it, put Opt("TrayIconHide", 1) on top of your sctip. dont forget to set some hotkey combination to exit your script if needed because youl not b able to exit easy if your tray icon isnt there. TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
FTS Posted August 19, 2011 Author Share Posted August 19, 2011 Thanks again for your suggestions. I followed the examples given in the AutoIt help and added a message handler to get rid of the sleep. I also added an exit option in the TrayMenu. Everything works quite well now. Thanks! 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