簡體   English   中英

autohotkey不適用於CarbonPoker應用程序

[英]autohotkey not working for CarbonPoker application

我已經在其他窗口(例如計算器)上測試了我的腳本(因此這不僅是我的腳本的問題),但是當我運行CarbonPoker應用程序時,表格窗口將不會移動。 我可以激活該窗口,並且可以獲取標題並使用MsgBox顯示,但無法移動它。

我試過了

WinMove,0,0

我已經嘗試過

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

我已經嘗試過

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

是否有一些無法移動其窗口的應用程序? 還是有一種方法可以繼續用於此類應用? 謝謝。

代碼已更新。 現在,如果窗口與其他窗口重疊,則可以移動它。 還為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.

我盡可能地注釋了代碼,但是如果您有任何問題,請隨時提出。

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

接下來,您可以嘗試使用hwnd代替標題:

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

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM