繁体   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