favorite tricks / scripts ...

Post your working scripts, libraries and tools for AHK v1.1 and older
InGearX
Posts: 54
Joined: 14 Oct 2016, 15:53

favorite tricks / scripts ...

01 Nov 2017, 04:36

how do you use your AHK?

please post your favorite tricks and/or scripts ...

for all to share ...

thank you ...
PS my contribution is bellow ...
InGearX
Posts: 54
Joined: 14 Oct 2016, 15:53

Re: favorite tricks / scripts ...

01 Nov 2017, 04:37

I use it for a hundred+ text replacements ...
also sound volume +/-/mute and other OS manumulations

Code: Select all

#Q::Send {Volume_Mute}
#W::Send {Volume_Mute}

#A::Send {Volume_Up}
#Z::Send {Volume_Down}

#S::RUN C:\z\nircmd\nircmd.exe changebrightness 5
#X::RUN C:\z\nircmd\nircmd.exe changebrightness -5 

^SPACE:: Winset, Alwaysontop, , A ;CTRL  SPACE - WINDOW ALWAYS ON TOP
Return

~LButton & RButton::
Send {ctrl down}e{ctrl up}
Return

::qgreen::                                                           ; 
 Clipboard = 
(
big
hundreds of lines
of thext
pasted in 1 second
) 
 Send ^v
RETURN

here is my auto WiFi reconnector https://autohotkey.com/boards/viewtopic.php?f=5&t=34970

in line calculator

What's this?

An interface-less calculator for Windows that lets you do basic math without having to leave the line you're typing on.

Where can it be used?

Almost anywhere in windows where you can enter text. Any text editor, search box or command line... even the text edit box that you use to rename files.

https://github.com/davebrny/in-line-calculator
InGearX
Posts: 54
Joined: 14 Oct 2016, 15:53

Re: favorite tricks / scripts ...

03 Nov 2017, 14:04

no one :'(

why not?
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: favorite tricks / scripts ...

03 Nov 2017, 14:24

[I might go back and add more, but it might be months. I do have a candidate list which I am always updating however.]
best utilities + best AutoHotkey scripts (+ useful tips) - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=7&t=28149

[I'll add a lot more here, possibly in the next few weeks.]
jeeswg's homepage - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 17&t=30931

The occasional little hack/trick is such a standard part of programming, at least to me, that it's hard to retrospectively enumerate them. Perhaps I'll collect some when I do a full review of all my scripts, when AHK v2 gets released (which I hope it does). Cheers.

[EDIT:] Since missing (l|L)exikos with his relative absence in recent months, and coming across two good lexikos scripts I hadn't seen before, across the space of a few days, plus wanting to find a humorous quote and a particular script, I started a 'best of lexikos' txt file. I'm thinking about releasing it, just that potentially it could seem a bit sycophantic. Perhaps if I'm encouraged to release it.

[EDIT:] I've added links to handy tricks here, I may add more in future:
jeeswg's homepage - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 39#p144439
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: favorite tricks / scripts ...

06 Nov 2017, 17:31

I tend to find mouse scripts quite cool. I don't use mouse hotkeys very often, and it's quite subtle to create a useful hotkey or 'hotmouse', with the relatively limited number of buttons available. I don't have X1 or X2 buttons for example. I still find the middle button a bit of a novelty, it's quite versatile also, it's like 3 buttons in one.

Code: Select all

#IfWinActive, ahk_class IEFrame
MButton:: ;open url (link) under cursor in new tab
Send, ^{Click}
return

;note: this can interfere with scroll and drag (so it's useful to disable this occasionally)
LButton & WheelUp:: ;zoom in/out
Send, ^{WheelUp}
return

;note: this can interfere with scroll and drag (so it's useful to disable this occasionally)
LButton & WheelDown:: ;zoom in/out
Send, ^{WheelDown}
return
#IfWinActive
Last edited by jeeswg on 12 Nov 2017, 06:20, edited 2 times in total.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
vahju
Posts: 29
Joined: 30 Sep 2013, 16:09

Re: favorite tricks / scripts ...

06 Nov 2017, 22:17

I use some text replacement clips to help me out with some excel formulas. I do a ton of lookups with vlookup/match being my main go to lookup formula.

Code: Select all

;vlookup/Match formula - double click parts to update
:*:fnvm::
SendRaw,=Trim(VLOOKUP(DblClk_to_Select_Cell_to_lookup,DblClk_to_Select_Range_to_Search,MATCH(DblClk_Single_Lookup_Cell,DblClk_Lookup_Column, 0),0))
return
Below are some hotkeys that really work great when I am using my laptop:

Code: Select all

;---Top of Page and Bottom of page for easy access
~RCtrl & Up::Send, ^{Home}
~RCtrl & Down::Send, ^{End}
InGearX
Posts: 54
Joined: 14 Oct 2016, 15:53

Re: favorite tricks / scripts ...

07 Nov 2017, 06:36

thank you!!!
User avatar
davebrny
Posts: 85
Joined: 05 Dec 2016, 06:26

Re: favorite tricks / scripts ...

08 Nov 2017, 12:51

InGearX wrote:no one :'(

why not?
its a tough question to answer, there are so many its hard to know where to start!
i have too many unfinished and half working scripts that arent shareable atm, but most of my favourites ive put online already so just follow the links at the bottom of this post to find them

my favourites usually tend to be any of the time saving scripts that make any repetitive tasks less repetitive... but maybe thats everything in autohotkey :)

msg() and list_vars() are both things i get a ton of use out of whenever im making new scripts.
"reloadr" is another one that is useful in the script making department.
"ahk help" - highlight an autohotkey command and search for it in the local help file

auto_include() makes it a lot easier to manage lots of different snippets or scripts in folders vs having them in one big script. i use sublime text's sibebar then to navigate the folder tree or use ctrl+p to quickly fuzzy search for a file

autocorrect anything: highlight some text and have it replaced with the correct spelling. i think that is one the the very first scripts i start using with autohotkey

"kiwis.menu" is a similar sort of time saver. highlight a word and then have that word open in a sites internal search instead of searching on google first
InGearX wrote: in line calculator
:D im chuffed to see this on someone else favourite list
User avatar
noname
Posts: 515
Joined: 19 Nov 2013, 09:15

Re: favorite tricks / scripts ...

09 Nov 2017, 03:39

Indeed a tough question ,there are so many i use .The latest one i use daily is a modification by Nightwolf of Spawnova 's code to capitalize with a longpress:
https://autohotkey.com/boards/viewtopic.php?t=31588

( and the online calculator is loaded at startup ! ) 8-)
jazzvb
Posts: 32
Joined: 14 Jan 2019, 20:10

Re: favorite tricks / scripts ...

15 Nov 2020, 16:41

For what it's worth...
Sorry for this lay-out. It's copy paste from my AHK doc.

Code: Select all

; volume down with the volume panel working (otherwise it disappears)
F6::
Soundset, -2, , ,0
try if ((shellProvider := ComObjCreate("{C2F03A33-21F5-47FA-B4BB-156362A2F239}", "{00000000-0000-0000-C000-000000000046}"))) {
				try if ((flyoutDisp := ComObjQuery(shellProvider, "{41f9d2fb-7834-4ab6-8b1b-73e74064b465}", "{41f9d2fb-7834-4ab6-8b1b-73e74064b465}"))) {
					 DllCall(NumGet(NumGet(flyoutDisp+0)+3*A_PtrSize), "Ptr", flyoutDisp, "Int", 0, "UInt", 0)
					,ObjRelease(flyoutDisp)
				}
				ObjRelease(shellProvider)
}
return


; volume up
F7::Volume_Up
Return


; empty recycle bin (you dont see anything, but you have to press Enter, just to be on the safe)
!PrintScreen::
keywait, Enter, D, T3
if (ErrorLevel = 0) {
FileRecycleEmpty
}
return


; open browser with F12
F12::
Run, C:\Program Files\Mozilla Firefox\firefox.exe
Return


; today's date - as in 01 September 2005
^+D::
FormatTime, CurrentDate,, dd MMMM yyyy
SendInput %CurrentDate%
Return


; open favorite folder in Windows Explorer
#Z::Run "C:\Users\...\...\..."
Return


; open recently opened files in Windows Explorer (!^ is also the Alt Gr key next to the spacebar)
^!,::
Run "C:\Users\YourUsername\AppData\Roaming\Microsoft\Windows\Recent"
Return


; swap positions of : and ;
$+;::Send `;
$`;::Send :
return


; automatically copy after ctrl+a
~^a::Send, ^c
return


; Open notepad
^!K::
    Run "C:\Windows\system32\notepad.exe"
    Return


;  open favorite website
^!V::Run "https www.website.com /"  Broken Link for safety
Return


; open paint
^!P::
    Run "C:\Windows\system32\mspaint.exe"
    Return


; after selecting a word or group of words, using ctrl+alt+z will directly search the selected in google
 ^!z::
 {
  Send, ^c
  Sleep 50
  Run, "http www.google.com /search?q=%clipboard%"  Broken Link for safety
  Return
 }
return


; windows always on top
 !F1:: Winset, Alwaysontop, , A
 return


; instead of Alt+Tab > Break
$Break::Send !{Tab}
Return


; copy a selected file or folder in Windows Explorer to another folder
!insert::
clipboard = ; Empty the clipboard
send , ^c
ClipWait,5 ; wait for the text or files to be copied to the clipboard
file = %Clipboard%
FileCopy , %file% , C:\Users\...\...  ; moves the file to new location
sleep , 200
exist = %ErrorLevel% ; get the error level 0 = no errors
if exist > 0 ; what to do if there is an error like filename already exists
{
  MsgBox, 49,File already exist, The File you are trying to copy is already exist,`nDo you want to Overwrite the file?
    IfMsgBox OK
    FileCopy , %file% , C:\Users\...\... ,1   ; this path equals the path mentioned earlier in this script
}
return


; make a screenshot and paste that directly in Paint. You can add to save that screenshot immediately after pasting, but I prefer not to, hence the ; in front of those lines.
~^Printscreen::
Run, Mspaint 
WinWaitActive, ahk_class MSPaintApp
Sleep, 100
Send ^v
; Sleep, 200
; Send ^s
return


; use insert instead of ctrl+F
$Insert:: Send ^f
Return


; edit and reload the AHK script
+#r::Reload
+#e::Edit
Return


; use an AHK script only for a specific window or app
$^v::
IfWinactive Autohotkey Quick Overview - "literal title of window/app" ; without the quotation marks
{
Send, write any input here
}
else
{
Send, ^v
}
Return


; long press Escape closes the window/app
$Escape::
KeyWait, Escape, T2
If ErrorLevel
PostMessage, 0x112, 0xF060,,, A
Else
Send {Esc}
Return


; typ 2 apostrofe's and put the cursor in between them
#':: SendInput, ''{Left 1}
return
[Mod edit: [code][/code] tags added.]

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: hiahkforum, shiori4 and 146 guests