do-what-I-mean-shit with Autohotkey

Hehe :]

Technical director floh wasn’t thrilled.. But I actually was looking for a way to do this long time:

If you script code sometimes you define stuff, a variable e.g. at the point where you finally want to use this variable you need to go back to the definition somehow (via mouse or cursor) copy it and return to the point where you felt like having that variable available. A word-autocomplete might help in that case as well. But if your var has a long prefix and … nah!

What I actually was looking for:

  • you get the idea: Oh I need this from over there
  • I press a hotkey to remember the position
  • you move to the thing you need and select it
  • you press another hotkey

then its finished: The piece you where looking for is at the spot.
Ok now chill the fuck out: I got this:

This has nothing to do with the code editor: Its all Autohotkey:

  • on Ctrl+Ins it figures out the typing-cursor/caret-position (does not always work FF e.g.)
  • places a tooltip and waits for you to press enter
  • you make a selection somewhere else
  • If you press Enter: It gets the selection
  • clicks the mouse to the old position
  • inserts the selection
  • restores clipboard and mouse position

Thats actually it! If you want to take a look at my puny source code:
or even want to test it out without having Autohotkey try the .exe:

http://goodsoul.de/ahk/rememberPosTool.ahk
http://goodsoul.de/ahk/rememberPosTool.exe
(virus total online check link: suspicios file… well it waits for your keystroke.. 😉 )

First I had an ac’tivAid UserHotkey-snippet without the hotkey on/off crap… but somehow UserHotkeys somehow deselects the current window. Need to look into this later… This example works much better. So it doesn’t matter if you click via mouse or select with keyboard.

BUT: now the downsides:

  • I made it cancel when you scroll with the mouseWheel
  • but if you scroll somehow else its broken of course! Works only on screenspace!
  • some apps do not support the caret-position. Like Firefox for instance.

try on your own risk of course ;]

Leave a Reply

Your email address will not be published.