2014-07-17 82 views
0

我已經在其他窗口上測試過我的腳本,例如計算器(所以它不僅僅是我的腳本的問題),但是當我運行CarbonPoker應用程序時,表窗口贏得了'移動。我可以激活窗口,我可以得到標題並用MsgBox顯示,但我無法讓它移動。autohotkey不適用於CarbonPoker應用程序

我已經試過

WinMove,0,0 

,我已經試過

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

,我已經試過

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

是否有不能有窗戶有些應用感動?還是有辦法仍然爲這樣的應用程序做?謝謝。

+0

而且溫格特OutputVar被置空,或者如果我用這個另一種方法:UniqueID的:= WinActive(%標題%),那麼的UniqueID爲0x0 – user2278448

+0

嘗試'UniqueID:= WinExist(標題)' –

+0

您是否檢查過任何答案?他們是否爲你工作? – vasili111

回答

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. 

我註釋掉的代碼儘可能的,但如果你有任何問題隨時問。

0

首先,如果您的其他應用程序以管理員身份運行,那麼您的腳本也需要以相同的管理員權限運行。我會先檢查一下。

接下來,你可以嘗試使用HWND,而不是標題:

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

f3:: 
    MouseGetPos,,, hwnd 
    WinMove, ahk_id %hwnd%,, 0, 0 
return 
相關問題