Git Product home page Git Product logo

2nd-keyboard's Introduction

2nd-keyboard

ALL of Taran's scripts - (not just for the 2nd keyboard.)

IF YOU ARE NEW TO AUTOHOTKEY, AND WANT TO USE IT FOR VIDEO EDITING, START BY WATCHING THIS FULLY COMPREHENSIVE TUTORIAL VIDEO I MADE: https://www.youtube.com/watch?v=T3vG8U5RoFw


I (was) the main video editor for Linus Media Group. We put out multiple videos every day, so I had to learn how to work quickly, without sacrificing quality. These AutoHotKey scripts speed up my workflow significantly. (Mostly for Premiere Pro and Explorer)

I pioneered the use of a 2nd keyboard purely for macros, and later, the concept of "wrapping" keystrokes inside of other keystrokes, (ideally, the super-function keys (F13-F24)) as a means of massively multiplying the number of unique available keys.


Adding a 2nd, independent keyboard is remarkably difficult, as Windows has no native support for distinguishing between multiple keyboards. There are many possible solutions, which vary greatly in difficulty, functionality, stability, and price. Here's a spreadsheet that breaks it all down for you. My preferred solution (QMK) might not be best for you:

https://docs.google.com/spreadsheets/d/18e6-OlUzc_1wbGvm9zqMOwtC4oysm6C7XMU1bOf8Nrc/edit?usp=sharing

So, to summarize, if you want to make your own macro keyboard, these are all the methods that I know of:

Other potential methods that I have not personally tested

If all of this just seems like a huge PITA, just buy a Stream Deck instead: https://youtu.be/vhPLhfP1b_s

NOTE: You do not need a 2nd keyboard to use AutoHotKey. Most poeple don't. By the time you need to add a 2nd keyboard, you should already be quite familiar with how AutoHotKey works. You can probably use your function keys for AHK macros, and if your main keyboard has dedicated macro keys, you can also use those. (Assign them to obscure shortcuts like CTRL SHIFT ALT F1, and then, in AutoHotKey, assign that key combo to whatever you want.)

Basically, don't just add a 2nd keyboard because you think it's cool! Make sure you actually need it, because you've run out of space on your main keyboard.

My AHK scripts

IF YOU ARE NEW TO AUTOHOTKEY, start here: https://autohotkey.com/docs/Tutorial.htm https://www.youtube.com/watch?v=T3vG8U5RoFw

I know there are a lot of scripts in this repository. Look here to see what launches when I start my computer: https://github.com/TaranVH/2nd-keyboard/blob/master/INFO_and_PROFILES/Taran_startup_folder_2019_JULY.png

Some of the scripts are #include-d in other scripts. The MAIN script from which most others are run, is this one - so, you can start here: https://github.com/TaranVH/2nd-keyboard/blob/master/ALL_MULTIPLE_KEYBOARD_ASSIGNMENTS.ahk

Some scripts can stand entirely on their own, like this one: https://github.com/TaranVH/2nd-keyboard/blob/master/Taran's_Windows_Mods/Both_Accelerated_Scrolling_1.3_AND_Cursor_click_visualizer.ahk

To see most of these scripts in action during a real workday, check out my "World's Most Advanced Editing Tutorial" https://www.youtube.com/watch?v=O6ERELse_QY

All my custom Premiere, Photoshop, and After Effects keyboard shortcuts can be found here: https://github.com/TaranVH/2nd-keyboard/tree/master/Settings_and_shortcuts

Please note, I'm not a real programmer (in this lifetime.) My organization can be bad, and my code can be spaghetti-y. I have, however, done extensive commenting... so if you know how to code, it should be pretty easy to figure out what's going on.

Help with this repository is appreciated, but don't feel bad if I never officially merge your scripts. I can't trust anything that I haven't fully tested myself, or something with code that I don't recognise or understand. These are my real day-to-day working scripts, so I can't compromise them for anybody.

Sometimes I put out tutorials on my personal channel: https://www.youtube.com/user/TaranVH/videos ...and sometimes I make "reverse tutorials" where I ask questions instead.

Twitter is probably the most effective method for you to contact me: https://twitter.com/TaranVH

You're free to use any of these scripts for yourself. Take what you need, modify it to your heart's content.

My most used, most useful, simplest script is this one: https://www.youtube.com/watch?v=OqyQABySV8k

2023 update: Since quitting LMG, I don't edit nearly as many videos as I used to, so I also haven't been updating my scripts as much. I certainly have not abandoned this repo, but if you want a version that uses Autohotkey 2.0 and is written far more like a real programmer would, I recommend you check this out: https://github.com/Tomshiii/ahk I am always very happy when poeple take the things I've stared and build and improve upon them, and this is a great example.


To see all my currently assigned scan codes and virual keys, take a look at this spreadsheet: https://docs.google.com/spreadsheets/d/1GSj0gKDxyWAecB3SIyEZ2ssPETZkkxn67gdIwL1zFUs/edit?usp=drive_web&ouid=107638578296445823789


As of August 2018, I've changed the root directory from this:

C:\Users\TaranWORK\Documents\GitHub\2nd-keyboard

to this:

C:\AHK\2nd-keyboard

which is an enormous improvement, since users no longer have to change all the scattered instances of "TaranWORK" to their own username. Now, a huge amount of the scripts are turn-key, as long as you don't move anything or change any file paths.

This also means that the Corsair K95 and Stream Deck direct-launch scripts are ready to go immediately.

The only disadvantage is that these AHK scripts will be available to ALL users on a machine. If you share a computer, you may wish to move them under your user account after all.

Make sure to populate your startup folder with file shortcuts, to launch all the scripts you want as soon as the computer boots up. KEEP IN MIND that there are TWO startup folders - one for your user account, and one for ALL users. Here they are:

C:\Users[YOUR_USERNAME]\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup (You can open up this by typing "shell:startup" in the explorer bar.)

C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp (You can open up this by typing "shell:Common Startup" in the explorer bar.)


Some interesting-looking related repositories

This is the kind of next-level macro stuff I would do if I was a real programmer: https://github.com/sebinside/HotkeylessAHK https://github.com/sebinside/AHK2PremiereCEP Explanatory video: https://www.twitch.tv/videos/628889342

#27 (easier install of Interception, apparently.)

After Effects scripts from someone with 11 years After Effects experience who just discovered AHK: https://github.com/ivycomb/AutoAfterEffects

More info on how to use Adobe CEP stuff:

https://www.youtube.com/channel/UCmq_t_-4GLFu_nYaEDDModw/videos

https://github.com/Adobe-CEP/Samples/blob/master/PProPanel/jsx/PPRO/Premiere.jsx

2nd-keyboard's People

Contributors

441707521 avatar apocalypse612 avatar edwinst avatar jgjake2 avatar joshaber avatar jossef avatar mcajben avatar taranvh avatar tom-sherman avatar varunjhajharia avatar vuribe1221 avatar wegerich avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

2nd-keyboard's Issues

We need something better for creating the file

io.open("C:\\Users\\TaranVanHemert\\Documents\\keypressed.txt", "w")

For someone who don't know lua (or don't know programming at all) he has to change the code himself... I Will search for something better

AHK reasoning

May I ask the reason you went with AHK instead of AutoIt v3 or Python?

Lua Macros 2nd Keyboard Typing still works

With the Lua macros script running, typing still works, but the script still sends the key to AHK. So I'm getting the output of the keyboard along with the macro I've defined. I believe this was a result of updating to windows 10 build 1809, the dreaded October update (I really wanted my clipboard history, okay?).

Can provide a copy of modified files if that's necessary.

intercept.exe can't be set up with mouse

If I want to use it to differentiate some buttons which exists both on my keyboard and my mice (e. g. LControl), then I can't do it because the mice does not have a q button

Key acceptance inconsistencies with OBS [AHK]

Hey everyone
I'm new to AHK, so I might be doing something wrong but for some reason (with OBS at least, I haven't figured out how to do the other applications I want) there is weird inconsistent acceptance of the hotkeys.

Holding down the button to trigger the bind seems to always make it work, and the keys are always seen by intercept.exe however simply tapping will very rarely work.

Here is my AHK script, there are some duplicates for testing purposes with Voicemod (Which I just can't get to work)
FULL_extra_keyboard.zip

Hard to Navagate Repo

Could you either use diffrent branchs or have seperate repo for each project? As it is getting hard to work out the each folder is for.

Step 5 Error?

I have changed what you called "keypressed at least"
Mine: FileRead, key, A:\HotKeys\2nd-keyboard-master\LUAMACROS\Keypressed stuff\keypressed.txt
When I press the play button it leaves me with this:

2017-12-05 21:37:37:866 [LUA] ERROR: Cannot load buffer.
[string "LuaMacros script"]:1: unexpected symbol near '#'

What version of Premiere?

So I updated to Premiere 2019 and none of the Premiere mods work and since I have problems with it crashing and stuff I think I'm gonna downgrade to Premiere 2017 because 2018 I also had problems with the GPU Acceleration. But what version are you using currently and what versions of Premiere are those scripts compatible? Thanks!

Numpad doesn't Work

I have every key working except the numpad or keys like scroll lock the only thing that I can think of is that I am using a Uk keyboard so the keys might not line up with the key numbers.

advent keyboard2

show "Error:Call to nonexistent function." when run Almost_All_Windows_Functions.ahk

image

Error: Call to nonexistent function.
Specifically: Acc_Get("Object","4",0,"ahk id "hWnd)
Line#969:}970:}975:}
1028: Return
1028: JEE_FirefoxFocusTabByName(hWnd,"Linus Media Group Inc. Mail")
1028: Return
1032:{
1033: oAcc:=Acc_Get("Object","4",0,"ahk_id"hWnd)
1034: vRet:=01035: For each, oChild in Acc Children(oAcc)1036: if(oChild. accName(O)=="Browser tabs")
1037:{
1038: oAcc:=Acc Children(oChild)[1], vRet:=11039: Break
1040:}
The program will exit.

Installer script for intercept [Feedback wanted]

Installer Script

After i saw the new video on Taran's channel (https://www.youtube.com/watch?v=y3e_ri-vOIo&t=1s) where he explains the long and tedious process of getting intercept.exe to work, I wondered to myself if there wasn't a simpler way of doing this.
Luckyly there's way of making automated scripts directly in windows (if you didn't know) through batch (.bat) files.
I therefore wrote an comment on the video suggesting making such script. After the approval of Taran himself I've now started hacking on a initial draft.

I just wanted to make this issue to collect feedback and hear peoples thoughts before i submit the script :).

My basic thought is to create a file that automaticly does all the things described in the video.
As i see it the steps are as follows:
1: download the two programs (interception and intercept.exe).
2: Install interception as a admin user (We dont need to install intercept.exe, just unzip it)
3: Fiqure out the keyboard's id (maybe through intercept.exe)
4: Fill out the template keymap by taran.
5: Download the autohotkey script
6: Profit!

I'm gonna try to keep the dependencies as few as possible, since we dont want people to install even more programs on their computer, just to make this work. Therefore i try to stick to tools already avalible in windows by default (hence the use of batch). We might have to pull some libraries for when we want to populate the keymap with the keyboard id, but I'll give you an update on that later ;).

OBS not responding unless infocus

hey, concept of intercept is amazing, but for me unless i alt tab to obs the hotkeys dont work. im not able to start or stop recording or send any hotkey to obs while using chrome or any other window even if im staring at the desktop with obs minimised.

i've tried running obs as administrator didnt help

KeypressOSD Cuts Off

On my screen, letters are very off-center and any lengthy press (i.e. "LButton) gets completely cut off.
I feel like the code for this UI should be obvious, but nothing I'm changing seems to adjust or fit the black bar background.

I tried adjusting "Gui, Margin, 0, 0" & "Gui, Add, Text, vHotkeyText Center y50" (y50) and neight of those did anything.

Also if you press a Numpad number more than once it deletes the original number post and starts saying "Numpad [number]" again.

Grabbed a better photo of the alignment issue with my phone.

What do I need to change for this?

1
2017-02-21 17 55 43

Karabiner

Hey Taran. Messaging here because that other thread got locked. Lol. If that Karabiner idea sounds like something you're interested in, let me know. I'll end up building most of it for myself anyway.

Saw your videos and got the idea to connect a 10-key pad directly to my Mac and use it to control things like volume, display switching etc. on both my Mac and Win machines, but not pass it through the KVM. That way, regardless of which machine I have the KVM switched to, it always works. For that I'll need to build the Windows daemon and messaging system I was describing anyway.

The only thing extra you might need is a script to generate the Karabiner JSON for the hundreds? of individual buttons you have. I wouldn't want to write that by hand. That isn't very hard to make and might be a good tool to have around anyway. Karabiner's JSON format can get tedious to deal with, even with just the small number of remaps I use right now.

Action Center keeps coming up when I press a hotkey

So basically I made a hotkey for Premiere Pro to save the current file to another project because I use a template to open my project up and then save the file to the editing project when I start editing. But for some reason when I press F2 (my stroke) it brings up the action center. I thought maybe the keys that the AutoHotkey was pressing caused it to bring it up but I tried those hotkeys manually and it didn't come up. I'd be glad if you could help thanks!

Code:
F2::
#IfWinActive, ahk_class Premiere Pro
send ^+s
send !d
send C:\Users\aitfr\Documents\Adobe\Premiere Pro\13.0\Editing.prproj
MouseClick Left, 820,580 , 1
Sleep 1
MouseClick Left, 1060,555 , 1

Simple code not working

Hey,

So I created a simple script that if I press END the script will press HOME, Sleep 100 and then suspend itself, but for some reason, it doesn't press HOME. I don't know what's the problem... It doesn't tell me any error either. Thanks!

Code:

END::
sendinput, {Home} ;Press Home so my keyboard profile would switch in iCUE. (I made it so if I press
Home iCUE switches between my 2 profiles which are Editing/Programming and Gaming)

Sleep 100 ;Wait for 100 milliseconds
Suspend ;Suspend the hotkeys so if I play games i wouldn't accidentally press one of my hotkeys

Corsair K55, #ifwinactive uses primary keyboard keys

Hey all,

I have the corsair K55 up and running with no issues...other than using macros in programs. Whenever I try to use the #ifWinActive (if thingy), it displays a tool tip on the second keyboard and on my primary keyboard the macro works. Tried several solutions, but could not get it to work.

ALSO, I did read this and am still having the issue:
#65

Any tips?

Set double duration for clip?

please help to establish the double duration of the clip on the timeline, without changing its speed
ss 2018-09-28 at 03 00 23

for example, this clip should get the duration 6 sec 8 frames and 100% Speed

Issues with the 2nd keyboard

Hello,

As soon as I use my 2nd keyboard (after starting intercept.exe and the .ahk script), I can't use my 1st keyboard anymore, because it does the same functions as the 2nd keyboard, including the macros. Basically, it's as if I have two "2nd" keyboards, and no "1st" keyboard...

Thanks!

Visualizer not working???

Currently trying to setup the Visualiser script, downloading the ahk, ini and creating the txt. It does not seem to be working. I am new to autohotkey so any debugging help would be appreciated. Running ppcc2018. the taskbar icon shows but there is no visualiser, the GUI doesnt seem to launch when the script launches.

Trying to find the Premiere Functions mentioned in the Lua Macros ahk

I'm hopelessly new to this but learning slowly but surely so forgive me if I am misunderstanding something really basic

-- I went through the Intercept.exe setup and couldn't get it to work but I've got Lua Macros working.

Problem is, it seems like some files got deleted in the github that are being referenced in the Lua AHK script/readme?

Specifically it says in the readme:

"2nd keyboard if using luamacros.ahk only has bare functions for proof of concept. You can write your own functions, or copy/paste some from from All Premiere Functions.ahk, but you'll probably need to modify them to fit your own system, by changing coordinates, windowClasses, colors, shortcuts, and so on."

I found "Almost_All_Premiere_Functions.ahk" but none of the functions seem to line up with the functions mentioned in the Lua AHK file. For instance:

"preset("flip horizontal") " doesn't seem to be present anywhere in the Almost_All_Premiere_Functions.ahk file.

Am I thinking about this completely wrong or is there an older file I should be using if I'm trying to get it working with Lua?

Your code is probably incompatible with non US layouts

Here is the problem:
for exemple in france we have AZERTY layout and where US layout have the semicolon key we have the 'M' key.
so what is the problem ?
[186] = "semicolon",
...
[string.byte('M')] = "m",
the 'M' key on a french keyboard will take the code 186 which is already taken by the semicolon.
On ISO Layouts keyboards there is also one more key (at the right of the left shift) this key is not declared in your script :'(
(I will try to fix this too)

Creating Batch file to execute macros at startup

I would like to create a batch file so that windows automatically executes my .lua file with my macros on startup. I've tried using the task scheduler on win10 but it's useless. It didn't open the file. Could anyone explain me how to do it? Thanks in advance

Simplified Configuration Layout

I cleaned up the Lua file a little bit. I just threw everything into a standard table using keyboard inputs as the keys, and macro names as values.

Using a table structure will dramatically increase keystroke->macro responsiveness.

I haven't tested this at all, and I have to get ready for work, but I'll clean everything else up when I get home ;)

Can't Use AHK #IfWinActive together with #if (getKeyState("F23", "P"))

Hi,
Sorry if this is not the best place to ask this...

The moment I add the #IfWinActive command to the AHK script,
AHK will accept Hotkey from BOTH keyboards.

#IfWinActive ahk_exe POWERPNT.EXE
m::
send !l
send p
send m
send {Enter}
return

Tried various combinations to solve this.... any ideas?

Missing licence

I think the licence is missing. In most (if not all) countries where copyright exists, merely publishing the source code doesn't automatically grant any rights to users and fellow developers. In other words, all rights are reserved by the author.

This holds for things other than source code as well. If you publish a post on your blog, or a video on YouTube, without explicit notice you reserve all your rights.

Note: Although some rights are granted to the service provider, e.g. GitHub or Youtube, to allow hosting your content, this usually doesn't apply to your end users. Good services require the bare minimum, e.g. reproducing rights to show your photos and videos to your audience. Bad services want to own your content.

To allow the community to hack and improve your project, which is what you intended I believe, you need to give explicit permission.

choosealicence.com is a good place to start, and most likely is enough to decide which is the right one for your project. If you are not satisfied with the selection, you can check the list of licences approved by the Open Source Initiative.

second keyboard script

when I start the second keyboard script for lua macros
I can still type on the secondary keyboard

Potential OS X problem (F24 shouldn't work)

Some time ago I opened this ticket for OBS where I was surprised to learn that only linux supports keys up to F35. As it turns out, F24 is the highest F key on Windows, and on OSX F keys go only up to F20 or F19 (I'm not sure which one).

Here is someone else wondering why F20…F24 don't work with QMK and OSX: F20 - F24 do not respond under QMK and OSX.

I guess most of this repo is windows-only, but I thought I'd leave a note in case somebody wants to reproduce these results on other operating systems.

Fork of Intercept

I have created a fork of Intercept here which when given the /apply command line parameter will only show as an icon in the system tray, which has a right click option to exit Intercept. This solves the issue of having a command window sitting around all the time.

Feel free to use it/include it in the guide.

Followed the Steps, but Doesn't Work

Followed each step in the guide, but when it came to running the script I found that none of the keys on the second keyboard did anything, not even regular keystrokes. LuaMacros recognizes each keystroke but none of the given scripts worked for me.

I'm not entirely sure what the problem is.

FileMover-AutoHotKey Script FIX

Hey there. It's Z3roFPS from Youtube, I answered on your Video last night.

Now I finally got onto a PC, and made a "quick" fix to your Script. Sadly, I can not create a Branch and Pull Request, so I'll just put the link to the Script here.

However, if you were to give me Dev rights, I would definetly help you out some more should you need it.

This is the file: https://pastebin.com/K445QYz5

The fix is basically a new Method (I found with Google) to Combine two Strings that represent a Path, and a Path or a File. Using the helper Method now wherever you checked for publishLOC, I was able to receive a pretty consistant, working result.

This also fixes the Problem that the Script wouldn't work on the Desktop. This now also works flawlessly (On my Win7, Win8 and Win10 Testmachines at least)

Hope this helps.

need help with OBS interaction

PLEASE HELP!!!!!!!!!!!!!

This is my issue; my script works with OBS studio when it has focus, but as soon as I click another application, it stops working. here is my keyremap.ini and my AHK.ahk

FYI everything is running as admin.

(yes I know there are some keys in the AHK that are not in keyremap.ini.)

files.zip

Where is the ahk from the video?`

both Taran's Lua code and autohotkeys code is missing for me, I'm trying to make a soundboard keyboard kind of thing where every key types out a line of words. Where is this legendary Transitions, Effects, and 2nd keyboard functions.ahk that im supposed to be using?

There is no licence

The code has no licence, I'd suggest the MIT licence if you don't particularly care how your code is used or GPL if you want anyone who changes your program to make it open source.

Intercept, but done with callbacks

Hi y'all, just to let you know that I shamelessly stole your idea of wrapping keys to set an AHK context, but I found a sneakier way to do it.
I wrote a C# DLL which wraps interception that you call from AHK via CLR, and pass it an AHK function object, along with a VID / PID.
Any time Interception sees input on that device, it fires that AHK function object, which sets the context variable, then it sends the key, then it fires the code again to unset the context variable.
https://github.com/evilC/AutoHotInterception
See "Context Mode".
I also have a mode where you can register a callback for each key ("Subscription Mode")

Autohotkey script with lua macros

The lua macros side of things seems to be working fine (except for the non US layout of my keyboard) but the autohotkey side of things just gives me this error:
image

It is most likely because I did something wrong but I would like to know how to fix it!

I know Teran recomended switching to another program in another thread although I beleive that you require admin rights for it which I do not have on my computer.

Improve Tippy2!

You have the wonderful Tippy2 function which shows a tooltip.
I have pasted here a new version which shows a tooltip that follows your mouse very nicely and also consumes no resources.

It is self-contained: you just #include Tippy.ahk at the beginning of your script and then call Tippy("mytext")

If you like how this Tippy works, i can send you a PR with it integrated in your scripts.

Here's the whole code, with examples.

; Show a ToolTip with a message for a specific duration while following the mouse
;
; How it works:
; Function Tippy acts as a launcher for the "show-tip" and "hide-tip-after-duration" functions
; A global variable is used which saves The text to be showed in the tooltip
; Function TippyOn is called on a timer every 10 ms to update the tooltip position (that function also calls itself)
; To hide the tooltip the function TippyOff is called after %Duration% time which turns off the timer for TippyOn so everything is clean
;
; How to use:
; - At the top of your script include this second script:
;           #include Tippy.ahk
; - Then just call Tippy() with the text and duration you want.
;           You have an example at the end of the script!
; The tooltip is beautifully shown using ToolTipFM (a fancier tooltip -- read it's own comments).
Tippy(Text = "", Duration = 1000) {
    global TippyText := Text

    SetTimer, TippyOff, %Duration%
    SetTimer, TippyOn, 10
}

TippyOn() {
    SetTimer, TippyOn, 10
    global TippyText
    ToolTipFM(TippyText)
}

TippyOff() {
    ToolTipFM()
    SetTimer, Tippy, Off
    SetTimer, TippyOn, Off
    SetTimer, TippyOff, Off
    global TippyText := ""
}



; ToolTip which follows the mouse without flickering
; It uses MoveWindow dll call instead of recreating the ToolTip!
;
; Ref: https://autohotkey.com/board/topic/63640-tooltip-which-follows-the-mouse-is-flickering/#entry409383
ToolTipFM(Text="", WhichToolTip=16, xOffset=16, yOffset=16) { ; ToolTip which Follows the Mouse
    static LastText, hwnd, VirtualScreenWidth, VirtualScreenHeight ; http://www.autohotkey.com/forum/post-430240.html#430240

    if (VirtualScreenWidth = "" or VirtualScreenHeight = "")
    {
        SysGet, VirtualScreenWidth, 78
        SysGet, VirtualScreenHeight, 79
    }

    if (Text = "") ; destroy tooltip
    {
        ToolTip,,,, % WhichToolTip
        LastText := "", hwnd := ""
        return
    }
    else ; move or recreate tooltip
    {
        CoordMode, Mouse, Screen
        MouseGetPos, x,y
        x += xOffset, y += yOffset
        WinGetPos,,,w,h, ahk_id %hwnd%

        ; if necessary, adjust Tooltip position
        if ((x+w) > VirtualScreenWidth)
        AdjustX := 1
        if ((y+h) > VirtualScreenHeight)
        AdjustY := 1

        if (AdjustX and AdjustY)
        x := x - xOffset*2 - w, y := y - yOffset*2 - h
        else if AdjustX
        x := VirtualScreenWidth - w
        else if AdjustY
        y := VirtualScreenHeight - h

        if (Text = LastText) ; move tooltip
        DllCall("MoveWindow", A_PtrSize ? "UPTR" : "UInt",hwnd,"Int",x,"Int",y,"Int",w,"Int",h,"Int",0)
        else ; recreate tooltip
        {
            ; Perfect solution would be to update tooltip text (TTM_UPDATETIPTEXT), but must be compatible with all versions of AHK_L and AHK Basic.
            ; My Ask For Help link: http://www.autohotkey.com/forum/post-421841.html#421841
            CoordMode, ToolTip, Screen
            ToolTip,,,, % WhichToolTip ; destroy old
            ToolTip, % Text, x, y, % WhichToolTip ; show new
            hwnd := WinExist("ahk_class tooltips_class32 ahk_pid " DllCall("GetCurrentProcessId")), LastText := Text
            %A_ThisFunc%(Text, WhichToolTip, xOffset, yOffset) ; move new
        }
        Winset, AlwaysOnTop, on, ahk_id %hwnd%
    }
}




; ================================
; HERE IS HOW YOU TEST THE SCRIPT!

; Press and hold F1-F2 hotkeys, and move mouse.


Text = ; Make too long ToolTip text for testing purpose
(
If blank or omitted, the existing tooltip (if any) will be hidden.
Otherwise, this parameter is the text to display in the tooltip.
If blank or omitted, the existing tooltip (if any) will be hidden.
Otherwise, this parameter is the text to display in the tooltip.
If blank or omitted, the existing tooltip (if any) will be hidden.
Otherwise, this parameter is the text to display in the tooltip.
If blank or omitted, the existing tooltip (if any) will be hidden.
Otherwise, this parameter is the text to display in the tooltip.
If blank or omitted, the existing tooltip (if any) will be hidden.
Otherwise, this parameter is the text to display in the tooltip.
If blank or omitted, the existing tooltip (if any) will be hidden.
Otherwise, this parameter is the text to display in the tooltip.
If blank or omitted, the existing tooltip (if any) will be hidden.
Otherwise, this parameter is the text to display in the tooltip.
)


;=== Test ToolTip mouse following ===
; Just keep F1 or F2 pressed and see the difference!
F1:: ; old system = flickers + high CPU load + slow moving
While, GetKeyState(A_ThisHotkey,"p")
{
    ToolTip, % text
    Sleep, 10
}
ToolTip
return

F2:: ; new system = does not flicker + low CPU load + fast moving
{
    Tippy(text, 2000) ; you pass the text and the duration
}
return

Media keys with intercept

Hey, I was looking around the internet for answers and ended up here.

You seem fairly experienced with intercept.exe so I wonder if you would know scancodes, or how to find them out, for media keys? I'm in the need for previous, next and play/pause. My own laptop keyboard does not contain them so I can't just press and see. I'm trying to configure my external numpad for various purposes, media controls being one. Or maybe I can't get the media key mapping done with just intercept and I need to use AHK with it? If I can I'd rather use only intercept rather than using them both so any info would be useful.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.