Ahk для mac os

AutoHotkey

Powerful. Easy to learn.

The ultimate automation scripting language for Windows.

Key Binds

Define hotkeys for the mouse and keyboard, remap keys or buttons and autocorrect-like replacements. Creating simple hotkeys has never been easier; you can do it in just a few lines or less!

What is AutoHotkey

AutoHotkey is a free, open-source scripting language for Windows that allows users to easily create small to complex scripts for all kinds of tasks such as: form fillers, auto-clicking, macros, etc.

Is it good for me?

AutoHotkey has easy to learn built-in commands for beginners. Experienced developers will love this full-fledged scripting language for fast prototyping and small projects.

Why AutoHotkey

AutoHotkey gives you the freedom to automate any desktop task. It’s small, fast and runs out-of-the-box. Best of all, it’s free, open-source (GNU GPLv2), and beginner-friendly. Why not give it a try?

A peek at the syntax.

AutoHotkey provides a simple, flexible syntax allowing you to focus more on the task at hand rather than every single little technicality. It supports not only the popular imperative-procedural paradigm, but also object-oriented and command-based programming.

Here are a few simple examples:

  1. Hotstrings & Hotkeys
  2. Clipboard example
  3. Short GUI
  4. Simple Array (or Objects)

Источник

Аналоги AutoHotkey для Mac OS

AutoHotkey (AHK) — это бесплатное программное обеспечение с открытым исходным кодом для создания макросов и автоматизации для Windows, которое позволяет пользователям автоматизировать повторяющиеся задачи. Он управляется языком сценариев, который изначально был нацелен на предоставление сочетаний клавиш, также называемых горячими клавишами, которые со временем превратились в полноценный язык сценариев.

Вы можете использовать AutoHotkey для:

1. Автоматизации практически всего, с помощью нажатия клавиш или щелчка мышью, или через COM.
2. Написания макроса для мыши или клавиатуры вручную, или с помощью рекордера.
3. Создания горячих клавиш для клавиатуры, джойстика и мыши.
4. Переназначения клавиши и кнопки на клавиатуре, джойстике и мыши.
5. Расширения аббревиатуры по мере их ввода.
6. Получения и изменения содержимого буфера обмена.

Вы также можете:

1. Конвертировать любой скрипт AHK в исполняемый файл, который можно запустить на компьютерах, где AutoHotkey не установлен.
2. Создавать пользовательские формы ввода данных, пользовательские интерфейсы и строки меню.
3. Автоматизировать задания по вводу данных, читая данные из текстовых файлов, XML, CSV, Excel и различных форматов базы данных.
4. Читать сигналы с ручных пультов дистанционного управления через клиентский скрипт WinLIRC.
5. Использовать объектную модель компонентов (COM).
6. Использовать массивы, структуры, матрицы и объекты.
7. Использовать вариадические функции.
8. Использовать вызовы DLL и сообщения Windows.
9. Использовать Perl-совместимые регулярные выражения (PCRE).
10. Использовать интерактивные функции отладки.

Источник

ascendbruce / README.md

Use (most) macOS style keyboard shortcuts on Windows

Читайте также:  Журналы событий windows server 2016

Make Windows PC’s shortcut act like macOS (Mac OS X)

With this AutoHotKey script, you can use most macOS style shortcuts (eg, cmd+c, cmd+v, . ) on Windows with a standard PC keyboard.

  1. you shouldn’t change the modifier keys mapping with keyboard DIP. This script assumes you use a standard PC keyboard layout, and wish to use shortcuts as if it was a mac keyboard layout.
  2. To use cmd + shift + ↑ / ↓ / ← / → (select text between cursor and top / bottom / beginning of line / end of line), You should disable the Between input languages shotcut from Control Panel\Clock, Language, and Region\Language\Advanced settings > Change lanugage bar hot keys due to conflicting.
  3. Some Windows built-in keyboard shortcuts will be overridden. For example: win + ↑ / ↓ / ← / → (snap window to side). Change mac.ahk accordingly if you prefer to keep the default behavior.

Here’s some examples of how this script work:

you want to press what you’re actually pressing AutoHotKey tells Windows
cmd + c alt + c ctrl + c
cmd + v alt + v ctrl + v
cmd + r alt + r F5
cmd + ↑ alt + ↑ Home
cmd + shift + [ alt + shift + [ ctrl + shift + Tab
. . .

To Run Once (until reboot)

  1. Install https://www.autohotkey.com/
  2. Copy and save the content of mac.ahk in a text file, named as mac.ahk
  3. Double click on mac.ahk file

Auto start after Windows startup

Place mac.ahk file (or make a shortcut) at C:\Users\ \AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir % A_ScriptDir % ; Ensures a consistent starting directory.
; Docs:
; https://autohotkey.com/docs/Hotkeys.htm
; https://autohotkey.com/docs/KeyList.htm
; Ref https://autohotkey.com/board/topic/60675-osx-style-command-keys-in-windows/
; You need to disable «Between input languages» shotcut from Control Panel\Clock, Language, and Region\Language\Advanced settings > Change lanugage bar hot keys
; Universal shotcuts
$!x :: Send ^ x
$!c :: Send ^ c
$!v :: Send ^ v
$!s :: Send ^ s
$!a :: Send ^ a
$!z :: Send ^ z
$!+z :: Send ^ y
$!w :: Send ^ w
$!f :: Send ^ f
$!n :: Send ^ n
$!q :: Send !
$!r :: Send ^
$!m :: Send < LWin Down >
$!` :: Send < Alt Down > < Shift Down >
; Quick Switch Tab shotcuts
$!1 :: Send ^ 1
$!2 :: Send ^ 2
$!3 :: Send ^ 3
$!4 :: Send ^ 4
$!5 :: Send ^ 5
$!6 :: Send ^ 6
$!7 :: Send ^ 7
$!8 :: Send ^ 8
$!9 :: Send ^ 9
$!0 :: Send ^ 0
; Chrome shotcuts
$!t :: Send ^ t
$!+t :: Send ^+ t
$!+] :: Send < Ctrl Down > < Tab Down >
$!+[ :: Send < Ctrl Down >< Shift Down >< Tab Down > < Tab Up >
$!l :: Send ^ l
; input methods
; $+. Send ^,
; $+. Send ^.
; navigation, selection, delete a word/till end
$!Left :: Send
$!Right :: Send
$!Up :: Send < Lctrl down >
$!Down :: Send < Lctrl down >
$#Left :: Send < ctrl down >
$#Right :: Send < ctrl down >
$#+Left :: Send < ctrl down >< shift down > < Left >
$#+Right :: Send < ctrl down >< shift down > < Right >
$!+Left :: Send < shift down >
$!+Right :: Send < shift down >
$!+Up :: Send < Ctrl Down >< shift down > < Home >
$!+Down :: Send < Ctrl Down >< shift down > < End >
!BS :: Send < LShift down > < Home >
#BS :: Send < LCtrl down >
$#Space :: Send < Ctrl Down > < LWin Down >

This comment has been minimized.

Copy link Quote reply

Veronika-Kot commented Sep 21, 2018

Universal shotcuts started working for me only after I replaced $!x::Send ^x with $#x::Send ^x (replaced ! with #).
Haven’t tried other shortcuts.

This comment has been minimized.

Copy link Quote reply

dorlyneto commented Jan 14, 2019

Thank you so much! Works without any problem. 😀

This comment has been minimized.

Copy link Quote reply

edoardoc commented Jun 28, 2020

this is the closest I could get, thank you.

PS: I am running this with a pre-code to run the ahk in admin mode, I read that it sorts out some compatibility problems in win10, what do you think?

This comment has been minimized.

Copy link Quote reply

DannyDannyDanny commented Feb 15, 2021

Previously I would use the winkey to snap windows around on screen:

They no longer work — is there an easy workaround? 👍

This comment has been minimized.

Copy link Quote reply

ascendbruce commented Feb 16, 2021

Hi @DannyDannyDanny, I guess it might be conflicting with one of the Left/Right/Up/Down config group between line 58-71, but I don’t have Windows PC with me right now. Could you try disabling those lines and re-run the script?

This comment has been minimized.

Copy link Quote reply

DannyDannyDanny commented Feb 16, 2021

You are right! Deleting lines L58-end resolved the arrow-key issues. I can now snap windows and use arrows to change selection the the window navigator (win: alt-tab). There’ll be some consequences of deleting those lines. So far I haven’t figured out whats missing. Thanks @ascendbruce! 🥇

This comment has been minimized.

Copy link Quote reply

Aghyads commented Apr 17, 2021

#$! can you please explain what does each of these represent in. I want to make changes, but I’m not sure

This comment has been minimized.

Copy link Quote reply

ascendbruce commented Apr 19, 2021 •

Hi @Aghyads, you can find their meanings in AutoHotKey’s official doc, under the «Keys and their mysterious symbols» section: https://www.autohotkey.com/docs/Tutorial.htm#s21

And for $ , it’s a Hotkey Modifier Symbols, you can find the usage here: https://www.autohotkey.com/docs/Hotkeys.htm#Symbols

This comment has been minimized.

Copy link Quote reply

tornikenats commented Apr 19, 2021

For some reason #BS::Send doesn’t work. I’ve tried different symbols for backspace like BackSpace and BACKSPACE but it doesn’t work. It only deletes one character instead of a word.

This comment has been minimized.

Copy link Quote reply

ascendbruce commented Apr 20, 2021

Hi @tornikenats, maybe also try:

If that works, I will update the gist. But I don’t have a windows machine with me right now.

This comment has been minimized.

Copy link Quote reply

tornikenats commented Apr 20, 2021

Hi @ascendbruce, everything works, it was another one of the lines I added that broke it. Feel free to delete my comment to reduce noise.

This comment has been minimized.

Copy link Quote reply

Aghyads commented Apr 27, 2021

@ascendbruce, dear, do you know how I can create the move forward/ redo shortcut.
It is not working on Microsoft office programs.
here is my script:

#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.

; You need to disable «Between input languages» shotcut from Control Panel\Clock, Language, and Region\Language\Advanced settings > Change lanugage bar hot keys

; Universal shotcuts
^q. F4
#q. F4

; Quick Switch Tab shotcuts

; navigation, selection, delete a word/till end

to move up a folder in Explorer
#IfWinActive, ahk_class CabinetWClass
`::Send !
#IfWinActive
return

; Empty trash
^del::FileRecycleEmpty ; win + del
return

^h::WinMinimize, A ; Ctrl+Down
return

^F19::
DllCall(«PowrProf\SetSuspendState», «int», 0, «int», 0, «int», 0)
Return

Источник

Ahk для mac os

Unfortunately AutoHotkey cannot be used in macOS. In terms of ease of use vs complexity and capability, have a look at 2 built-in programs — Automator and AppleScript. After the debacle of Windows 10 I’m trying to wean myself off Windows now in favour of macOS (and Linux Mint Cinnamon) and have just started getting used to Automator first. drag’n’drop automation.

Hope this helps.

Re: Autohotkey for Mac

I am moving from Mac to Windows, because I have to (job related)

Automator is the natural choice in Mac , but it does not work inside the applications (like AHK can). For mac, there is the open-osource kantu desktop automation — it works quite differently then AHK, but does the same: autoamte mouse and keyboard

Re: Autohotkey for Mac

Re: Autohotkey for Mac

Re: Autohotkey for Mac

That sounds like a Transpiler or Source-to-Source Compiler, https://en.wikipedia.org/wiki/Source-to-source_compiler. Many other programming languages make use of such. It’s interesting that this isn’t being done for AutoHotkey. I don’t know how well Lua works out as a cross-platform language. C#, Object Pascal, or Red would be good cross-platform candidates as well.

I think the other part of the issue is mindset. The thinking that AutoHotkey code must be married to C++ and Windows, instead of thinking of AutoHotkey as it’s own language that could use other interpreters, written in other programming languages.

Re: Autohotkey for Mac

A quick, read-worthy post from lexikos explaining some of this conundrum:

Additionally, it appears users in the past have ran Bootcamp and/or Parallels on their Macs to utlilize AutoHotkey — with success. The posts I have seen around the net do not appear to be doing any complex/advanced AHK programming, however, mostly doing simple key remapping as far as I can tell.

Would be awesome if someone could do some testing in this area to see what does/doesn’t work. It seems like from lexikos’ post that everything should work though. When I have some free time I may do some testing myself and report back

Re: Autohotkey for Mac

Usually the issues presented about AutoHotkey being on a different OS has been the Windows APIs and Dlls, where the code needs to be different for that OS. However, to make this a bit more complicated, there is WINE (https://en.wikipedia.org/wiki/Wine_(software). Open-source software that provides a Windows runtime enviornment for running applications on Linux and Macs. WINE has been discussed a number of times on the forums, example- https://www.autohotkey.com/boards/viewtopic.php?t=25741 (AHK installer under Linux/WINE).

From that forum post about the installer, what we are getting is that the present AutoHotkey developers are very Windows centric and lack any motivation to create a cross-platform version of AutoHotkey. And because they are so Windows centric, this can result in development choices that makes the AutoHotkey source code even harder to port over to a different OS. Though let’s keep in mind that the Windows OS still holds a huge user base. The present AutoHotkey C++ interpreter, installer, etc. would have many «landmines», that I believe a person or a group would have no choice but to create a new fork (think IronAHK in C# as an example) or transpiler.

A person or group would likely have to focus on «translating» the AutoHotkey scripting language (not the C++ source code), and create a new interpreter. Preferably one in a more cross-platform friendly language (in terms of tools available), thus the suggestion of C#, Object Pascal, or Red. C# probably being a bit more easier for those that know C++ to adapt to, where Object Pascal is as almost as close to the hardware as C++, but has more cross-platform friendly tools (Lazarus, FPC, etc. ). Object Pascal also has some AutoHotkey-like automation tools, such as Simba (often use for making bots) and WinAutoKey (so far a bit limited), that can provide example code. Red being more of a wildcard with future potential.

Going the way of the transpiler, would be more about translating the AutoHotkey scripting language into a compiled equivalent into another programming language. An interpreter would be running AutoHotkey in a way similar to how it runs on Windows, where a transpiler would be more specific to creating an application that could run on a different OS.

Though interestingly, it’s not really known how far or what is the limit that somebody could get with AutoHotkey and WINE. Though I would think to make significant progress, it would likely turn into a fork.

Источник

Читайте также:  Changing disk label linux
Оцените статью