Jump to content

Why does this no longer working on recent AutoIt versions


FTS
 Share

Recommended Posts

I do have a problem with a script that I used for years. After migrating it

to Win7 using the latest version of AutoIt (3.3.6.1) it does no longer work

correctly.

The script moves the currently active window from screen1 to screen2 and

vice versa when using multiple display. Besides the necessary calculations

it 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 the

windows desktop. The executable can be invoked by a keyboard shortcut (in my

case ctrl+shift+T), which I added to the link by editing its properties

(right click, Properties, Shortcut Key). So, each time I use the shortcut

keys the currently active window moves from screen1 to screen2 and vice versa.

As I said. I've been using this for a long time (starting

WindowsXP, 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 the

shortcut key. The script itself works. I can launch it from within the

explorer. I had to go back to an old version of AutoIt (3.0.100) to get it working

again. All newer versions won't work.

Can everyone think of a reason why I see this behavior on newer versions of

AutoIt?

Thanks

Link to comment
Share on other sites

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,750

Using 3.0.102:

Msg1: ""

Msg2: (x,y,w,h): 0,1040,1920,40

It looks as if the latter is the position of the windows taskbar. Any ideas?

Link to comment
Share on other sites

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 by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
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

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

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 connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
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

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

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...