AutoHotKey

Determine if string exists in file

故事扮演 提交于 2019-12-02 17:49:07
问题 I have a list of strings such as: John John Doe Peter Pan in a .txt file. I want to make a loop that checks if a certain name exists. However, I do not want it to be true if I search for "Peter" and only "Peter Pan" exists. Each line has to be a full match. 回答1: Ha ha, ep0's answer is very sophisticated! However, you want to use a parsing loop something like this (this example expects that your names are separated by carriage returns). Consider that you have a text file with contents arranged

Python for Autohotkey style key-combination sniffing, automation?

血红的双手。 提交于 2019-12-02 16:52:41
I want to automate several tasks (eg. simulate eclipse style ctrl - shift - R open dialog for other editors). The general pattern is: the user will press some key combination, my program will detect it and potentially pop up a dialog to get user input, and then run a corresponding command, typically by running an executable. My target environment is windows, although cross-platform would be nice. My program would be started once, read a configuration file, and sit in the background till triggered by a key combination or other event. Basically autohotkey. Why not just use autohotkey? I actually

HotKey or Auto-Expansion for Interpolated Strings in VS

蓝咒 提交于 2019-12-02 16:50:15
问题 I want to save myself a few keystrokes when typing C# interpolated strings in VS 2015/2017. From what I can see, there isn't any built in functionality for this. Somewhat related question here: Automatic interpolated strings I'm settling on an AHK script for now that makes ctrl+[ a hotkey for this in VS. I'm wondering if anyone knows of a better way? #SingleInstance force #IfWinActive, ahk_exe devenv.exe ^[:: SendInput,$" I also considered the script below to directly expand the typing of $ ,

How can I send keyboard input to a OpenGL/DirectX game window?

你说的曾经没有我的故事 提交于 2019-12-02 13:44:39
How can I simulate a keypress in a game window (using any programming language in Windows)? AutoHotKeys Scripts and .NET SendKeys functions do not work... Using AutoIt!3 (which is quite similar to AutoHotKeys), you'd use Send() ( http://www.autoitscript.com/autoit3/docs/functions/Send.htm ), but make sure to have the game window active ( WinActivate() ) before you do. I've used this to interact with Second Life (which uses OpenGL) succesfully. You may require a Sleep() period between simulated key presses, since not all games implement good keyboard buffers. If this doesn't work, the game is

How can I get the pixel data from an area of the screen (much) faster in AHK?

人盡茶涼 提交于 2019-12-02 08:56:44
问题 I understand that for some things it would be better to write certain things in C++, but I'd really like to be able to do this in AHK: I want to be able to retrieve the pixel data from a 100x300 area of the screen, however PixelGetColor is way too slow. Here's a test demonstrating that it takes about 0.02 seconds per pixel, which is roughly 11.5 hours to get the pixel data from an entire 1920 x 1080 screen. In the test, it'll take about 4-5 seconds just to get the pixel data from a 15 x 15

Autohotkey Replace 2 specific character with one

元气小坏坏 提交于 2019-12-02 08:27:33
I am beginner with autohotkey. I wanted make script which checks if I write ":)" and then it replaces with this "😊" (emoji in web.whatsapp) I dont know if it's possible to do using GetKeyState because in my keyboard I need Shift+dot for ":" and Shift+9 for ")". I am sorry about my bad english. Hope you understand. :) Thank you. Code that works (thank Forivin) :::):: clipSave := ClipboardAll Clipboard := "😊" ; Send, ^v Clipboard := clipSave Return :::D:: clipSave := ClipboardAll Clipboard := "😂" ; Send, ^v Clipboard := clipSave Return This works for me: :::):: clipSave := ClipboardAll Clipboard

SendInput won't work at high speed

雨燕双飞 提交于 2019-12-02 08:06:46
I have made a shortcut saying "alt j" goes one left with the arrows, like this: !j::SendInput,{LEFT} This works fine, except if I hold down "alt j" for too long. It will work fine most of the time but occasionally dropping small "j"s around the path im going. Say i Wanna go one letter at a time, through this sentence: "Hello world" it'll most likely become something like this: "jHeljjlo jworljd" Is there a way to put a tiny delay on every keystroke to make it able to keep up? or is this problem related to a default delay which has to be set down maybe? Thanks for your help! So this is still an

HotKey or Auto-Expansion for Interpolated Strings in VS

拟墨画扇 提交于 2019-12-02 07:51:32
I want to save myself a few keystrokes when typing C# interpolated strings in VS 2015/2017. From what I can see, there isn't any built in functionality for this. Somewhat related question here: Automatic interpolated strings I'm settling on an AHK script for now that makes ctrl+[ a hotkey for this in VS. I'm wondering if anyone knows of a better way? #SingleInstance force #IfWinActive, ahk_exe devenv.exe ^[:: SendInput,$" I also considered the script below to directly expand the typing of $ , but this would hinder the typing of $ on its own. #SingleInstance force #IfWinActive, ahk_exe devenv

大才小用: 用AutoHotkey实现WIN8下输入法切换快捷键Ctrl+Space[转]

こ雲淡風輕ζ 提交于 2019-12-02 06:35:19
我的下载: http://pan.baidu.com/s/1kT5FXwr 不放心的到官方网站下载源代码编译。 我想大部分人都习惯用“Ctrl+空格”来切换中文输入和英文输入,但你升级到蛋疼的 WIN8 后,你会发现这个键没用了…… 如果你平时基本都是用中文倒还是很容易习惯,用“shift”切换中文输入法为“输入英文”即可,但是如果你是敲代码一族,那么 Shift 键算是常用键,蛋疼的事就发生了:例如 1. 临时输入大写字母 A: shift + A,然后你不小心先按了下 shift,那么这时就变成中文输入了……囧 2. 敲代码过程中需要经常敲标点符号,如 "" 然后你不小心按了下 shift 键,就变成中文标点符号了……囧 ... 有朋友说可以设置为 ctrl 键啊,其实,平时使用中 ctrl 键也经常使用,总是会无意中按了……因为 WIN8 的输入法是“全局”的……(当然可以设置为独立,但也还是一样问题) 反正不管怎么说不方便……自从升级到 WIN8 后我一直被这个虐待,敲代码差点崩溃摔桌…… AutoHotkey 是啥我就不介绍了,不知道的朋友自己搜一下吧,我在这里只是借用它强大的功能的一个小功能“键盘映射”来实现 WIN8 下 Ctrl+Space 切换中英文输入法。 逆天的 WIN8 下输入法切换问题我上篇文章《 WIN8下输入法切换问题: 勉强解决

hak的使用

邮差的信 提交于 2019-12-02 05:48:33
autohotkey 简称ahk    它是一款轻量级的脚本语言文件,它可以干任何事情,如做dnf的连发脚本,类似按键精灵的自动化点击,按键自动打开文件一系列事情,文件需要按照ahk自己的语言,实现自定义的脚本宏 https://www.autohotkey.com/ 下载 http://ahkcn.sourceforge.net/docs/AutoHotkey.htm 使用操作 个人定义的代码 ;replace CapsLock to LeftEnter; CapsLock = Alt CapsLock $CapsLock::Enter LAlt & Capslock::SetCapsLockState, % GetKeyState("CapsLock", "T") ? "Off" : "On" !u::Send ^c !{tab} ^v; ;######################################### ; 键盘控制鼠标 # ;######################################### ; MouseMove, X, Y [, Speed, R] ; 鼠标移动的目标位置的 x/y 坐标, 可以为 表达式. 坐标相对于活动窗口 ; Speed ; 移动鼠标的速度,介于 0(最快)和 100(最慢)之间,可以为表达式。 ; 注:速度为 0