autohotkey不适用于CarbonPoker应用程序

时间:2014-07-17 14:25:59

标签: automation autohotkey

我已经在其他窗口上测试了我的脚本,例如计算器(所以它不仅仅是我的脚本的问题),但是当我运行CarbonPoker应用程序时,表格窗口不动。我可以激活窗口,我可以获得标题并使用MsgBox显示它,但我无法移动它。

我已经尝试了

WinMove,0,0

我已经尝试了

WinGetTitle, Title, A
WinMove,ahk_id %Title%,, %xval%,%yval%,%width%,%height%

我已经尝试了

WinMove,%Title%,, %xval%,%yval%,%width%,%height%

是否有些应用程序无法移动窗口?或者有没有办法继续为这样的应用程序做?感谢。

2 个答案:

答案 0 :(得分:0)

代码已更新。现在,如果窗口与其他窗口重叠,则可以移动窗口。还为WinTitle添加了变量。

您也可以尝试以其他方式移动窗口:

CoordMode, Mouse, Screen ;sets coordinate mode relative to screen.

DestX:=200 ; the x coordinate of the point where you want to see left upper point of window.
DestY:=10 ; the y coordinate of the point where you want to see left upper point of window.
WinTitleVar:="Notepad" ; The part of WinTitle of window that we need to move.

;Here are shift variables. What they meen? You cant just drug by left upper corner of window. You need to shift slightly right and down to be able to drag window. That variables are giving that shift to your coordinates.
ShiftX:= 30 ; shift for x coordinate.
ShiftY:= 10 ; shift for y coordinate.

DestX:= DestX + ShiftX ; apply shift to DestX .
DestY:= DestY + ShiftY ; apply shift to DestY .

SetTitleMatchMode, 2 ; Whith that command a window's title can contain WinTitle anywhere inside it to be a match. It is for WinGetPos command. You can remove this command, but then you need to use exact title in WinGetPos command.
WinGetPos, InitX, InitY,,, %WinTitleVar% ; get current upper left position of notepad window.
InitX:= InitX + ShiftX ; apply shift to InitX .
InitY:= InitY + ShiftY ; apply shift to InitY .

WinActivate, %WinTitleVar% ; Activates Window. This command is here in cases if other window overlaps the window that we need to move.
Click, Left, Down, %InitX%, %InitY% ; Click the left button but dont release it at the shifted coordinates of current window location. 
MouseMove, %DestX%, %DestY% ; Move mouse to the shifted destination coordinates.
Click, Left, Up ; Release Left mouse button.

我尽可能地评论了代码,但如果您有任何问题可以随意提问。

答案 1 :(得分:0)

首先,如果您的其他应用程序以管理员身份运行,那么您的脚本也需要使用相同的管理员权限运行。我会先检查一下。

接下来,您可以尝试使用hwnd而不是标题:

; hover mouse over the window, and press f3 to move window

f3::
   MouseGetPos,,, hwnd
   WinMove, ahk_id %hwnd%,, 0, 0
return