Search found 16 matches

by XMB-7
03 Jun 2023, 22:51
Forum: 请求帮助
Topic: 如何获取输入光标的位置 Topic is solved
Replies: 4
Views: 1469

Re: 如何获取输入光标的位置 Topic is solved

@WKen 非常感谢提供思路.
另外我这边测试CaretGetPos, 无论在浏览器里还是vscode里都不行, 只有在系统自带的记事本里才好使, 这也太鸡肋了. 请问它背后也是通过搜索颜色来实现的么, 那针对不同窗口的光标只好设置不同的光标颜色?
by XMB-7
03 Jun 2023, 22:07
Forum: Ask for Help (v2)
Topic: Switch bug, CaseSense is invalid. Topic is solved
Replies: 3
Views: 657

Re: Switch bug, CaseSense is invalid. Topic is solved

Does the switch statement still use the v1 syntax? I only learned v2, and just thought anything that accepts arguments should be considered a function and all arguments can be enclosed in parentheses. If so, when implementing something like `switch(SwitchValue:=test_str, CaseSense:='Off')`, it would...
by XMB-7
03 Jun 2023, 12:21
Forum: Ask for Help (v2)
Topic: Switch bug, CaseSense is invalid. Topic is solved
Replies: 3
Views: 657

Switch bug, CaseSense is invalid. Topic is solved

!T:: { test_str := 'a' switch(SwitchValue:=test_str, CaseSense:='Off') { case 'a': MsgBox('1') case 'b': MsgBox('2') default: MsgBox('0') } } When triggering the above hotkey, 0 always pops up. Only with `CaseSense:='Off'` removed, 1 would pop up as expected. image.png [Mod action: Topic moved from...
by XMB-7
03 Jun 2023, 10:46
Forum: 请求帮助
Topic: 如何获取输入光标的位置 Topic is solved
Replies: 4
Views: 1469

如何获取输入光标的位置 Topic is solved

image.png 想知道有没有除了findtext之外的方法. 翻了翻文档, 找到了一个函数CaretGetPos, 以为能够返回输入光标的坐标, 但实际试了一下并不合预期, 而且也不知道它具体是干嘛的, 在哪里都显示No caret. !T:: { SetTimer WatchCaret, 100 WatchCaret() { if CaretGetPos(&x, &y) ToolTip "X" x " Y" y, x, y - 20 else ToolTip "No caret" } }
by XMB-7
01 Jun 2023, 01:39
Forum: 教程资料
Topic: FindText 深度教程 v1.2
Replies: 6
Views: 7904

Re: FindText 深度教程 v1.2

它将屏幕上抓取一个小图像转换成黑白图像(类似于 ASCII 艺术),然后再将黑白图像转换成单行文本。使用 FindText 时,它会截取屏幕截图,将屏幕截图中的每个像素也转换成黑白,然后尝试将抓取的图像与屏幕截图进行匹配。由于像素变成了黑白,要比较的次数要少得多(红、绿、蓝需要比较三次、黑白只需要比较一次),所以匹配速度要比 ImageSearch 快。

请问, 开篇的解释是不是有点小问题? 既然说是把图像转为字符串, 那我的理解是, findtext会把搜索目标以及搜索区域这两个图像都转为字符串然后进行字符串间的比对, 而不再是黑白像素之间的对比?
by XMB-7
27 May 2023, 10:57
Forum: Wish List
Topic: Designate `|` to the cursor location when implementing hotstring auto-replacement.
Replies: 4
Views: 912

Re: Designate `|` to the cursor location when implementing hotstring auto-replacement.

Thank you for your advice. Actually, I have already used a similar method you suggested. The example I provided was just a simplified version so that anyone can easily understand what I want to do. My intention was to highlight that automatic replacement is one of the most commonly utilized basic fe...
by XMB-7
27 May 2023, 09:30
Forum: Wish List
Topic: Designate `|` to the cursor location when implementing hotstring auto-replacement.
Replies: 4
Views: 912

Re: Designate `|` to the cursor location when implementing hotstring auto-replacement.

Yes, there are several ways to achieve this goal, but I think adding syntax sugar would be awesome since it is a very common use case. When using hotstring just to insert some text, there will always be a fixed part and another variable part that needs to be filled in after auto-replacement, like 'H...
by XMB-7
27 May 2023, 04:31
Forum: Wish List
Topic: Designate `|` to the cursor location when implementing hotstring auto-replacement.
Replies: 4
Views: 912

Designate `|` to the cursor location when implementing hotstring auto-replacement.

For example, when triggering `::/test::abc...xyzABC...XYZ`, I want the cursor to move automatically between z and A so that I can continue inserting content such as `123...789`. The workaround is like `:X:/test::Send('abc...xyzABC...XYZ{Left 26}')`, but I think `::/test::abc...xyz|ABC...XYZ` where `...
by XMB-7
14 May 2023, 01:51
Forum: 请求帮助
Topic: ahk能否控制鼠标手势软件
Replies: 1
Views: 736

ahk能否控制鼠标手势软件

比如使用MouseInc / WGestures, 设置鼠标手势-->触发ctrl+c, 我想知道能否通过ahk扩充它的功能, 比如按住alt同样绘制-->改为触发ctrl+v ?
或者ahk能否直接或通过第三方库来实现对鼠标手势的设置 ?
by XMB-7
21 Apr 2023, 10:22
Forum: 请求帮助
Topic: 如何在edge中屏蔽, 单击alt自动聚焦于edge下拉菜单按钮 Topic is solved
Replies: 3
Views: 1021

Re: 如何在edge中屏蔽, 单击alt自动聚焦于edge下拉菜单按钮 Topic is solved

感谢回复, 但可惜仍无效. 其实直接alt::return(alt up::return)无效, 就基本堵死正常方式了.
在edge里屏蔽别的键正常, 屏蔽alt不行, 感觉真的怪, 也不知道edge是怎么做到的.
by XMB-7
21 Apr 2023, 10:12
Forum: 请求帮助
Topic: 关于keywait疑惑 Topic is solved
Replies: 6
Views: 1143

Re: 关于keywait疑惑 Topic is solved

懂了, 原来跟触发alt up的机制不一样, 只要alt没被按下过, 就一直是keywait('alt')=true. 我刚刚还在想, 不先按下alt怎么松开alt啊, 突然就反应过来咋回事了. 感谢.
by XMB-7
21 Apr 2023, 06:27
Forum: 请求帮助
Topic: 如何在edge中屏蔽, 单击alt自动聚焦于edge下拉菜单按钮 Topic is solved
Replies: 3
Views: 1021

如何在edge中屏蔽, 单击alt自动聚焦于edge下拉菜单按钮 Topic is solved

近来由于使用newbing的chatgpt4, 开始主用edge浏览器, 但发现它有个毛病是, 单击alt会自动聚焦于浏览器的下拉菜单按钮, 如图所示. image.png 而这带来了一些麻烦, 一个应用场景举例如下, 在b站给视频做视频笔记, 光标正常聚焦于视频笔记窗口之中, 自定义alt+1是快退3s. 在视频播放的某一时刻, 我打算按alt+1快退一下重听细节, 手已经按上alt了, 但是随后发现视频接着做了解释, 我用不着快退了, 但此时再松开alt, 就会使得光标聚焦从视频笔记窗口转到edge下拉菜单按钮之上, 于是我就得被迫再用鼠标点回视频笔记窗口, 次数多了就有点搞心态. 请问怎...
by XMB-7
20 Apr 2023, 20:51
Forum: 请求帮助
Topic: 关于keywait疑惑 Topic is solved
Replies: 6
Views: 1143

Re: 关于keywait疑惑 Topic is solved

你还是没理解我意思, 我不是想知道怎么用keywait实现单双击设置, 毕竟官方文档上都有例子, 而且上面也说了更推荐使用settimer来实现, 我是想知道keywait的执行逻辑是什么.
我刚刚发现一个新例子, 这个例子可能更有代表性.

Code: Select all

~Control::
{
    if KeyWait('Alt')
        ToolTip('test')
}
明明需要等待alt, 但是按ctrl就显示test, 亦即keywait似乎永远返回true, 像是个bug.
by XMB-7
20 Apr 2023, 11:07
Forum: 请求帮助
Topic: 关于keywait疑惑 Topic is solved
Replies: 6
Views: 1143

Re: 关于keywait疑惑 Topic is solved

我是想区分单击和双击, 看了官方文档上的例子, 再实际简单测试了一下, 发现这个代码的执行逻辑好像有问题啊.
我预期的功能是, 按一次ctrl无响应, 按两次ctrl弹出提示框显示test, 但实际行为是按一次ctrl直接就弹出提示框了.
把control改成~control并不解决问题, 这个只是把识别ctrl释放改成识别ctrl按下了.
by XMB-7
20 Apr 2023, 00:53
Forum: 请求帮助
Topic: 关于keywait疑惑 Topic is solved
Replies: 6
Views: 1143

关于keywait疑惑 Topic is solved

Code: Select all

Control::
{
    if KeyWait('Control')
        ToolTip('test')
}
```
对这段测试代码, 我的理解是, 第一次按下ctrl, 松开ctrl时触发执行KeyWait('Control'), 开始等待第二次键击, 然后等第二次按下ctrl后, 才会显示出文本test.
但测试的实际行为是, 第一次按下并松开ctrl时, 就已经弹出显示框了, 根本不会等待第二次键击ctrl, 请问这是怎么回事?
by XMB-7
12 Apr 2023, 11:35
Forum: Ask for Help (v2)
Topic: How to batch import ahk scripts using 'Loop Files'? Topic is solved
Replies: 2
Views: 386

How to batch import ahk scripts using 'Loop Files'? Topic is solved

I'd like to import (using #include) multiple AHK scripts into one single script. However, the following code snippet reported an error that the '.../a_loopfilepath' file doesn't exist. Appreciate any guidance on this issue. base_dir := 'utils' Loop Files, (base_dir . '/' . '*.ahk'), 'R' { #Include A...

Go to advanced search