├── .DS_Store
├── .gitignore
├── README.md
├── battery_alert.ahk
├── caps_as_window_switcher.ahk
├── create_file_here.ahk
├── ctrl_caps_as_case_change.ahk
├── disable_scroll_zoom_edge.ahk
├── drafts
├── .DS_Store
├── BatteryRun
│ ├── BatteryRun.ahk
│ ├── BatteryRun.exe
│ └── BatteryRun.gif
├── CloseFence
│ ├── CloseFence.ahk
│ ├── CloseFence.exe
│ └── CloseFence.gif
├── autocorrect with google.ahk
├── batterydeley
│ ├── BatteryDeley.exe
│ ├── BatteryDeley.ini
│ ├── ClipartConnection_3700840.thm.jpg
│ ├── ClipartConnection_3775464_thm.jpg
│ ├── ClipartConnection_3775471_thm.jpg
│ ├── ClipartConnection_3861328_thm.jpg
│ ├── ClipartConnection_3890038_thm.jpg
│ ├── readme.txt
│ └── source
│ │ ├── BatteryDeley.ahk
│ │ ├── BatteryDeley.ini
│ │ ├── CompileBatteryDeley.gif
│ │ ├── compile BatteryDeley.txt
│ │ └── icons
│ │ ├── BatteryDeley.ico
│ │ ├── Unused
│ │ ├── ClipartConnection_3711731.thm.jpg
│ │ ├── ClipartConnection_3741228_thm.jpg
│ │ ├── ClipartConnection_3832348.thm.jpg
│ │ ├── ClipartConnection_3832351.thm.jpg
│ │ └── ClipartConnection_3933645.thm.jpg
│ │ ├── deleylogo.ico
│ │ └── duck.ico
├── fix_win_backspace.ahk
└── window_tabs_switcher.ahk
├── in-line-calculator
├── UNLICENSE
├── in-line calculator.ahk
├── in-line calculator.exe
├── in-line calculator.ico
├── lib
│ ├── clipboard.ahk
│ ├── eval.ahk
│ └── start_with_windows.ahk
├── readme.md
└── settings.ini
├── left_edge_as_window_switcher.ahk
├── look_up.ahk
├── mouseless.ahk
├── move-inactive-window-alt-leftclick
├── MoveInactiveWin.ahk
├── MoveInactiveWin.gif
└── MoveInactiveWinScreen.gif
├── open_shell_here.ahk
├── pin_window.ahk
├── script_autorun_startup.vbs
└── win_key_to_show_taskbar.ahk
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GorvGoyl/Autohotkey-Scripts-Windows/fee515400efda5b9c23ea16ba004400e2e6ba00a/.DS_Store
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Top [AutoHotkey](https://www.autohotkey.com) scripts to get more out of Windows
2 |
3 | Useful AutoHotkey scripts (Windows) for quick lookup, in-line calculator, remap keys, battery alert, and more.
4 |
5 | ## Explanation
6 |
7 | http://gourav.io/blog/autohotkey-scripts-windows
8 |
9 | ## How to run script
10 |
11 | - Download and install main program (one-time step) https://www.autohotkey.com
12 | - Download a script (`*.ahk`) or copy paste script content in a text file and then rename it with `.ahk` extension e.g. `my-script.ahk`
13 | - Right-click -> `Run script`.
14 | You can also run scripts by double-click, or do right-click ->`Open with` -> `AutoHotkey`
15 | - Bonus: you can right-click and `Compile script` to make it a standalone `*.exe` program which would run without needing to install AutoHotkey first.
16 |
17 | _scripts inside /drafts folder are not tested properly and might not work. The rest of the scripts should work fine._
18 |
19 | ### Run script at startup
20 |
21 | Method 1:
22 |
23 | - Open startup folder: open `Run` window by `Win+R` and then write `shell:startup` and enter.
24 | - It'll open explorer at something like this path: `C:\Users\{username}\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup`
25 | - Copy script (`*.ahk`) -> go to that `Startup` folder -> right-click and select `Paste shortcut`.
26 |
27 | OR
28 |
29 | Method 2:
30 |
31 | - Put `script_autorun_startup.vbs` at startup folder. Make sure to put the correct path of your ahk scripts in that file first.
32 |
33 | ### Run script as Admin
34 |
35 | Put it at the beginning of the script:
36 |
37 | ```
38 | ; check if it is running as Admin, if not reload as Admin. put at top
39 | if not A_IsAdmin
40 | {
41 | Run *RunAs "%A_ScriptFullPath%"
42 | ExitApp
43 | }
44 | ```
45 |
46 | OR
47 |
48 | Check `Run this program as administrator` in:
49 |
50 | > autohothey.exe > properties > compatibility > settings
51 |
52 | ## Docs
53 |
54 | - Official docs
55 | https://www.autohotkey.com/docs/AutoHotkey.htm
56 |
57 | - AutoHotkey Expression Examples
58 | http://daviddeley.com/autohotkey/xprxmp/autohotkey_expression_examples.htm
59 |
60 | ### Keys and their symbols
61 |
62 | - https://www.autohotkey.com/docs/Hotkeys.htm#Symbols
63 |
64 | ### Common things often found at the beginning of AutoHotkey scripts
65 |
66 | ```
67 | #NoTrayIcon ;if you don't want a tray icon for this AutoHotkey program.
68 | #NoEnv ;Recommended for performance and compatibility with future AutoHotkey releases.
69 | #SingleInstance force ;Skips the dialog box and replaces the old instance automatically
70 | ;;SendMode Input ;I discovered this causes MouseMove to jump as if Speed was 0. (was Recommended for new scripts due to its superior speed and reliability.)
71 | SetKeyDelay, 90 ;Any number you want (milliseconds)
72 | CoordMode,Mouse,Screen ;Initial state is Relative
73 | CoordMode,Pixel,Screen ;Initial state is Relative. Frustration awaits if you set Mouse to Screen and then use GetPixelColor because you forgot this line. There are separate ones for: Mouse, Pixel, ToolTip, Menu, Caret
74 | MouseGetPos, xpos, ypos ;Save initial position of mouse
75 | WinGet, SavedWinId, ID, A ;Save our current active window
76 |
77 | ;Set Up a Log File:
78 | SetWorkingDir, %A_ScriptDir% ;Set default directory to where this script file is located. (Note %% because it's expecting and unquoted string)
79 | LogFile := "MyLog.txt"
80 | FileAppend, This is a message`n, %LogFile% ;Note the trailing (`n) to start a new line. This could instead be a leading (`n) if you want. (Note %% because it's expecting and unquoted string)
81 | ```
82 |
83 | ## Community
84 |
85 | - https://www.reddit.com/r/AutoHotkey/
86 | - https://www.autohotkey.com/boards/
87 |
--------------------------------------------------------------------------------
/battery_alert.ahk:
--------------------------------------------------------------------------------
1 | ; Battery notification
2 | ;
3 | ; When the battery is charged, a notification
4 | ; will appear to tell the user to remove the charger
5 | ;
6 | ; When the battery is below 30%, a notification
7 | ; will appear to tell the user to plug in the charger
8 |
9 | ; run script as admin (reload if not as admin)
10 | if not A_IsAdmin
11 | {
12 | Run *RunAs "%A_AhkPath%" "%A_ScriptFullPath%" ; Requires v1.0.92.01+
13 | ExitApp
14 | }
15 |
16 | #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
17 | ; #Warn ; Enable warnings to assist with detecting common errors.
18 | SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
19 | SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
20 | #SingleInstance Force
21 | SetTitleMatchMode 2
22 |
23 | ; set desired low battery percentage to get alert
24 | lowBatteryPercentage := 90
25 | ;
26 |
27 | sleepTime := 60
28 | chargedPercentage := 99
29 | percentage := "%"
30 |
31 | Loop{ ;Loop forever
32 |
33 | ;Grab the current data.
34 | VarSetCapacity(powerstatus, 1+1+1+1+4+4)
35 | success := DllCall("kernel32.dll\GetSystemPowerStatus", "uint", &powerstatus)
36 |
37 | acLineStatus:=ReadInteger(&powerstatus,0)
38 | batteryLifePercent:=ReadInteger(&powerstatus,2)
39 |
40 | ;Is the battery charged higher than 99%
41 | if (batteryLifePercent > chargedPercentage){ ;Yes.
42 |
43 | if (acLineStatus == 1){ ;Only notify me once
44 | if (batteryLifePercent == 255){
45 | sleepTime := 60
46 | }
47 | else{
48 | title= Battery: %batteryLifePercent%`%
49 | popupmfk(title,"Remove Charger", , , 1)
50 | ;Format the message box
51 | SoundBeep, 1500, 200
52 | ; MsgBox, %output% ;Notify me.
53 | sleepTime := 600
54 | }
55 | }
56 | else{
57 | sleepTime := 60
58 | }
59 | }
60 |
61 | if (batteryLifePercent < lowBatteryPercentage){ ;Yes.
62 |
63 | if (acLineStatus == 0){ ;Only notify me once
64 | ;Format the message box
65 | ; output=PLUG IN THE CHARGING CABLE.`nBattery Life: %batteryLifePercent%%percentage%
66 | title= Battery: %batteryLifePercent%`%
67 | SoundBeep, 1500, 200
68 | ; MsgBox, %output% ;Notify me.
69 | popupmfk(title,"Plug-in Charger", 7000, , 1)
70 | sleepTime := 300
71 | }
72 | else{
73 | sleepTime := 60
74 | }
75 | }
76 |
77 |
78 | sleep, sleepTime*1000 ;sleep for 5 seconds
79 | }
80 |
81 | ;Format the data
82 | ReadInteger( p_address, p_offset)
83 | {
84 | loop, 1
85 | value := 0+( *( ( p_address+p_offset )+( a_Index-1 ) ) << ( 8* ( a_Index-1 ) ) )
86 | return, value
87 | }
88 |
89 |
90 | popupmfk(popTitle=0, popMsg=0, popTime=5000, icoPath=0, hasGoAway=0)
91 | ; Displays a popup with popTitle and popMsg for popTime msec.
92 | ; If popTitle is missing, then only popMsg will appear.
93 | ; If you call popupmfk with no popMsg (or no parameters at all), it will kill the topmost popup.
94 | ; (In theory, you should only be showing one popup at a time anyway.)
95 | ; icoPath specifies the (optional) icon you want to show on the left-top of the popup
96 | ; Setting hasGoAway will make the popup have a (kludgey) go-away box. In either case,
97 | ; clicking on the popup's icon or any of the text will dismiss the popup.
98 | ; If a popup created by this function (even from outside this script) is already displayed, it will be
99 | ; killed and a new one will be shown.
100 | ;
101 | ; This function creates/uses the global kInstanceGuiFcnPopupmfk,
102 | ; you can use this global to test for popup windows outside this function.
103 | ; This function creates the following label: lbl_fcn_popupmfk_DONE
104 | ;
105 | {
106 | ; constants
107 | kInstanceGuiFcnPopupmfk = instance_gui_fcn_popupmfk_1 ; used to identify windows launched by this funciton
108 |
109 | kTitleTypeFace = Tahoma ; typeface of titles
110 | kTitleStyle = s8 w700 c000000 ; style for titles
111 | kMessageTypeFace = Tahoma ; typeface of message
112 | kMessageStyle = s8 w400 c000000 ; style for messages
113 |
114 | ; let's get to work
115 | DetectHiddenText, On ; we will need to make sure that we can detect hidden text
116 | ; I should store the state that DetectHiddenText is in before changing it so it can be reset later,
117 | ; sadly I am not aware of any reasonable way of querying the state of DetectHiddenText :-(
118 | IfWinExist, ahk_class AutoHotkeyGUI, %kInstanceGuiFcnPopupmfk% ; if a popup is already being displayed
119 | {
120 | gosub lbl_fcn_popupmfk_DONE ; kill popups and timer from this App
121 | WinKill, ahk_class AutoHotkeyGUI, %kInstanceGuiFcnPopupmfk% ; kill popups from other Apps
122 | ;WinWaitClose, ahk_class AutoHotkeyGUI, %kInstanceGuiFcnPopupmfk% ; make sure the previous popup is dead
123 | }
124 |
125 | if popMsg ; if a message is specified, pop up a new window
126 | {
127 | Gui, +AlwaysOnTop +toolwindow -resize -caption +border ;;DWD moved to here. Doc says, "For performance reasons, it is better to set all options in a single line, and to do so before creating the window (that is, before any use of other sub-commands such as Gui Add)."
128 | ;WinWaitClose, ahk_class AutoHotkeyGUI, %kInstanceGuiFcnPopupmfk% ; make sure the previous popup is dead
129 | Gui, Add, Text, hidden, %kInstanceGuiFcnPopupmfk% ; add the ID text as hidden
130 |
131 | if popTitle ; if we have a title
132 | {
133 | if icoPath ; if we have an icon
134 | {
135 | Gui, Add, Picture, xm ym section glbl_fcn_popupmfk_DONE ,%icoPath% ; add the icon
136 | Gui, font, %kTitleStyle%, %kTitleTypeFace% ; add first the title (popTitle)
137 | Gui, Add, Text, ys glbl_fcn_popupmfk_DONE , %popTitle%
138 | }
139 | else ; otherwise
140 | {
141 | Gui, font, %kTitleStyle%, %kTitleTypeFace% ; add first the title (popTitle)
142 | Gui, Add, Text, xm ym section glbl_fcn_popupmfk_DONE , %popTitle%
143 | }
144 | Gui, font, s8 %kMessageStyle%, %kMessageTypeFace% ; now add the message (popMsg)
145 | Gui, Add, Text, xm glbl_fcn_popupmfk_DONE , %popMsg%
146 | }
147 | else ; otherwise
148 | {
149 | Gui, font, %kMessageStyle%, %kMessageTypeFace%
150 | if icoPath ; if we have an icon
151 | {
152 | Gui, Add, Picture, xm ym section glbl_fcn_popupmfk_DONE ,%icoPath% ; add the icon
153 | Gui, Add, Text, ys glbl_fcn_popupmfk_DONE, %popMsg% ; and the message
154 | }
155 | else ; add the only the message (popMsg)
156 | Gui, Add, Text, xm ym glbl_fcn_popupmfk_DONE, %popMsg%
157 | }
158 |
159 | if hasGoAway ; if you want a go-away box...
160 | {
161 | ;Gui, font, s8 w700 c990000, Tahoma ; kludge go-away box by making a red [X]
162 | ;Gui, Add, Text, ys glbl_fcn_popupmfk_DONE , [X]
163 | Gui, font, s6 w400 ; kludge go-away box by making a button with a little x in it
164 | Gui, Add, Button, ym glbl_fcn_popupmfk_DONE , x
165 | }
166 | Gui, font
167 | ;Gui, +AlwaysOnTop +toolwindow -resize -caption +border [DWD moved up]
168 | Gui, Color, ffffdd
169 | ; position the thing at (monWorkAreaRight-GuiWidth, monWorkAreaBottom-GuiHeight
170 | SysGet, popup_monWorkArea, MonitorWorkArea ; get the primary monitor's client area
171 | Gui, Show, x%popup_monWorkAreaRight% y%popup_monWorkAreaBottom% NoActivate ; first show a "hidden" window (offscreen)
172 | WinWait , ahk_class AutoHotkeyGUI, %kInstanceGuiFcnPopupmfk%
173 | WinGetPos ,,, GuiWidth, GuiHeight, ahk_class AutoHotkeyGUI, %kInstanceGuiFcnPopupmfk% ; and get its dimensions
174 | popup_x := popup_monWorkAreaRight-GuiWidth
175 | popup_y := popup_monWorkAreaBottom-GuiHeight
176 | Gui, Show, x%popup_x% y%popup_y% NoActivate ; now show the window for real
177 | WinWait , ahk_class AutoHotkeyGUI, %kInstanceGuiFcnPopupmfk%
178 | SetTimer, lbl_fcn_popupmfk_DONE, %popTime%
179 | }
180 | return
181 |
182 | lbl_fcn_popupmfk_DONE:
183 | SetTimer, lbl_fcn_popupmfk_DONE, Off
184 | Gui, Destroy
185 | return
186 | }
187 |
--------------------------------------------------------------------------------
/caps_as_window_switcher.ahk:
--------------------------------------------------------------------------------
1 |
2 | ; capslock as ctrl+alt+tab i.e. show window switcher
3 | ; enable/disable capslock with shift+capslock
4 |
5 | ; run script as admin (reload if not as admin)
6 | if not A_IsAdmin
7 | {
8 | Run *RunAs "%A_ScriptFullPath%" ; Requires v1.0.92.01+
9 | ExitApp
10 | }
11 |
12 | #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
13 | ; #Warn ; Enable warnings to assist with detecting common errors.
14 | SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
15 | SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
16 | #SingleInstance Force
17 | SetTitleMatchMode 2
18 |
19 |
20 | +CapsLock::CapsLock
21 |
22 | CapsLock::
23 | Send, ^!{Tab}
24 | return
--------------------------------------------------------------------------------
/create_file_here.ahk:
--------------------------------------------------------------------------------
1 | ; ctrl+shift+m: create empty text file (NewFile.txt) at current folder location in file explorer
2 |
3 | ; run script as admin (reload if not as admin)
4 | if not A_IsAdmin
5 | {
6 | Run *RunAs "%A_ScriptFullPath%" ; Requires v1.0.92.01+
7 | ExitApp
8 | }
9 | #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
10 | ; #Warn ; Enable warnings to assist with detecting common errors.
11 | SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
12 | SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
13 | #SingleInstance force
14 |
15 | #IfWinActive ahk_class CabinetWClass
16 | ^+m::
17 | newFileHere()
18 | return
19 | #IfWinActive
20 |
21 | newFileHere(){
22 | WinHWND := WinActive()
23 | For win in ComObjCreate("Shell.Application").Windows
24 | If (win.HWND = WinHWND) {
25 | dir := SubStr(win.LocationURL, 9) ; remove "file:///"
26 | dir := RegExReplace(dir, "%20", " ")
27 | Break
28 | }
29 |
30 | file = %dir%/NewFile.txt
31 | if FileExist(file)
32 | {
33 | MsgBox, NewFile.txt already exists
34 | return
35 | }
36 | FileAppend,, %file% ; create new file
37 | }
38 |
--------------------------------------------------------------------------------
/ctrl_caps_as_case_change.ahk:
--------------------------------------------------------------------------------
1 | ; ctrl+capslock to show text case change menu
2 |
3 |
4 | ; run script as admin (reload if not as admin)
5 |
6 | if not A_IsAdmin
7 | {
8 | Run *RunAs "%A_ScriptFullPath%" ; Requires v1.0.92.01+
9 | ExitApp
10 | }
11 |
12 | #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
13 | ; #Warn ; Enable warnings to assist with detecting common errors.
14 | SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
15 | SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
16 | #SingleInstance Force
17 | SetTitleMatchMode 2
18 |
19 | GroupAdd All
20 |
21 | Menu Case, Add, &UPPERCASE, CCase
22 | Menu Case, Add, &lowercase, CCase
23 | Menu Case, Add, &Title Case, CCase
24 | Menu Case, Add, &Sentence case, CCase
25 | Menu Case, Add
26 | Menu Case, Add, &Fix Linebreaks, CCase
27 | Menu Case, Add, &Reverse, CCase
28 |
29 |
30 | ^CapsLock::
31 | GetText(TempText)
32 | If NOT ERRORLEVEL
33 | Menu Case, Show
34 | Return
35 |
36 | CCase:
37 | If (A_ThisMenuItemPos = 1)
38 | StringUpper, TempText, TempText
39 | Else If (A_ThisMenuItemPos = 2)
40 | StringLower, TempText, TempText
41 | Else If (A_ThisMenuItemPos = 3)
42 | StringLower, TempText, TempText, T
43 | Else If (A_ThisMenuItemPos = 4)
44 | {
45 | StringLower, TempText, TempText
46 | TempText := RegExReplace(TempText, "((?:^|[.!?]\s+)[a-z])", "$u1")
47 | } ;Seperator, no 5
48 | Else If (A_ThisMenuItemPos = 6)
49 | {
50 | TempText := RegExReplace(TempText, "\R", "`r`n")
51 | }
52 | Else If (A_ThisMenuItemPos = 7)
53 | {
54 | Temp2 =
55 | StringReplace, TempText, TempText, `r`n, % Chr(29), All
56 | Loop Parse, TempText
57 | Temp2 := A_LoopField . Temp2
58 | StringReplace, TempText, Temp2, % Chr(29), `r`n, All
59 | }
60 | PutText(TempText)
61 | Return
62 |
63 | ; Handy function.
64 | ; Copies the selected text to a variable while preserving the clipboard.
65 | GetText(ByRef MyText = "")
66 | {
67 | SavedClip := ClipboardAll
68 | Clipboard =
69 | Send ^c
70 | ClipWait 0.5
71 | If ERRORLEVEL
72 | {
73 | Clipboard := SavedClip
74 | MyText =
75 | Return
76 | }
77 | MyText := Clipboard
78 | Clipboard := SavedClip
79 | Return MyText
80 | }
81 |
82 | ; Pastes text from a variable while preserving the clipboard.
83 | PutText(MyText)
84 | {
85 | SavedClip := ClipboardAll
86 | Clipboard = ; For better compatability
87 | Sleep 20 ; with Clipboard History
88 | Clipboard := MyText
89 | Send ^v
90 | Sleep 100
91 | Clipboard := SavedClip
92 | Return
93 | }
--------------------------------------------------------------------------------
/disable_scroll_zoom_edge.ahk:
--------------------------------------------------------------------------------
1 | ; disable zoom when doing ctrl+scroll in edge browser
2 |
3 | #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
4 | ; #Warn ; Enable warnings to assist with detecting common errors.
5 | SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
6 | SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
7 |
8 | SetTitleMatchMode, 2 ; window title can contain text anywhere inside
9 | #IfWinActive, Microsoft Edge ; if the title contains "Microsoft Edge"
10 | #MaxHotkeysPerInterval 200
11 | $^WheelDown::Return ; ctrl-wheel-down
12 | #MaxHotkeysPerInterval 200
13 | $^WheelUp::Return ; ctrl-wheel-up
14 |
--------------------------------------------------------------------------------
/drafts/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GorvGoyl/Autohotkey-Scripts-Windows/fee515400efda5b9c23ea16ba004400e2e6ba00a/drafts/.DS_Store
--------------------------------------------------------------------------------
/drafts/BatteryRun/BatteryRun.ahk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GorvGoyl/Autohotkey-Scripts-Windows/fee515400efda5b9c23ea16ba004400e2e6ba00a/drafts/BatteryRun/BatteryRun.ahk
--------------------------------------------------------------------------------
/drafts/BatteryRun/BatteryRun.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GorvGoyl/Autohotkey-Scripts-Windows/fee515400efda5b9c23ea16ba004400e2e6ba00a/drafts/BatteryRun/BatteryRun.exe
--------------------------------------------------------------------------------
/drafts/BatteryRun/BatteryRun.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GorvGoyl/Autohotkey-Scripts-Windows/fee515400efda5b9c23ea16ba004400e2e6ba00a/drafts/BatteryRun/BatteryRun.gif
--------------------------------------------------------------------------------
/drafts/CloseFence/CloseFence.ahk:
--------------------------------------------------------------------------------
1 | ;CloseFence.ahk
2 | ; Prevents the autohiding Taskbar from appearing when the mouse is over a Close button (X)
3 | ; Save as CloseFence.ahk and install AutoHotkey from www.autohotkey.com
4 | ;Skrommel @2005
5 |
6 | #SingleInstance,Force
7 | SetWinDelay,0
8 |
9 | applicationname=CloseFence
10 |
11 | Gosub,INIREAD
12 | Gosub,TRAYMENU
13 |
14 | START:
15 | Gui,1:Destroy
16 | x1:=A_ScreenWidth-width-Thickness
17 | Gui,1:+ToolWindow -Caption +Border -Resize +AlwaysOnTop
18 | Gui,1:Show
19 | WinGet,id1,ID,A
20 | WinMove,ahk_id %id1%,,%x1%,0,%width%,%thickness%
21 | If hide<>0
22 | WinSet,Transparent,1,ahk_id %id1%
23 |
24 | Gui,2:Destroy
25 | x2:=A_ScreenWidth-thickness
26 | Gui,2:+ToolWindow -Caption +Border -Resize +AlwaysOnTop
27 | Gui,2:Show
28 | WinGet,id2,ID,A
29 | WinMove,ahk_id %id2%,,%x2%,0,%thickness%,%height%
30 | If hide<>0
31 | WinSet,Transparent,1,ahk_id %id2%
32 |
33 | Loop
34 | {
35 | Sleep,25
36 | MouseGetPos,,,id
37 | If (id=id1)
38 | MouseMove,0,%thickness%,0,R
39 | If (id=id2)
40 | MouseMove,-%thickness%,0,0,R
41 | }
42 | Return
43 |
44 | TRAYMENU:
45 | Menu,Tray,NoStandard
46 | Menu,Tray,DeleteAll
47 | Menu,Tray,Add,%applicationname%,ABOUT
48 | Menu,Tray,Add,
49 | Menu,Tray,Add,&Settings...,SETTINGS
50 | Menu,Tray,Add,&About...,ABOUT
51 | Menu,Tray,Add,E&xit,EXIT
52 | Menu,Tray,Default,%applicationname%
53 | Menu,Tray,Tip,%applicationname%
54 | Return
55 |
56 |
57 | SETTINGS:
58 | Gui,Destroy
59 | Gui,Add,GroupBox,xm y+10 w170 h50,&Width
60 | Gui,Add,Edit,xp+10 yp+20 w150 vowidth,%width%
61 | Gui,Add,GroupBox,xm y+20 w170 h50,&Height
62 | Gui,Add,Edit,xp+10 yp+20 w150 voheight,%height%
63 | Gui,Add,GroupBox,xm y+20 w170 h50,&Thickness
64 | Gui,Add,Edit,xp+10 yp+20 w150 vothickness,%thickness%
65 | checked=
66 | If hide=1
67 | checked=Checked
68 | Gui,Add,GroupBox,xm y+20 w170 h50,&Hidden
69 | Gui,Add,CheckBox,xp+10 yp+20 w150 %checked% vohide,Hide the fence
70 |
71 | Gui,Add,Button,xm y+30 w75 GSETTINGSOK,&OK
72 | Gui,Add,Button,x+5 w75 GSETTINGSCANCEL,&Cancel
73 | Gui,Show,,%applicationname% Settings
74 | Return
75 |
76 | SETTINGSOK:
77 | Gui,Submit
78 | If owidth>0
79 | width:=owidth
80 | If oheight>0
81 | height:=oheight
82 | If othickness>0
83 | thickness:=othickness
84 | If (ohide=0 Or ohide=1)
85 | hide:=ohide
86 | Gosub,INIWRITE
87 | Gosub,START
88 | Return
89 |
90 | SETTINGSCANCEL:
91 | Gui,Destroy
92 | Return
93 |
94 |
95 | INIREAD:
96 | IfNotExist,%applicationname%.ini
97 | {
98 | width:=100 ; Width of the fence above the close button
99 | height:=50 ; Height of the fence to the right of the close button
100 | thickness:=3 ; Thickness of the fence
101 | hide:=1 ; Hide the fence
102 | Gosub,INIWRITE
103 | }
104 | IniRead,width,%applicationname%.ini,Settings,width
105 | IniRead,height,%applicationname%.ini,Settings,height
106 | IniRead,thickness,%applicationname%.ini,Settings,thickness
107 | IniRead,hide,%applicationname%.ini,Settings,hide
108 | Return
109 |
110 | INIWRITE:
111 | IniWrite,%width%,%applicationname%.ini,Settings,width
112 | IniWrite,%height%,%applicationname%.ini,Settings,height
113 | IniWrite,%thickness%,%applicationname%.ini,Settings,thickness
114 | IniWrite,%hide%,%applicationname%.ini,Settings,hide
115 | Return
116 |
117 |
118 | ABOUT:
119 | Gui,99:Destroy
120 | Gui,99:Margin,20,20
121 | Gui,99:Add,Picture,xm Icon1,%applicationname%.exe
122 | Gui,99:Font,Bold
123 | Gui,99:Add,Text,x+10 yp+10,%applicationname% v1.0
124 | Gui,99:Font
125 | Gui,99:Add,Text,y+10,- Prevents an autohiding Taskbar from appearing
126 | Gui,99:Add,Text,y+5 ,when the mouse is over a Close button (X).
127 | Gui,99:Add,Text,y+10,- To change the settings, choose Settings in the tray menu.
128 |
129 | Gui,99:Add,Picture,xm y+20 Icon5,%applicationname%.exe
130 | Gui,99:Font,Bold
131 | Gui,99:Add,Text,x+10 yp+10,1 Hour Software by Skrommel
132 | Gui,99:Font
133 | Gui,99:Add,Text,y+10,For more tools, information and donations, please visit
134 | Gui,99:Font,CBlue Underline
135 | Gui,99:Add,Text,y+5 G1HOURSOFTWARE,www.1HourSoftware.com
136 | Gui,99:Font
137 |
138 | Gui,99:Add,Picture,xm y+20 Icon7,%applicationname%.exe
139 | Gui,99:Font,Bold
140 | Gui,99:Add,Text,x+10 yp+10,DonationCoder
141 | Gui,99:Font
142 | Gui,99:Add,Text,y+10,Please support the contributors at
143 | Gui,99:Font,CBlue Underline
144 | Gui,99:Add,Text,y+5 GDONATIONCODER,www.DonationCoder.com
145 | Gui,99:Font
146 |
147 | Gui,99:Add,Picture,xm y+20 Icon6,%applicationname%.exe
148 | Gui,99:Font,Bold
149 | Gui,99:Add,Text,x+10 yp+10,AutoHotkey
150 | Gui,99:Font
151 | Gui,99:Add,Text,y+10,This tool was made using the powerful
152 | Gui,99:Font,CBlue Underline
153 | Gui,99:Add,Text,y+5 GAUTOHOTKEY,www.AutoHotkey.com
154 | Gui,99:Font
155 |
156 | Gui,99:Show,,%applicationname% About
157 | hCurs:=DllCall("LoadCursor","UInt",NULL,"Int",32649,"UInt") ;IDC_HAND
158 | OnMessage(0x200,"WM_MOUSEMOVE")
159 | Return
160 |
161 | 1HOURSOFTWARE:
162 | Run,http://www.1hoursoftware.com,,UseErrorLevel
163 | Return
164 |
165 | DONATIONCODER:
166 | Run,http://www.donationcoder.com,,UseErrorLevel
167 | Return
168 |
169 | AUTOHOTKEY:
170 | Run,http://www.autohotkey.com,,UseErrorLevel
171 | Return
172 |
173 | 99GuiClose:
174 | Gui,99:Destroy
175 | OnMessage(0x200,"")
176 | DllCall("DestroyCursor","Uint",hCur)
177 | Return
178 |
179 | WM_MOUSEMOVE(wParam,lParam)
180 | {
181 | Global hCurs
182 | MouseGetPos,,,,ctrl
183 | If ctrl in Static9,Static13,Static17
184 | DllCall("SetCursor","UInt",hCurs)
185 | Return
186 | }
187 | Return
188 |
189 | EXIT:
190 | ExitApp
--------------------------------------------------------------------------------
/drafts/CloseFence/CloseFence.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GorvGoyl/Autohotkey-Scripts-Windows/fee515400efda5b9c23ea16ba004400e2e6ba00a/drafts/CloseFence/CloseFence.exe
--------------------------------------------------------------------------------
/drafts/CloseFence/CloseFence.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GorvGoyl/Autohotkey-Scripts-Windows/fee515400efda5b9c23ea16ba004400e2e6ba00a/drafts/CloseFence/CloseFence.gif
--------------------------------------------------------------------------------
/drafts/autocorrect with google.ahk:
--------------------------------------------------------------------------------
1 | ; Ctrl+Alt+c autocorrect selected text
2 | ^!c::
3 | clipback := ClipboardAll
4 | clipboard=
5 | Send ^c
6 | ClipWait, 0
7 | UrlDownloadToFile % "https://www.google.com/search?q=" . clipboard, temp
8 | FileRead, contents, temp
9 | FileDelete temp
10 | if (RegExMatch(contents, "(Showing results for|Did you mean:).*?>(.*?)", match)) {
11 | StringReplace, clipboard, match2, ,, All
12 | StringReplace, clipboard, clipboard, ,, All
13 | }
14 | Send ^v
15 | Sleep 500
16 | clipboard := clipback
17 | return
--------------------------------------------------------------------------------
/drafts/batterydeley/BatteryDeley.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GorvGoyl/Autohotkey-Scripts-Windows/fee515400efda5b9c23ea16ba004400e2e6ba00a/drafts/batterydeley/BatteryDeley.exe
--------------------------------------------------------------------------------
/drafts/batterydeley/BatteryDeley.ini:
--------------------------------------------------------------------------------
1 | ;BatteryDeley.ini
2 | ;[Settings]
3 | ; alert pct -- the percentage of battery charge remaining at which the alert is issued
4 | ; alert ms -- milliseconds to show the alert (1 second = 1000 ms)
5 | ; alert img -- image to show for alert (Place images in the same directory as this program, or change ImgPath below)
6 | ; alert cmd -- command to execute, or .wav file to play
7 | ; polling ms -- polling loop delay; (milliseconds between checks of battery state)
8 | ;
9 | ;KEEP THE ALERT PERCENTS IN DECREASING ORDER, WITH ALERT1 THE HIGHEST (FIRST ALERT TO BE TRIGGERED)
10 | ;and don't make the changes here, make them below under [Settings]
11 | ;alert1pct=90 ;alert1 battery percent (e.g. battery down to 22%)
12 | ;alert2pct=75 ;alert2 battery percent
13 | ;alert3pct=50 ;alert3 battery percent
14 | ;alert4pct=22 ;alert4 battery percent
15 | ;alert5pct=16 ;alert5 battery percent
16 | ;alert6pct=12 ;alert6 battery percent
17 | ;alert7pct= ;(We are not limited to 3 alerts. You may add alert 7,8,9,... as many as you please. Just keep them in decreasing order.)
18 | ;alert8pct= ;
19 | ;alert9pct= ;
20 | ;alert1ms=8000 ;alert1 milliseconds to show (8 seconds)(Change this to whatever you like.)
21 | ;alert2ms=8000 ;alert2 milliseconds to show (8 seconds)
22 | ;alert3ms=8000 ;alert3 milliseconds to show (8 seconds)
23 | ;alert4ms=10000 ;alert4 milliseconds to show (10 seconds)
24 | ;alert5ms=10000 ;alert5 milliseconds to show (10 seconds)
25 | ;alert6ms=30000 ;alert6 milliseconds to show (30 seconds)
26 | ;alert7ms= ;
27 | ;alert8ms= ;
28 | ;alert9ms= ;
29 | ;ImgPath=%A_ScriptDir% ; Place images in the same directory as this program. Or change this.
30 | ;alert1img=%ImgPath%\ClipartConnection_3775464_thm.jpg ;battery strong (Thank you to ClipartConnection.com for their images. My favorite place to get icons.)
31 | ;alert2img=%ImgPath%\ClipartConnection_3775464_thm.jpg ;battery strong (Thank you to ClipartConnection.com for their images. My favorite place to get icons.)
32 | ;alert3img=%ImgPath%\ClipartConnection_3775464_thm.jpg ;battery strong (Thank you to ClipartConnection.com for their images. My favorite place to get icons.)
33 | ;alert4img=%ImgPath%\ClipartConnection_3775464_thm.jpg ;battery strong (Thank you to ClipartConnection.com for their images. My favorite place to get icons.)
34 | ;alert5img=%ImgPath%\ClipartConnection_3700840.thm.jpg ;battery medium (you may use your own images if you wish)
35 | ;alert6img=%ImgPath%\ClipartConnection_3775471_thm.jpg ;battery weak
36 | ;alert7img=
37 | ;alert8img=
38 | ;alert9img=
39 | ;alert1cmd=C:\WINDOWS\media\notify.wav
40 | ;alert2cmd=C:\WINDOWS\media\notify.wav
41 | ;alert3cmd=C:\WINDOWS\media\notify.wav
42 | ;alert4cmd=C:\WINDOWS\media\notify.wav
43 | ;alert5cmd=C:\WINDOWS\media\notify.wav
44 | ;alert6cmd=C:\WINDOWS\media\notify.wav
45 | ;alert7cmd=
46 | ;alert8cmd=
47 | ;alert9cmd=
48 | ;ChargeAlert1pct=100 ;alert for battery charged up to this percent (e.g. battery charged up to 100%)
49 | ;ChargeAlert1ms=7000
50 | ;ChargeAlert1img=%ImgPath%\ClipartConnection_3775464_thm.jpg
51 | ;ChargeAlert1cmd=%windir%\media\notify.wav
52 | ;ChargeAlert2pct=
53 | ;ChargeAlert2ms=
54 | ;ChargeAlert2img=
55 | ;ChargeAlert2cmd=
56 | ;ChargeAlert3pct=
57 | ;ChargeAlert3ms=
58 | ;ChargeAlert3img=
59 | ;ChargeAlert3cmd=
60 | ;UNPLUGms=4000
61 | ;UNPLUGimg=%ImgPath%\ClipartConnection_3890038_thm.jpg ;image for unplug alert
62 | ;UNPLUGcmd=%windir%\media\notify.wav
63 | ;PLUGINms=8000
64 | ;PLUGINimg=%ImgPath%\ClipartConnection_3861328_thm.jpg ;image for plugged in alert
65 | ;PLUGINcmd=%windir%\media\notify.wav
66 | ;pollingms=8000
67 |
68 | [Settings]
69 | alert1pct=90
70 | alert2pct=80
71 | alert3pct=70
72 | alert4pct=60
73 | alert5pct=50
74 | alert6pct=40
75 | alert7pct=30
76 | alert8pct=20
77 | alert9pct=10
78 | alert10pct=5
79 | alert1ms=8000
80 | alert2ms=8000
81 | alert3ms=8000
82 | alert4ms=8000
83 | alert5ms=8000
84 | alert6ms=8000
85 | alert7ms=8000
86 | alert8ms=8000
87 | alert9ms=30000
88 | alert10ms=30000
89 | ImgPath=%A_ScriptDir%
90 | alert1img=%ImgPath%\ClipartConnection_3775464_thm.jpg
91 | alert2img=%ImgPath%\ClipartConnection_3775464_thm.jpg
92 | alert3img=%ImgPath%\ClipartConnection_3775464_thm.jpg
93 | alert4img=%ImgPath%\ClipartConnection_3775464_thm.jpg
94 | alert5img=%ImgPath%\ClipartConnection_3775464_thm.jpg
95 | alert6img=%ImgPath%\ClipartConnection_3775464_thm.jpg
96 | alert7img=%ImgPath%\ClipartConnection_3700840.thm.jpg
97 | alert8img=%ImgPath%\ClipartConnection_3700840.thm.jpg
98 | alert9img=%ImgPath%\ClipartConnection_3775471_thm.jpg
99 | alert10img=%ImgPath%\ClipartConnection_3775471_thm.jpg
100 | alert1cmd=%windir%\media\notify.wav
101 | alert2cmd=%windir%\media\notify.wav
102 | alert3cmd=%windir%\media\notify.wav
103 | alert4cmd=%windir%\media\notify.wav
104 | alert5cmd=%windir%\media\notify.wav
105 | alert6cmd=%windir%\media\notify.wav
106 | alert7cmd=%windir%\media\notify.wav
107 | alert8cmd=%windir%\media\notify.wav
108 | alert9cmd=%windir%\media\notify.wav
109 | alert10cmd=%windir%\media\notify.wav
110 | ChargeAlert1pct=100
111 | ChargeAlert1ms=7000
112 | ChargeAlert1img=%ImgPath%\ClipartConnection_3775464_thm.jpg
113 | ChargeAlert1cmd=%windir%\media\notify.wav
114 | UNPLUGms=7000
115 | UNPLUGimg=%ImgPath%\ClipartConnection_3890038_thm.jpg
116 | UNPLUGcmd=%windir%\media\notify.wav
117 | PLUGINms=7000
118 | PLUGINimg=%ImgPath%\ClipartConnection_3861328_thm.jpg
119 | PLUGINcmd=%windir%\media\notify.wav
120 | pollingms=8000
121 |
--------------------------------------------------------------------------------
/drafts/batterydeley/ClipartConnection_3700840.thm.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GorvGoyl/Autohotkey-Scripts-Windows/fee515400efda5b9c23ea16ba004400e2e6ba00a/drafts/batterydeley/ClipartConnection_3700840.thm.jpg
--------------------------------------------------------------------------------
/drafts/batterydeley/ClipartConnection_3775464_thm.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GorvGoyl/Autohotkey-Scripts-Windows/fee515400efda5b9c23ea16ba004400e2e6ba00a/drafts/batterydeley/ClipartConnection_3775464_thm.jpg
--------------------------------------------------------------------------------
/drafts/batterydeley/ClipartConnection_3775471_thm.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GorvGoyl/Autohotkey-Scripts-Windows/fee515400efda5b9c23ea16ba004400e2e6ba00a/drafts/batterydeley/ClipartConnection_3775471_thm.jpg
--------------------------------------------------------------------------------
/drafts/batterydeley/ClipartConnection_3861328_thm.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GorvGoyl/Autohotkey-Scripts-Windows/fee515400efda5b9c23ea16ba004400e2e6ba00a/drafts/batterydeley/ClipartConnection_3861328_thm.jpg
--------------------------------------------------------------------------------
/drafts/batterydeley/ClipartConnection_3890038_thm.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GorvGoyl/Autohotkey-Scripts-Windows/fee515400efda5b9c23ea16ba004400e2e6ba00a/drafts/batterydeley/ClipartConnection_3890038_thm.jpg
--------------------------------------------------------------------------------
/drafts/batterydeley/readme.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GorvGoyl/Autohotkey-Scripts-Windows/fee515400efda5b9c23ea16ba004400e2e6ba00a/drafts/batterydeley/readme.txt
--------------------------------------------------------------------------------
/drafts/batterydeley/source/BatteryDeley.ahk:
--------------------------------------------------------------------------------
1 | ;BatteryDeley.ahk
2 | ; Version 1.4 03/30/2011
3 | ; Alert user when laptop battery goes below set percentages
4 | ; Also alert when the power plug is connected or disconnected
5 | ; See file BatteryDeley.ini for settings (if there is no BatteryDeley.ini file, run this program and it will make one)
6 | ;
7 | ; David Deley @ 2009
8 | ; http://members.cox.net/deleyd/
9 | ;
10 | ; Pieced together from parts made by others:
11 | ; BatteryRun - by Skrommel (2007) http://www.donationcoder.com/Software/Skrommel/index.html#BatteryRun
12 | ; popupmfk - Mithat Konar (2007) http://www.autohotkey.net/~meter/scripts/popupmfkDevelopment_2k70729.zip
13 | ;
14 | ; See also PowerCircle battery monitor: http://powercircle.aldwin.us/
15 | ;
16 | ;Notes to myself:
17 | ; Icons:
18 | ; 1 - BatteryDeley.ico
19 | ; 2 - AutoHotKey white H
20 | ; 3 - deleylogo.ico
21 | ; 4 - AutoHotKey H slanted top (not used)
22 | ; 5 - AutoHotKey S (not used)
23 | ; 6 - AutoHotKey H
24 | ; 7 - Duck.ico
25 | ;
26 | ; colon-equal operator (:=) to store numbers, quoted strings
27 | ; equal sign operator (=) to assign unquoted literal strings or variables enclosed in percent signs.
28 |
29 | ; run script as admin (reload if not as admin)
30 | if not A_IsAdmin
31 | {
32 | Run *RunAs "%A_ScriptFullPath%" ; Requires v1.0.92.01+
33 | ExitApp
34 | }
35 |
36 | #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
37 | ; #Warn ; Enable warnings to assist with detecting common errors.
38 | SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
39 | SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
40 | #SingleInstance force
41 |
42 | if A_IsCompiled
43 | Menu, Tray, Icon, %A_ScriptFullPath%, -159 ;set tray icon
44 |
45 | applicationname=BatteryDeley
46 | SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
47 |
48 | Gosub,READINI
49 | Gosub,TRAYMENU
50 |
51 | VarSetCapacity(powerStatus, 1+1+1+1+4+4) ;Size of SYSTEM_POWER_STATUS Structure
52 | acLineStatus=FirstRun
53 | BatteryLifePercent=FirstRun
54 |
55 | GoSub GETSYSTEMPOWERSTATUS
56 | SetTimer,GETSYSTEMPOWERSTATUS, %pollingms% ;set the polling timer
57 | Return
58 |
59 |
60 | GETSYSTEMPOWERSTATUS: ;Stolen from anthonyb and others at http://www.autohotkey.com/forum/topic7633.html
61 | success:=DllCall("GetSystemPowerStatus", "UInt", &powerStatus)
62 | If (ErrorLevel != 0 Or success = 0)
63 | {
64 | MsgBox,0,%applicationname%,Can't get the power state. Error=%A_LastError%
65 | ExitApp
66 | }
67 |
68 | oldacLineStatus := acLineStatus
69 | acLineStatus := GetInteger(powerStatus, 0, false, 1)
70 | oldBatteryLifePercent := BatteryLifePercent
71 | BatteryLifePercent := GetInteger(powerStatus, 2, false, 1)
72 | If BatteryLifePercent = 255
73 | {
74 | BatteryLifePercent = ---
75 | ;MsgBox,0,%applicationname%,Can't get the battery power state unknown.
76 | ;ExitApp
77 | }
78 | Menu,Tray,Tip,Battery %BatteryLifePercent%`%
79 |
80 |
81 | ;Is it time for a low battery alert?
82 | ; (Note: We do this backwards, starting with the lowest percent alert,
83 | ; so we don't give an alert1 when we really should be giving an alert6
84 | ;MsgBox, 0, BatteryDeley, checking battery percentage`noldBatteryLifePercent=%oldBatteryLifePercent%`nnew BatteryLifePercent=%BatteryLifePercent%,1
85 | Do_Alert := FALSE
86 | loop,%NumAlerts%
87 | {
88 | i := NumAlerts - a_index + 1
89 | alertpct := alert%i%pct
90 | If (oldBatteryLifePercent > alertpct And BatteryLifePercent <= alertpct)
91 | {
92 | alertms := alert%i%ms
93 | alertimg := alert%i%img
94 | alertcmd := alert%i%cmd
95 | MsgRight = %BatteryLifePercent%`%
96 | Do_Alert := TRUE
97 | break
98 | }
99 | }
100 |
101 | ;Is it time for a battery charged alert?
102 | loop,%NumChargeAlerts%
103 | {
104 | i := NumChargeAlerts - a_index + 1
105 | ChargeAlertPct := ChargeAlert%i%pct
106 | If (oldBatteryLifePercent < ChargeAlertPct And BatteryLifePercent >= ChargeAlertPct)
107 | {
108 | alertms := ChargeAlert%i%ms
109 | alertimg := ChargeAlert%i%img
110 | alertcmd := ChargeAlert%i%cmd
111 | MsgRight = Battery charging.`n`nBattery`n%BatteryLifePercent%`%
112 | Do_Alert := TRUE
113 | break
114 | }
115 | }
116 |
117 | ;CHECK AC LINE STATUS
118 | ;do this last so it supersedes low battery alert
119 | ;MsgBox, 0, BatteryDeley, checking ac line status`noldacLineStatus=%oldacLineStatus%`nnew acLineStatus=%acLineStatus%,
120 | ; If (acLineStatus<>oldacLineStatus)
121 | ; {
122 | ; ;DID WE GET PLUGGED IN?
123 | ; If acLineStatus = 1 ; acLineStatus = Online
124 | ; {
125 | ; alertms := PLUGINms
126 | ; alertimg := PLUGINimg
127 | ; alertcmd := PLUGINcmd
128 | ; MsgRight = Plugged In`n`nBattery`n%BatteryLifePercent%`%
129 | ; Do_Alert := TRUE
130 | ; }
131 | ; ;DID WE GET UNPLUGGED?
132 | ; Else If acLineStatus = 0 ; acLineStatus = Offline
133 | ; {
134 | ; alertms := UNPLUGms
135 | ; alertimg := UNPLUGimg
136 | ; alertcmd := UNPLUGcmd
137 | ; MsgRight = Unplugged`n`nBattery`n%BatteryLifePercent%`%
138 | ; Do_Alert := TRUE
139 | ; }
140 | ; }
141 | If ( Do_Alert )
142 | {
143 | GoSub DOALERT
144 | }
145 | Return
146 |
147 |
148 | DOALERT:
149 | If (alertcmd != "")
150 | {
151 | SplitPath,alertcmd,name,dir,ext,name_no_ext,drive
152 | ;MsgBox, 0,SplitPath, alertcmd=%alertcmd%`nname=%name%`ndir=%dir%`next=%ext%`ndrive=%drive%,
153 | If ext In wav
154 | {
155 | ;MsgBox, 0, , SoundPlay alertcmd=%alertcmd%,
156 | SoundPlay,%alertcmd%
157 | }
158 | Else
159 | {
160 | ;MsgBox, 0, , Run alertcmd=%alertcmd%,
161 | Run,%alertcmd%,,UseErrorLevel
162 | }
163 | }
164 | If (alertms > 0)
165 | {
166 | MsgBelow := "Battery Deley" ;(Note: We need some text for MsgBelow or popupmfk won't display anything.)
167 | ;MsgBox, 0, , popup alertimg=%alertimg%,
168 | popupmfk(MsgRight, MsgBelow, alertms, alertimg, 1) ;popup a window
169 | ;Sleep %alertms%
170 | }
171 | Return
172 |
173 |
174 | GetInteger(ByRef @source, _offset = 0, _bIsSigned = false, _size = 4)
175 | {
176 | Local result
177 |
178 | Loop %_size% ; Build the integer by adding up its bytes.
179 | {
180 | result += *(&@source + _offset + A_Index-1) << 8*(A_Index-1)
181 | }
182 | If (!_bIsSigned OR _size > 4 OR result < 0x80000000)
183 | Return result ; Signed vs. unsigned doesn't matter in these cases.
184 | ; Otherwise, convert the value (now known to be 32-bit & negative) to its signed counterpart:
185 | Return -(0xFFFFFFFF - result + 1)
186 | }
187 |
188 |
189 |
190 | ;==============================================================================================;
191 | ; Functions
192 | ;==============================================================================================;
193 |
194 | popupmfk(popTitle=0, popMsg=0, popTime=3000, icoPath=0, hasGoAway=0)
195 | ; Displays a popup with popTitle and popMsg for popTime msec.
196 | ; If popTitle is missing, then only popMsg will appear.
197 | ; If you call popupmfk with no popMsg (or no parameters at all), it will kill the topmost popup.
198 | ; (In theory, you should only be showing one popup at a time anyway.)
199 | ; icoPath specifies the (optional) icon you want to show on the left-top of the popup
200 | ; Setting hasGoAway will make the popup have a (kludgey) go-away box. In either case,
201 | ; clicking on the popup's icon or any of the text will dismiss the popup.
202 | ; If a popup created by this function (even from outside this script) is already displayed, it will be
203 | ; killed and a new one will be shown.
204 | ;
205 | ; This function creates/uses the global kInstanceGuiFcnPopupmfk,
206 | ; you can use this global to test for popup windows outside this function.
207 | ; This function creates the following label: lbl_fcn_popupmfk_DONE
208 | ;
209 | {
210 | ; constants
211 | kInstanceGuiFcnPopupmfk = instance_gui_fcn_popupmfk_1 ; used to identify windows launched by this funciton
212 |
213 | kTitleTypeFace = Tahoma ; typeface of titles
214 | kTitleStyle = s8 w700 c000000 ; style for titles
215 | kMessageTypeFace = Tahoma ; typeface of message
216 | kMessageStyle = s8 w400 c000000 ; style for messages
217 |
218 | ; let's get to work
219 | DetectHiddenText, On ; we will need to make sure that we can detect hidden text
220 | ; I should store the state that DetectHiddenText is in before changing it so it can be reset later,
221 | ; sadly I am not aware of any reasonable way of querying the state of DetectHiddenText :-(
222 | IfWinExist, ahk_class AutoHotkeyGUI, %kInstanceGuiFcnPopupmfk% ; if a popup is already being displayed
223 | {
224 | gosub lbl_fcn_popupmfk_DONE ; kill popups and timer from this App
225 | WinKill, ahk_class AutoHotkeyGUI, %kInstanceGuiFcnPopupmfk% ; kill popups from other Apps
226 | ;WinWaitClose, ahk_class AutoHotkeyGUI, %kInstanceGuiFcnPopupmfk% ; make sure the previous popup is dead
227 | }
228 |
229 | if popMsg ; if a message is specified, pop up a new window
230 | {
231 | Gui, +AlwaysOnTop +toolwindow -resize -caption +border ;;DWD moved to here. Doc says, "For performance reasons, it is better to set all options in a single line, and to do so before creating the window (that is, before any use of other sub-commands such as Gui Add)."
232 | ;WinWaitClose, ahk_class AutoHotkeyGUI, %kInstanceGuiFcnPopupmfk% ; make sure the previous popup is dead
233 | Gui, Add, Text, hidden, %kInstanceGuiFcnPopupmfk% ; add the ID text as hidden
234 |
235 | if popTitle ; if we have a title
236 | {
237 | if icoPath ; if we have an icon
238 | {
239 | Gui, Add, Picture, xm ym section glbl_fcn_popupmfk_DONE ,%icoPath% ; add the icon
240 | Gui, font, %kTitleStyle%, %kTitleTypeFace% ; add first the title (popTitle)
241 | Gui, Add, Text, ys glbl_fcn_popupmfk_DONE , %popTitle%
242 | }
243 | else ; otherwise
244 | {
245 | Gui, font, %kTitleStyle%, %kTitleTypeFace% ; add first the title (popTitle)
246 | Gui, Add, Text, xm ym section glbl_fcn_popupmfk_DONE , %popTitle%
247 | }
248 | Gui, font, s8 %kMessageStyle%, %kMessageTypeFace% ; now add the message (popMsg)
249 | Gui, Add, Text, xm glbl_fcn_popupmfk_DONE , %popMsg%
250 | }
251 | else ; otherwise
252 | {
253 | Gui, font, %kMessageStyle%, %kMessageTypeFace%
254 | if icoPath ; if we have an icon
255 | {
256 | Gui, Add, Picture, xm ym section glbl_fcn_popupmfk_DONE ,%icoPath% ; add the icon
257 | Gui, Add, Text, ys glbl_fcn_popupmfk_DONE, %popMsg% ; and the message
258 | }
259 | else ; add the only the message (popMsg)
260 | Gui, Add, Text, xm ym glbl_fcn_popupmfk_DONE, %popMsg%
261 | }
262 |
263 | if hasGoAway ; if you want a go-away box...
264 | {
265 | ;Gui, font, s8 w700 c990000, Tahoma ; kludge go-away box by making a red [X]
266 | ;Gui, Add, Text, ys glbl_fcn_popupmfk_DONE , [X]
267 | Gui, font, s6 w400 ; kludge go-away box by making a button with a little x in it
268 | Gui, Add, Button, ym glbl_fcn_popupmfk_DONE , x
269 | }
270 | Gui, font
271 | ;Gui, +AlwaysOnTop +toolwindow -resize -caption +border [DWD moved up]
272 | Gui, Color, ffffdd
273 | ; position the thing at (monWorkAreaRight-GuiWidth, monWorkAreaBottom-GuiHeight
274 | SysGet, popup_monWorkArea, MonitorWorkArea ; get the primary monitor's client area
275 | Gui, Show, x%popup_monWorkAreaRight% y%popup_monWorkAreaBottom% NoActivate ; first show a "hidden" window (offscreen)
276 | WinWait , ahk_class AutoHotkeyGUI, %kInstanceGuiFcnPopupmfk%
277 | WinGetPos ,,, GuiWidth, GuiHeight, ahk_class AutoHotkeyGUI, %kInstanceGuiFcnPopupmfk% ; and get its dimensions
278 | popup_x := popup_monWorkAreaRight-GuiWidth
279 | popup_y := popup_monWorkAreaBottom-GuiHeight
280 | Gui, Show, x%popup_x% y%popup_y% NoActivate ; now show the window for real
281 | WinWait , ahk_class AutoHotkeyGUI, %kInstanceGuiFcnPopupmfk%
282 | SetTimer, lbl_fcn_popupmfk_DONE, %popTime%
283 | }
284 | return
285 |
286 | lbl_fcn_popupmfk_DONE:
287 | SetTimer, lbl_fcn_popupmfk_DONE, Off
288 | Gui, Destroy
289 | return
290 | }
291 |
292 |
293 | DeRefDeley(v)
294 | ; Keep translating over & over until all the variables have been expanded
295 | ; e.g.
296 | ; msg := "Today is %day%"
297 | ; day := "your %special% day"
298 | ; special := "%nth% birthday"
299 | ; nth := "18th"
300 | ; s := DeRefDeley(msg)
301 | ; MsgBox s=%s%
302 | ; ExitApp
303 | ;resulting message is: "Today is your 18th birthday day"
304 | ;(apply some reasonable upper bound on the loop)
305 | {
306 | loop,20
307 | {
308 | Transform, w, deref, %v%
309 | ;MsgBox v=%v%`nw=%w%
310 | if (w = v)
311 | {
312 | Return (w)
313 | }
314 | v := w
315 | }
316 | Return ("DeRefDeley looped 20 times and gave up") ;hopefully this never happens
317 | }
318 |
319 |
320 | TRAYMENU:
321 | Menu,Tray,NoStandard
322 | Menu,Tray,DeleteAll
323 | Menu,Tray,Add,%applicationname%,ABOUT
324 |
325 | Menu,Tray,Add,&Settings,SETTINGS
326 | Menu,Tray,Add,R&eload settings,RELOAD
327 |
328 | Menu,Tray,Add
329 | Menu,Tray,Add,&About,ABOUT
330 | Menu,Tray,Add,E&xit,EXIT
331 | Menu,Tray,Default,%applicationname%
332 | Menu,Tray,Tip,%applicationname%
333 | Return
334 |
335 | SETTINGS:
336 | Gosub,READINI
337 | Run,BatteryDeley.ini
338 | Return
339 |
340 |
341 | RELOAD:
342 | Reload
343 |
344 |
345 | READINI:
346 | IfNotExist,BatteryDeley.ini
347 | {
348 | ini=;BatteryDeley.ini
349 | ini=%ini%`n;[Settings]
350 | ini=%ini%`n; alert pct -- the percentage of battery charge remaining at which the alert is issued
351 | ini=%ini%`n; alert ms -- milliseconds to show the alert (1 second = 1000 ms)
352 | ini=%ini%`n; alert img -- image to show for alert (Place images in the same directory as this program, or change ImgPath below)
353 | ini=%ini%`n; alert cmd -- command to execute, or .wav file to play
354 | ini=%ini%`n; polling ms -- polling loop delay; (milliseconds between checks of battery state)
355 | ini=%ini%`n;
356 | ini=%ini%`n;KEEP THE ALERT PERCENTS IN DECREASING ORDER, WITH ALERT1 THE HIGHEST (FIRST ALERT TO BE TRIGGERED)
357 | ini=%ini%`n;and don't make the changes here, make them below under [Settings]
358 | ini=%ini%`n;alert1pct=90 `;alert1 battery percent (e.g. battery down to 22`%)
359 | ini=%ini%`n;alert2pct=75 `;alert2 battery percent
360 | ini=%ini%`n;alert3pct=50 `;alert3 battery percent
361 | ini=%ini%`n;alert4pct=22 `;alert4 battery percent
362 | ini=%ini%`n;alert5pct=16 `;alert5 battery percent
363 | ini=%ini%`n;alert6pct=12 `;alert6 battery percent
364 | ini=%ini%`n;alert7pct= `;(We are not limited to 3 alerts. You may add alert 7,8,9,... as many as you please. Just keep them in decreasing order.)
365 | ini=%ini%`n;alert8pct= `;
366 | ini=%ini%`n;alert9pct= `;
367 | ini=%ini%`n;alert1ms=8000 `;alert1 milliseconds to show (8 seconds)(Change this to whatever you like.)
368 | ini=%ini%`n;alert2ms=8000 `;alert2 milliseconds to show (8 seconds)
369 | ini=%ini%`n;alert3ms=8000 `;alert3 milliseconds to show (8 seconds)
370 | ini=%ini%`n;alert4ms=10000 `;alert4 milliseconds to show (10 seconds)
371 | ini=%ini%`n;alert5ms=10000 `;alert5 milliseconds to show (10 seconds)
372 | ini=%ini%`n;alert6ms=30000 `;alert6 milliseconds to show (30 seconds)
373 | ini=%ini%`n;alert7ms= `;
374 | ini=%ini%`n;alert8ms= `;
375 | ini=%ini%`n;alert9ms= `;
376 | ini=%ini%`n;ImgPath=`%A_ScriptDir`% `; Place images in the same directory as this program. Or change this.
377 | ini=%ini%`n;alert1img=`%ImgPath`%\ClipartConnection_3775464_thm.jpg `;battery strong (Thank you to ClipartConnection.com for their images. My favorite place to get icons.)
378 | ini=%ini%`n;alert2img=`%ImgPath`%\ClipartConnection_3775464_thm.jpg `;battery strong (Thank you to ClipartConnection.com for their images. My favorite place to get icons.)
379 | ini=%ini%`n;alert3img=`%ImgPath`%\ClipartConnection_3775464_thm.jpg `;battery strong (Thank you to ClipartConnection.com for their images. My favorite place to get icons.)
380 | ini=%ini%`n;alert4img=`%ImgPath`%\ClipartConnection_3775464_thm.jpg `;battery strong (Thank you to ClipartConnection.com for their images. My favorite place to get icons.)
381 | ini=%ini%`n;alert5img=`%ImgPath`%\ClipartConnection_3700840.thm.jpg `;battery medium (you may use your own images if you wish)
382 | ini=%ini%`n;alert6img=`%ImgPath`%\ClipartConnection_3775471_thm.jpg `;battery weak
383 | ini=%ini%`n;alert7img=
384 | ini=%ini%`n;alert8img=
385 | ini=%ini%`n;alert9img=
386 | ini=%ini%`n;alert1cmd=%windir%\media\notify.wav
387 | ini=%ini%`n;alert2cmd=%windir%\media\notify.wav
388 | ini=%ini%`n;alert3cmd=%windir%\media\notify.wav
389 | ini=%ini%`n;alert4cmd=%windir%\media\notify.wav
390 | ini=%ini%`n;alert5cmd=%windir%\media\notify.wav
391 | ini=%ini%`n;alert6cmd=%windir%\media\notify.wav
392 | ini=%ini%`n;alert7cmd=
393 | ini=%ini%`n;alert8cmd=
394 | ini=%ini%`n;alert9cmd=
395 | ini=%ini%`n;ChargeAlert1pct=100 `;alert for battery charged up to this percent (e.g. battery charged up to 100`%)
396 | ini=%ini%`n;ChargeAlert1ms=7000
397 | ini=%ini%`n;ChargeAlert1img=`%ImgPath`%\ClipartConnection_3775464_thm.jpg
398 | ini=%ini%`n;ChargeAlert1cmd=`%windir`%\media\notify.wav
399 | ini=%ini%`n;ChargeAlert2pct=
400 | ini=%ini%`n;ChargeAlert2ms=
401 | ini=%ini%`n;ChargeAlert2img=
402 | ini=%ini%`n;ChargeAlert2cmd=
403 | ini=%ini%`n;ChargeAlert3pct=
404 | ini=%ini%`n;ChargeAlert3ms=
405 | ini=%ini%`n;ChargeAlert3img=
406 | ini=%ini%`n;ChargeAlert3cmd=
407 | ini=%ini%`n;UNPLUGms=4000 ;milliseconds to show alert for external power was recently unplugged (4000 = 4 seconds)
408 | ini=%ini%`n;UNPLUGimg=`%ImgPath`%\ClipartConnection_3890038_thm.jpg `;image for unplug alert
409 | ini=%ini%`n;UNPLUGcmd=`%windir`%\media\notify.wav
410 | ini=%ini%`n;PLUGINms=8000 ;milliseconds to show alert for external power was recently plugged in (2000 = 2 seconds)
411 | ini=%ini%`n;PLUGINimg=`%ImgPath`%\ClipartConnection_3861328_thm.jpg `;image for plugged in alert
412 | ini=%ini%`n;PLUGINcmd=`%windir`%\media\notify.wav
413 | ini=%ini%`n;pollingms=8000 ;polling period (how often battery status is checked)
414 | ini=%ini%`n
415 | ini=%ini%`n[Settings]
416 | ini=%ini%`nalert1pct=90
417 | ini=%ini%`nalert2pct=80
418 | ini=%ini%`nalert3pct=70
419 | ini=%ini%`nalert4pct=60
420 | ini=%ini%`nalert5pct=50
421 | ini=%ini%`nalert6pct=40
422 | ini=%ini%`nalert7pct=30
423 | ini=%ini%`nalert8pct=20
424 | ini=%ini%`nalert9pct=10
425 | ini=%ini%`nalert10pct=5
426 | ini=%ini%`nalert1ms=8000
427 | ini=%ini%`nalert2ms=8000
428 | ini=%ini%`nalert3ms=8000
429 | ini=%ini%`nalert4ms=8000
430 | ini=%ini%`nalert5ms=8000
431 | ini=%ini%`nalert6ms=8000
432 | ini=%ini%`nalert7ms=8000
433 | ini=%ini%`nalert8ms=8000
434 | ini=%ini%`nalert9ms=30000
435 | ini=%ini%`nalert10ms=30000
436 | ini=%ini%`nImgPath=`%A_ScriptDir`%
437 | ini=%ini%`nalert1img=`%ImgPath`%\ClipartConnection_3775464_thm.jpg
438 | ini=%ini%`nalert2img=`%ImgPath`%\ClipartConnection_3775464_thm.jpg
439 | ini=%ini%`nalert3img=`%ImgPath`%\ClipartConnection_3775464_thm.jpg
440 | ini=%ini%`nalert4img=`%ImgPath`%\ClipartConnection_3775464_thm.jpg
441 | ini=%ini%`nalert5img=`%ImgPath`%\ClipartConnection_3775464_thm.jpg
442 | ini=%ini%`nalert6img=`%ImgPath`%\ClipartConnection_3775464_thm.jpg
443 | ini=%ini%`nalert7img=`%ImgPath`%\ClipartConnection_3700840.thm.jpg
444 | ini=%ini%`nalert8img=`%ImgPath`%\ClipartConnection_3700840.thm.jpg
445 | ini=%ini%`nalert9img=`%ImgPath`%\ClipartConnection_3775471_thm.jpg
446 | ini=%ini%`nalert10img=`%ImgPath`%\ClipartConnection_3775471_thm.jpg
447 | ini=%ini%`nalert1cmd=`%windir`%\media\notify.wav
448 | ini=%ini%`nalert2cmd=`%windir`%\media\notify.wav
449 | ini=%ini%`nalert3cmd=`%windir`%\media\notify.wav
450 | ini=%ini%`nalert4cmd=`%windir`%\media\notify.wav
451 | ini=%ini%`nalert5cmd=`%windir`%\media\notify.wav
452 | ini=%ini%`nalert6cmd=`%windir`%\media\notify.wav
453 | ini=%ini%`nalert7cmd=`%windir`%\media\notify.wav
454 | ini=%ini%`nalert8cmd=`%windir`%\media\notify.wav
455 | ini=%ini%`nalert9cmd=`%windir`%\media\notify.wav
456 | ini=%ini%`nalert10cmd=`%windir`%\media\notify.wav
457 | ini=%ini%`nChargeAlert1pct=100
458 | ini=%ini%`nChargeAlert1ms=7000
459 | ini=%ini%`nChargeAlert1img=`%ImgPath`%\ClipartConnection_3775464_thm.jpg
460 | ini=%ini%`nChargeAlert1cmd=`%windir`%\media\notify.wav
461 | ini=%ini%`nUNPLUGms=7000
462 | ini=%ini%`nUNPLUGimg=`%ImgPath`%\ClipartConnection_3890038_thm.jpg
463 | ini=%ini%`nUNPLUGcmd=`%windir`%\media\notify.wav
464 | ini=%ini%`nPLUGINms=7000
465 | ini=%ini%`nPLUGINimg=`%ImgPath`%\ClipartConnection_3861328_thm.jpg
466 | ini=%ini%`nPLUGINcmd=`%windir`%\media\notify.wav
467 | ini=%ini%`npollingms=8000
468 | ini=%ini%`n
469 | FileAppend,%ini%,BatteryDeley.ini
470 | ini=
471 | }
472 | IniRead,ImgPath,BatteryDeley.ini,Settings,ImgPath
473 | ;read in when to give battery draining alerts
474 | loop
475 | {
476 | IniRead, alert%A_Index%pct, BatteryDeley.ini, Settings, alert%A_Index%pct
477 | if (alert%A_Index%pct = "ERROR")
478 | {
479 | NumAlerts := A_Index - 1 ;We need to force expression mode. Note that variables go without % in expressions
480 | ;msgbox NumAlerts=%NumAlerts%
481 | break
482 | }
483 | IniRead, alert%A_Index%ms, BatteryDeley.ini, Settings, alert%A_Index%ms ;milliseconds to show alert
484 | IniRead, alert%A_Index%img, BatteryDeley.ini, Settings, alert%A_Index%img ;image to show for this alert
485 | alert%A_Index%img := DeRefDeley(alert%A_Index%img) ;translate %ImgPath%
486 | IniRead, alert%A_Index%cmd, BatteryDeley.ini, Settings, alert%A_Index%cmd ;command to run or .wav file to play for this alert
487 | alert%A_Index%cmd := DeRefDeley(alert%A_Index%cmd) ;translate %ImgPath%
488 | }
489 | ;read in when to give battery charging alerts
490 | loop
491 | {
492 | IniRead, ChargeAlert%A_Index%pct, BatteryDeley.ini, Settings, ChargeAlert%A_Index%pct
493 | if (ChargeAlert%A_Index%pct = "ERROR")
494 | {
495 | NumChargeAlerts := A_Index - 1 ;We need to force expression mode. Note that variables go without % in expressions
496 | ;msgbox NumChargeAlerts=%NumChargeAlerts%
497 | break
498 | }
499 | IniRead, ChargeAlert%A_Index%ms, BatteryDeley.ini, Settings, ChargeAlert%A_Index%ms ;milliseconds to show ChargeAlert
500 | IniRead, ChargeAlert%A_Index%img, BatteryDeley.ini, Settings, ChargeAlert%A_Index%img ;image to show for this ChargeAlert
501 | ChargeAlert%A_Index%img := DeRefDeley(ChargeAlert%A_Index%img) ;translate %ImgPath%
502 | IniRead, ChargeAlert%A_Index%cmd, BatteryDeley.ini, Settings, ChargeAlert%A_Index%cmd ;command to run or .wav file to play for this ChargeAlert
503 | ChargeAlert%A_Index%cmd := DeRefDeley(ChargeAlert%A_Index%cmd) ;translate %ImgPath%
504 | }
505 | IniRead, UNPLUGms, BatteryDeley.ini, Settings, UNPLUGms ;milliseconds to show alert when power is unplugged
506 | IniRead, UNPLUGimg, BatteryDeley.ini, Settings, UNPLUGimg ;image to show
507 | UNPLUGimg := DeRefDeley(UNPLUGimg)
508 | IniRead, UNPLUGcmd, BatteryDeley.ini, Settings, UNPLUGcmd ;command to run or .wav file to play for this alert
509 | UNPLUGcmd := DeRefDeley(UNPLUGcmd)
510 |
511 | IniRead, PLUGINms, BatteryDeley.ini, Settings, PLUGINms ;milliseconds to show alert when power is plugged in
512 | IniRead, PLUGINimg, BatteryDeley.ini, Settings, PLUGINimg ;image to show
513 | PLUGINimg := DeRefDeley(PLUGINimg)
514 | IniRead, PLUGINcmd, BatteryDeley.ini, Settings, PLUGINcmd ;command to run or .wav file to play for this alert
515 | PLUGINcmd := DeRefDeley(PLUGINcmd)
516 |
517 | IniRead, FULLms, BatteryDeley.ini, Settings, FULLms ;milliseconds to show alert when power is plugged in
518 | IniRead, FULLimg, BatteryDeley.ini, Settings, FULLimg ;image to show
519 | FULLimg := DeRefDeley(FULLimg)
520 | IniRead, FULLcmd, BatteryDeley.ini, Settings, FULLcmd ;command to run or .wav file to play for this alert
521 | FULLcmd := DeRefDeley(FULLcmd)
522 |
523 | IniRead, pollingms, BatteryDeley.ini, Settings, pollingms ;polling period
524 |
525 | /*
526 | ;FOR DEBUGGING
527 | v = ImgPath=%ImgPath%
528 | v = %v%`nalert1pct=%alert1pct%
529 | v = %v%`nalert2pct=%alert2pct%
530 | v = %v%`nalert3pct=%alert3pct%
531 | v = %v%`nalert4pct=%alert4pct%
532 | v = %v%`nalert5pct=%alert5pct%
533 | v = %v%`nalert6pct=%alert6pct%
534 |
535 | v = %v%`nalert1ms=%alert1ms%
536 | v = %v%`nalert2ms=%alert2ms%
537 | v = %v%`nalert3ms=%alert3ms%
538 | v = %v%`nalert4ms=%alert4ms%
539 | v = %v%`nalert5ms=%alert5ms%
540 | v = %v%`nalert6ms=%alert6ms%
541 |
542 | v = %v%`nalert1img=%alert1img%
543 | v = %v%`nalert2img=%alert2img%
544 | v = %v%`nalert3img=%alert3img%
545 | v = %v%`nalert4img=%alert4img%
546 | v = %v%`nalert5img=%alert5img%
547 | v = %v%`nalert6img=%alert6img%
548 |
549 | v = %v%`nalert1cmd=%alert1cmd%
550 | v = %v%`nalert2cmd=%alert2cmd%
551 | v = %v%`nalert3cmd=%alert3cmd%
552 | v = %v%`nalert4cmd=%alert4cmd%
553 | v = %v%`nalert5cmd=%alert5cmd%
554 | v = %v%`nalert6cmd=%alert6cmd%
555 |
556 | v = %v%`nPLUGINms =%PLUGINms%
557 | v = %v%`nPLUGINimg =%PLUGINimg%
558 | v = %v%`nPLUGINcmd =%PLUGINcmd%
559 | v = %v%`nUNPLUGms =%UNPLUGms%
560 | v = %v%`nUNPLUGimg=%UNPLUGimg%
561 | v = %v%`nUNPLUGcmd=%UNPLUGcmd%
562 | v = %v%`nFULLms =%FULLms%
563 | v = %v%`nFULLimg=%FULLimg%
564 | v = %v%`nFULLcmd=%FULLcmd%
565 |
566 | v = %v%`nNumAlerts=%NumAlerts%
567 | v = %v%`npollingms=%pollingms%
568 |
569 | MsgBox, 0, BatteryDeley, %v%
570 | */
571 | Return
572 |
573 |
574 | ABOUT:
575 | Gui,99:Destroy
576 | Gui,99:Margin,20,20
577 | Gui,99:Add,Picture,xm Icon1,%applicationname%.exe
578 | Gui,99:Font,Bold
579 | Gui,99:Add,Text,x+10 yp+10,%applicationname% v1.4
580 | Gui,99:Font
581 | Gui,99:Add,Text,y+10,- Alert user when laptop battery goes below set percentages
582 | Gui,99:Add,Text,y+5, - Also alert when the power plug is connected or disconnected
583 | Gui,99:Add,Text,y+5, - See file BatteryDeley.ini for settings
584 | Gui,99:Add,Text,xp+10 y+5,(if there is no BatteryDeley.ini file, run this program and it will make one)
585 | Gui,99:Add,Picture, xp-4 y+10 w16 h16 Icon3 GDELEYWEBSITE,%applicationname%.exe
586 | Gui,99:Add,Text,xp+20 ,David Deley:
587 | Gui,99:Font,CBlue Underline
588 | Gui,99:Add,Text,x+4 GDELEYWEBSITE,http://members.cox.net/deleyd/
589 | Gui,99:Font
590 |
591 | Gui,99:Add,Picture,xm y+20 Icon2 G1HOURSOFTWARE,%applicationname%.exe
592 | Gui,99:Font,Bold
593 | Gui,99:Add,Text,x+10 yp+10,1 Hour Software by Skrommel
594 | Gui,99:Font
595 | Gui,99:Add,Text,y+10,For more tools, information and donations, please visit
596 | Gui,99:Font,CBlue Underline
597 | Gui,99:Add,Text,y+5 G1HOURSOFTWARE,www.1HourSoftware.com
598 | Gui,99:Font
599 |
600 | Gui,99:Add,Picture,xm y+20 Icon7 GDONATIONCODER,%applicationname%.exe
601 | Gui,99:Font,Bold
602 | Gui,99:Add,Text,x+10 yp+10,DonationCoder
603 | Gui,99:Font
604 | Gui,99:Add,Text,y+10,Please support the contributors at
605 | Gui,99:Font,CBlue Underline
606 | Gui,99:Add,Text,y+5 GDONATIONCODER,www.DonationCoder.com
607 | Gui,99:Font
608 |
609 | Gui,99:Add,Picture,xm y+20 Icon6 GAUTOHOTKEY,%applicationname%.exe
610 | Gui,99:Font,Bold
611 | Gui,99:Add,Text,x+10 yp+10,AutoHotkey
612 | Gui,99:Font
613 | Gui,99:Add,Text,y+10,This tool was made using the powerful
614 | Gui,99:Font,CBlue Underline
615 | Gui,99:Add,Text,y+5 GAUTOHOTKEY,www.AutoHotkey.com
616 | Gui,99:Font
617 |
618 | Gui,99:Add,Button,GABOUTOK Default w75,&OK
619 |
620 | Gui,99:Show,,%applicationname% About
621 | hCurs:=DllCall("LoadCursor","UInt",NULL,"Int",32649,"UInt") ;IDC_HAND
622 | OnMessage(0x200,"WM_MOUSEMOVE")
623 | Return
624 |
625 | DELEYWEBSITE:
626 | Run,http://members.cox.net/deleyd/,,UseErrorLevel
627 | Return
628 |
629 | 1HOURSOFTWARE:
630 | Run,http://www.1hoursoftware.com,,UseErrorLevel
631 | Return
632 |
633 | DONATIONCODER:
634 | Run,http://www.donationcoder.com,,UseErrorLevel
635 | Return
636 |
637 | AUTOHOTKEY:
638 | Run,http://www.autohotkey.com,,UseErrorLevel
639 | Return
640 |
641 | ABOUTOK:
642 | Gui,99:Destroy
643 | OnMessage(0x200,"")
644 | DllCall("DestroyCursor","Uint",hCur)
645 | Return
646 |
647 | WM_MOUSEMOVE(wParam,lParam)
648 | {
649 | Global hCurs
650 | MouseGetPos,,,,ctrl
651 | If ctrl in Static7,Static9,Static10,Static13,Static14,Static17,Static18,Static21
652 | DllCall("SetCursor","UInt",hCurs)
653 | Return
654 | }
655 | Return
656 |
657 |
658 | EXIT:
659 | ExitApp
--------------------------------------------------------------------------------
/drafts/batterydeley/source/BatteryDeley.ini:
--------------------------------------------------------------------------------
1 | ;BatteryDeley.ini
2 | ;[Settings]
3 | ; alert pct -- the percentage of battery charge remaining at which the alert is issued
4 | ; alert ms -- milliseconds to show the alert (1 second = 1000 ms)
5 | ; alert img -- image to show for alert (Place images in the same directory as this program, or change ImgPath below)
6 | ; alert cmd -- command to execute, or .wav file to play
7 | ; polling ms -- polling loop delay; (milliseconds between checks of battery state)
8 | ;
9 | ;KEEP THE ALERT PERCENTS IN DECREASING ORDER, WITH ALERT1 THE HIGHEST (FIRST ALERT TO BE TRIGGERED)
10 | ;and don't make the changes here, make them below under [Settings]
11 | ;alert1pct=90 ;alert1 battery percent (e.g. battery down to 22%)
12 | ;alert2pct=75 ;alert2 battery percent
13 | ;alert3pct=50 ;alert3 battery percent
14 | ;alert4pct=22 ;alert4 battery percent
15 | ;alert5pct=16 ;alert5 battery percent
16 | ;alert6pct=12 ;alert6 battery percent
17 | ;alert7pct= ;(We are not limited to 3 alerts. You may add alert 7,8,9,... as many as you please. Just keep them in decreasing order.)
18 | ;alert8pct= ;
19 | ;alert9pct= ;
20 | ;alert1ms=8000 ;alert1 milliseconds to show (8 seconds)(Change this to whatever you like.)
21 | ;alert2ms=8000 ;alert2 milliseconds to show (8 seconds)
22 | ;alert3ms=8000 ;alert3 milliseconds to show (8 seconds)
23 | ;alert4ms=10000 ;alert4 milliseconds to show (10 seconds)
24 | ;alert5ms=10000 ;alert5 milliseconds to show (10 seconds)
25 | ;alert6ms=30000 ;alert6 milliseconds to show (30 seconds)
26 | ;alert7ms= ;
27 | ;alert8ms= ;
28 | ;alert9ms= ;
29 | ;ImgPath=%A_ScriptDir% ; Place images in the same directory as this program. Or change this.
30 | ;alert1img=%ImgPath%\ClipartConnection_3775464_thm.jpg ;battery strong (Thank you to ClipartConnection.com for their images. My favorite place to get icons.)
31 | ;alert2img=%ImgPath%\ClipartConnection_3775464_thm.jpg ;battery strong (Thank you to ClipartConnection.com for their images. My favorite place to get icons.)
32 | ;alert3img=%ImgPath%\ClipartConnection_3775464_thm.jpg ;battery strong (Thank you to ClipartConnection.com for their images. My favorite place to get icons.)
33 | ;alert4img=%ImgPath%\ClipartConnection_3775464_thm.jpg ;battery strong (Thank you to ClipartConnection.com for their images. My favorite place to get icons.)
34 | ;alert5img=%ImgPath%\ClipartConnection_3700840.thm.jpg ;battery medium (you may use your own images if you wish)
35 | ;alert6img=%ImgPath%\ClipartConnection_3775471_thm.jpg ;battery weak
36 | ;alert7img=
37 | ;alert8img=
38 | ;alert9img=
39 | ;alert1cmd=C:\WINDOWS\media\notify.wav
40 | ;alert2cmd=C:\WINDOWS\media\notify.wav
41 | ;alert3cmd=C:\WINDOWS\media\notify.wav
42 | ;alert4cmd=C:\WINDOWS\media\notify.wav
43 | ;alert5cmd=C:\WINDOWS\media\notify.wav
44 | ;alert6cmd=C:\WINDOWS\media\notify.wav
45 | ;alert7cmd=
46 | ;alert8cmd=
47 | ;alert9cmd=
48 | ;ChargeAlert1pct=100 ;alert for battery charged up to this percent (e.g. battery charged up to 100%)
49 | ;ChargeAlert1ms=7000
50 | ;ChargeAlert1img=%ImgPath%\ClipartConnection_3775464_thm.jpg
51 | ;ChargeAlert1cmd=%windir%\media\notify.wav
52 | ;ChargeAlert2pct=
53 | ;ChargeAlert2ms=
54 | ;ChargeAlert2img=
55 | ;ChargeAlert2cmd=
56 | ;ChargeAlert3pct=
57 | ;ChargeAlert3ms=
58 | ;ChargeAlert3img=
59 | ;ChargeAlert3cmd=
60 | ;UNPLUGms=4000
61 | ;UNPLUGimg=%ImgPath%\ClipartConnection_3890038_thm.jpg ;image for unplug alert
62 | ;UNPLUGcmd=%windir%\media\notify.wav
63 | ;PLUGINms=8000
64 | ;PLUGINimg=%ImgPath%\ClipartConnection_3861328_thm.jpg ;image for plugged in alert
65 | ;PLUGINcmd=%windir%\media\notify.wav
66 | ;pollingms=8000
67 |
68 | [Settings]
69 | alert1pct=100
70 | alert7pct=30
71 | alert8pct=20
72 | alert9pct=15
73 | alert10pct=10
74 | alert1ms=8000
75 | alert7ms=8000
76 | alert8ms=8000
77 | alert9ms=30000
78 | alert10ms=30000
79 | ImgPath=%A_ScriptDir%
80 | alert1img=%ImgPath%\ClipartConnection_3775464_thm.jpg
81 | alert7img=%ImgPath%\ClipartConnection_3700840.thm.jpg
82 | alert8img=%ImgPath%\ClipartConnection_3700840.thm.jpg
83 | alert9img=%ImgPath%\ClipartConnection_3775471_thm.jpg
84 | alert10img=%ImgPath%\ClipartConnection_3775471_thm.jpg
85 | alert1cmd=%windir%\media\notify.wav
86 | alert7cmd=%windir%\media\notify.wav
87 | alert8cmd=%windir%\media\notify.wav
88 | alert9cmd=%windir%\media\notify.wav
89 | alert10cmd=%windir%\media\notify.wav
90 | ChargeAlert1pct=100
91 | ChargeAlert1ms=7000
92 | ChargeAlert1img=%ImgPath%\ClipartConnection_3775464_thm.jpg
93 | ChargeAlert1cmd=%windir%\media\notify.wav
94 | pollingms=8000
--------------------------------------------------------------------------------
/drafts/batterydeley/source/CompileBatteryDeley.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GorvGoyl/Autohotkey-Scripts-Windows/fee515400efda5b9c23ea16ba004400e2e6ba00a/drafts/batterydeley/source/CompileBatteryDeley.gif
--------------------------------------------------------------------------------
/drafts/batterydeley/source/compile BatteryDeley.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GorvGoyl/Autohotkey-Scripts-Windows/fee515400efda5b9c23ea16ba004400e2e6ba00a/drafts/batterydeley/source/compile BatteryDeley.txt
--------------------------------------------------------------------------------
/drafts/batterydeley/source/icons/BatteryDeley.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GorvGoyl/Autohotkey-Scripts-Windows/fee515400efda5b9c23ea16ba004400e2e6ba00a/drafts/batterydeley/source/icons/BatteryDeley.ico
--------------------------------------------------------------------------------
/drafts/batterydeley/source/icons/Unused/ClipartConnection_3711731.thm.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GorvGoyl/Autohotkey-Scripts-Windows/fee515400efda5b9c23ea16ba004400e2e6ba00a/drafts/batterydeley/source/icons/Unused/ClipartConnection_3711731.thm.jpg
--------------------------------------------------------------------------------
/drafts/batterydeley/source/icons/Unused/ClipartConnection_3741228_thm.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GorvGoyl/Autohotkey-Scripts-Windows/fee515400efda5b9c23ea16ba004400e2e6ba00a/drafts/batterydeley/source/icons/Unused/ClipartConnection_3741228_thm.jpg
--------------------------------------------------------------------------------
/drafts/batterydeley/source/icons/Unused/ClipartConnection_3832348.thm.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GorvGoyl/Autohotkey-Scripts-Windows/fee515400efda5b9c23ea16ba004400e2e6ba00a/drafts/batterydeley/source/icons/Unused/ClipartConnection_3832348.thm.jpg
--------------------------------------------------------------------------------
/drafts/batterydeley/source/icons/Unused/ClipartConnection_3832351.thm.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GorvGoyl/Autohotkey-Scripts-Windows/fee515400efda5b9c23ea16ba004400e2e6ba00a/drafts/batterydeley/source/icons/Unused/ClipartConnection_3832351.thm.jpg
--------------------------------------------------------------------------------
/drafts/batterydeley/source/icons/Unused/ClipartConnection_3933645.thm.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GorvGoyl/Autohotkey-Scripts-Windows/fee515400efda5b9c23ea16ba004400e2e6ba00a/drafts/batterydeley/source/icons/Unused/ClipartConnection_3933645.thm.jpg
--------------------------------------------------------------------------------
/drafts/batterydeley/source/icons/deleylogo.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GorvGoyl/Autohotkey-Scripts-Windows/fee515400efda5b9c23ea16ba004400e2e6ba00a/drafts/batterydeley/source/icons/deleylogo.ico
--------------------------------------------------------------------------------
/drafts/batterydeley/source/icons/duck.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GorvGoyl/Autohotkey-Scripts-Windows/fee515400efda5b9c23ea16ba004400e2e6ba00a/drafts/batterydeley/source/icons/duck.ico
--------------------------------------------------------------------------------
/drafts/fix_win_backspace.ahk:
--------------------------------------------------------------------------------
1 | #IfWinActive, ahk_class CabinetWClass
2 | Backspace::
3 | ;make sure no renaming in process and we are actually in list or in tree
4 |
5 | ControlGet renamestatus,Visible,,Edit1,A
6 | ControlGetFocus focussed, A
7 | if(renamestatus!=1&&(focussed="DirectUIHWND3"||focussed="SysTreeView321"))
8 | {
9 | SendInput {Alt Down}{Up}{Alt Up}
10 | return
11 | }else{
12 | Send {Backspace}
13 | return
14 | }
--------------------------------------------------------------------------------
/drafts/window_tabs_switcher.ahk:
--------------------------------------------------------------------------------
1 |
2 | ; run script as admin (reload if not as admin)
3 | if not A_IsAdmin { Run *RunAs "%A_ScriptFullPath%" ExitApp }
4 |
5 | #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
6 | ; #Warn ; Enable warnings to assist with detecting common errors.
7 | SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
8 | SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
9 | #SingleInstance force
10 |
11 | ; alt+Q switches windows when file explorer has tabs
12 | #If WinActive("ahk_exe Explorer.EXE")
13 | $!Q:: ; Next window
14 | WinGetClass, ActiveClass, A
15 | WinSet, Bottom,, A
16 | WinActivate, ahk_class %ActiveClass%
17 | return
18 | $PgUp:: ; Last window
19 | WinGetClass, ActiveClass, A
20 | WinActivateBottom, ahk_class %ActiveClass%
21 | return
22 | #If
--------------------------------------------------------------------------------
/in-line-calculator/UNLICENSE:
--------------------------------------------------------------------------------
1 | This is free and unencumbered software released into the public domain.
2 |
3 | Anyone is free to copy, modify, publish, use, compile, sell, or
4 | distribute this software, either in source code form or as a compiled
5 | binary, for any purpose, commercial or non-commercial, and by any
6 | means.
7 |
8 | In jurisdictions that recognize copyright laws, the author or authors
9 | of this software dedicate any and all copyright interest in the
10 | software to the public domain. We make this dedication for the benefit
11 | of the public at large and to the detriment of our heirs and
12 | successors. We intend this dedication to be an overt act of
13 | relinquishment in perpetuity of all present and future rights to this
14 | software under copyright law.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 | OTHER DEALINGS IN THE SOFTWARE.
23 |
24 | For more information, please refer to
25 |
--------------------------------------------------------------------------------
/in-line-calculator/in-line calculator.ahk:
--------------------------------------------------------------------------------
1 | /*
2 | [script info]
3 | version = 2.5.3
4 | description = an interface-less calculator for basic math
5 | author = davebrny
6 | source = https://github.com/davebrny/in-line-calculator
7 | */
8 |
9 | ;# script settings
10 | #noEnv
11 | #singleInstance, force
12 | sendMode input
13 |
14 | ;# ini settings
15 | iniRead, section, % a_scriptDir "\settings.ini", settings
16 | loop, parse, % section, `n, `r
17 | {
18 | stringGetPos, pos, a_loopField, =, L1
19 | stringMid, ini_key, a_loopField, pos, , L
20 | stringMid, ini_value, a_loopField, pos + 2
21 | %ini_key% := ini_value
22 | }
23 |
24 | ;# tray menu stuff
25 | if (a_isCompiled = 1)
26 | menu, tray, add, Reload This Script, reload
27 | menu, tray, icon, % a_scriptDir "\in-line calculator.ico"
28 | start_with_windows(1) ; add the option to start the script when windows boots
29 | menu, tray, add, Github readme, open_github
30 |
31 | ;# group calculator apps
32 | groupAdd, calculators, Calculator ahk_exe ApplicationFrameHost.exe ; windows 10
33 | groupAdd, calculators, ahk_class CalcFrame ; windows classic
34 | groupAdd, calculators, ahk_exe numbers.exe ; windows 8
35 |
36 | ;# set hotstrings & hotkeys
37 | hotkey, ifWinNotActive, ahk_group calculators
38 | if (enable_hotstrings = "yes")
39 | {
40 | if (trigger_key)
41 | {
42 | hotkey, ~%trigger_key%, inline_hotstring, on
43 | delete_n := "2"
44 | }
45 | else ; trigger with any number key or -.(
46 | {
47 | if (enable_number_row = "yes")
48 | {
49 | loop, 10 ; set 0 to 9 on the number row
50 | hotkey, % "~" . a_index - 1, inline_hotstring, on
51 | hotkey, ~- , inline_hotstring, on
52 | hotkey, ~. , inline_hotstring, on
53 | hotkey, ~( , inline_hotstring, on
54 | }
55 | if (enable_number_pad = "yes")
56 | {
57 | loop, 10 ; set 0 to 9 on the numberpad
58 | hotkey, % "~numpad" . a_index - 1, inline_hotstring, on
59 | hotkey, ~numpadDot, inline_hotstring, on
60 | hotkey, ~numpadSub, inline_hotstring, on
61 | }
62 | delete_n := "1"
63 | }
64 | if (numpadEnter_endKey = "yes")
65 | hotkey, ~numpadEnter, numpadEnter_endKey, on
66 | }
67 | if (result_hotkey)
68 | hotkey, % result_hotkey, inline_hotkey, on
69 | if (equation_hotkey)
70 | hotkey, % equation_hotkey, inline_hotkey, on
71 | if (history_hotkey)
72 | hotkey, % history_hotkey, history_menu, on
73 | hotkey, ifWinNotActive
74 |
75 | ;# keys that will end the calculator
76 | end_keys =
77 | (join
78 | {c}{f}{g}{h}{i}{j}{k}{l}{n}{o}{q}{r}{u}{v}{w}{y}{z}{[}{]}{;}{'}{``}{#}{=}{!}{"}
79 | {$}{`%}{^}{&}{_}{{}{}}{:}{@}{~}{<}{>}{?}{\}{|}{up}{down}{left}{right}{esc}{enter}
80 | {delete}{backspace}{tab}{LWin}{rWin}{LControl}{rControl}{LAlt}{rAlt}{printScreen}
81 | {home}{end}{insert}{pgUp}{pgDn}{numlock}{scrollLock}{help}{appsKey}{pause}{sleep}
82 | {ctrlBreak}{capsLock}{numpadEnter}{numpadUp}{numpadDown}{numpadLeft}{numpadRight}
83 | {numpadClear}{numpadHome}{numpadEnd}{numpadPgUp}{numpadPgDn}{numpadIns}{numpadDel}
84 | {browser_back}{browser_forward}{browser_refresh}{browser_stop}{browser_search}
85 | {browser_favorites}{browser_home}{F1}{F2}{F3}{F4}{F5}{F6}{F7}{F8}{F9}{F10}{F11}
86 | {F12}{F13}{F14}{F15}{F16}{F17}{F18}{F19}{F20}{F21}{F22}{F23}{F24}
87 | )
88 |
89 | history := []
90 | calculator_state := "off"
91 |
92 | return ; end of auto-execute ---------------------------------------------------
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 | inline_hotstring:
103 | if (calculator_state = "off")
104 | {
105 | calculator("on")
106 |
107 | stringReplace, this_input, a_thisHotkey, ~ , ,
108 | stringReplace, this_input, this_input , numpad, ,
109 | stringReplace, this_input, this_input , enter , ,
110 | stringReplace, this_input, this_input , dot , .,
111 | stringReplace, this_input, this_input , sub , -,
112 | stringReplace, this_input, this_input , %trigger_key%, ,
113 | active_window := winExist("a")
114 |
115 | loop,
116 | {
117 | input, new_input, V %timeout%, %end_keys%
118 | this_input .= new_input ; append
119 | this_endkey := strReplace(errorLevel, "EndKey:", "")
120 | if (this_endkey = "backspace") ; trim and continue with loop/input
121 | stringTrimRight, this_input, this_input, 1
122 | else break ; if any other end key
123 | }
124 | if (this_endkey = "numpadEnter") and (numpadEnter_endKey = "yes")
125 | this_endkey := result_endkey
126 |
127 | if (this_endkey != result_endkey) and (this_endkey != equation_endkey)
128 | goTo, turn_calculator_off
129 | if (winExist("a") != active_window)
130 | goTo, turn_calculator_off
131 | original_equation := this_input
132 | equation := convert_letters(this_input) ; convert letters to math symbols
133 | if equation contains +,-,*,/
134 | goSub, calculate_equation
135 |
136 | calculator("off")
137 | }
138 | return
139 |
140 |
141 |
142 | inline_hotkey:
143 | clipboard("save")
144 | clipboard("get")
145 | equation := convert_letters(trim(clipboard))
146 | clipboard("restore")
147 |
148 | stringReplace, equation, equation, `r`n, % " ", all ; replace lines with spaces
149 | stringReplace, equation, equation, `n, % " ", all
150 | loop, ; remove double spaces
151 | stringReplace, equation, equation, % a_space . a_space, % a_space, useErrorLevel
152 | until (errorLevel = 0)
153 |
154 | if (equation = "") or if regExMatch(equation, "[^0-9\Q+*-/(),. \E]")
155 | return ; only continue if numbers, +/-*,.() or spaces
156 |
157 | if equation not contains +,-,*,/ ; convert spaces to pluses
158 | stringReplace, equation, equation, % a_space, +, all
159 |
160 | goSub, calculate_equation
161 | goSub, clear_vars
162 | return
163 |
164 |
165 |
166 | calculate_equation:
167 | result := eval( strReplace(equation, ",", "") ) ; convert string to expression
168 | if (result != "")
169 | {
170 | if (nb_decimals != "no")
171 | {
172 | result := Round(result , nb_decimals)
173 | }
174 | if inStr(equation, ",") ; add comma back in to numbers over 1,000
175 | {
176 | stringSplit, split, result, .
177 | result := regExReplace(split1, "(\d)(?=(?:\d{3})+(?:\.|$))", "$1,") "." split2
178 | }
179 | if inStr(result, ".")
180 | result := rTrim( rTrim(result, "0"), ".") ; trim trailing .000
181 |
182 | if (a_thisHotkey = result_hotkey) or (a_thisHotkey = equation_hotkey)
183 | send % "{backspace}" ; delete selected text
184 | else send % "{backspace " strLen(original_equation) + delete_n "}" ; delete hotstring input
185 |
186 | clipboard("save")
187 | if (this_endkey = result_endkey) or (a_thisHotkey = result_hotkey)
188 | clipboard := result
189 | else clipboard := equation " = " result
190 | clipboard("paste")
191 | clipboard("restore")
192 |
193 | history.insertAt(1, equation " = " result)
194 | if (history.maxIndex() > 15)
195 | history.pop()
196 | }
197 | return
198 |
199 |
200 |
201 | calculator(mode) {
202 | global
203 | if (mode = "on")
204 | {
205 | calculator_state := "on"
206 | menu, tray, icon, % a_scriptDir "\in-line calculator.ico", 2 ; plus icon
207 | }
208 | else if (mode = "off")
209 | {
210 | calculator_state := "off"
211 | menu, tray, icon, % a_scriptDir "\in-line calculator.ico", 1 ; default icon
212 | goSub, clear_vars
213 | }
214 | }
215 |
216 | turn_calculator_off:
217 | calculator("off")
218 | return
219 |
220 |
221 |
222 | convert_letters(string) {
223 | ; I tried to add the tax number as a variable but it's always empty. Nore sure why so I'll leave it like that.
224 | string := StrReplace(string, "e", 1.14975) ; convert e to tax % value
225 |
226 | for letters, symbols in {"p":"+", "a":"+", "m":"-", "s":"-"
227 | , "x":"*", "t":"*", "b":"*", "d":"/"}
228 | stringReplace, string, string, % letters, % symbols, all
229 | return string
230 | }
231 |
232 |
233 |
234 | numpadEnter_endKey:
235 | if getKeyState("numLock", "T") and (trigger_key != "")
236 | {
237 | send, {backspace}{%trigger_key%}
238 | goSub, inline_hotstring
239 | }
240 | return
241 |
242 |
243 |
244 | clear_vars:
245 | this_endkey := ""
246 | this_input := ""
247 | new_input := ""
248 | equation := ""
249 | return
250 |
251 |
252 |
253 | #ifWinActive, ahk_group calculators
254 |
255 | p::send, {+} ; plus
256 | a::send, {+} ; and OR add
257 | m::send, {-} ; minus
258 | s::send, {-} ; subtract
259 | x::send, {*} ; multiply
260 | t::send, {*} ; times
261 | b::send, {*} ; by
262 | d::send, {/} ; divide
263 |
264 | =::send, {enter}
265 |
266 | #ifWinActive
267 |
268 |
269 |
270 | history_menu:
271 | menu, history_menu, add, in-line calculator history:, history_select
272 | menu, history_menu, disable, in-line calculator history:
273 | menu, history_menu, add
274 | loop, % history.maxIndex()
275 | menu, history_menu, add, % history[a_index], history_select
276 | if history.maxIndex()
277 | menu, history_menu, add
278 | menu, history_menu, add, clear history, clear_history
279 | menu, history_menu, show
280 | menu, history_menu, deleteAll
281 | return
282 |
283 | history_select:
284 | this_menu := a_thisMenuItem
285 | if getKeyState("ctrl", "p")
286 | {
287 | stringSplit, split_, this_menu, =, % a_space
288 | this_menu := split_2 ; result only
289 | }
290 | stringReplace, this_menu, this_menu, % " = ", % " = "
291 | clipboard := this_menu
292 | msg(this_menu " added to the clipboard")
293 | return
294 |
295 | clear_history:
296 | history := []
297 | msg("history cleared")
298 | return
299 |
300 |
301 |
302 | msg(string) {
303 | toolTip, % string
304 | setTimer, msg_timer, 2500
305 | }
306 | msg_timer:
307 | setTimer, msg_timer, off
308 | toolTip,
309 | return
310 |
311 |
312 |
313 | reload:
314 | reload
315 | sleep 1000
316 | msgBox, 4, , The script could not be reloaded and will need to be manually restarted. Would you like Exit?
317 | ifMsgBox, yes, exitApp
318 | return
319 |
320 |
321 |
322 | open_github:
323 | run, https://github.com/davebrny/in-line-calculator#usage
324 | return
--------------------------------------------------------------------------------
/in-line-calculator/in-line calculator.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GorvGoyl/Autohotkey-Scripts-Windows/fee515400efda5b9c23ea16ba004400e2e6ba00a/in-line-calculator/in-line calculator.exe
--------------------------------------------------------------------------------
/in-line-calculator/in-line calculator.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GorvGoyl/Autohotkey-Scripts-Windows/fee515400efda5b9c23ea16ba004400e2e6ba00a/in-line-calculator/in-line calculator.ico
--------------------------------------------------------------------------------
/in-line-calculator/lib/clipboard.ahk:
--------------------------------------------------------------------------------
1 | clipboard(action="") {
2 | global
3 | if (action = "save")
4 | clipboard_r := clipboardAll
5 | else if (action = "get")
6 | {
7 | clipboard := ""
8 | send ^{c}
9 | clipWait, 0.3
10 | }
11 | else if (action = "paste")
12 | {
13 | send, ^{v}
14 | sleep 100
15 | }
16 | else if (action = "restore")
17 | {
18 | clipboard := clipboard_r
19 | clipboard_r := ""
20 | }
21 | }
--------------------------------------------------------------------------------
/in-line-calculator/lib/eval.ahk:
--------------------------------------------------------------------------------
1 | ; eval by Laszlo: http://www.autohotkey.com/board/topic/4779-simple-script-for-evaluating-arithmetic-expressions/page-2#entry101504
2 |
3 | eval(x) { ; expression preprocessing
4 | Static pi = 3.141592653589793, e = 2.718281828459045
5 |
6 | StringReplace x, x,`%, \, All ; % -> \ for MOD
7 | x := RegExReplace(x,"\s*") ; remove whitespace
8 | x := RegExReplace(x,"([a-zA-Z]\w*)([^\w\(]|$)","%$1%$2") ; var -> %var%
9 | Transform x, Deref, %x% ; dereference all %var%
10 |
11 | StringReplace x, x, -, #, All ; # = subtraction
12 | StringReplace x, x, (#, (0#, All ; (-x -> (0-x
13 | If (Asc(x) = Asc("#"))
14 | x = 0%x% ; leading -x -> 0-x
15 | StringReplace x, x, (+, (, All ; (+x -> (x
16 | If (Asc(x) = Asc("+"))
17 | StringTrimLeft x, x, 1 ; leading +x -> x
18 | StringReplace x, x, **, @, All ; ** -> @ for easier process
19 |
20 | Loop { ; find innermost (..)
21 | If !RegExMatch(x, "(.*)\(([^\(\)]*)\)(.*)", y)
22 | Break
23 | x := y1 . Eval@(y2) . y3 ; replace "(x)" with value of x
24 | }
25 | Return Eval@(x) ; no more (..)
26 | }
27 |
28 | Eval@(x) {
29 | RegExMatch(x, "(.*)(\+|\#)(.*)", y) ; execute rightmost +- operator
30 | IfEqual y2,+, Return Eval@(y1) + Eval@(y3)
31 | IfEqual y2,#, Return Eval@(y1) - Eval@(y3)
32 | ; execute rightmost */% operator
33 | RegExMatch(x, "(.*)(\*|\/|\\)(.*)", y)
34 | IfEqual y2,*, Return Eval@(y1) * Eval@(y3)
35 | IfEqual y2,/, Return Eval@(y1) / Eval@(y3)
36 | IfEqual y2,\, Return Mod(Eval@(y1),Eval@(y3))
37 | ; execute rightmost power
38 | StringGetPos i, x, @, R
39 | IfGreaterOrEqual i,0, Return Eval@(SubStr(x,1,i)) ** Eval@(SubStr(x,2+i))
40 | ; execute rightmost function
41 | If !RegExMatch(x,".*(abs|floor|sqrt)(.*)", y)
42 | Return x ; no more function
43 | IfEqual y1,abs, Return abs( Eval@(y2))
44 | IfEqual y1,floor,Return floor(Eval@(y2))
45 | IfEqual y1,sqrt, Return sqrt( Eval@(y2))
46 | }
--------------------------------------------------------------------------------
/in-line-calculator/lib/start_with_windows.ahk:
--------------------------------------------------------------------------------
1 | start_with_windows(seperator="", menu_name="tray") {
2 | global sww_shortcut, sww_menu
3 |
4 | sww_menu := menu_name
5 | if (seperator = "1") or (seperator = "3")
6 | menu, % sww_menu, add,
7 | menu, % sww_menu, add, Start with Windows, start_with_windows
8 |
9 | splitPath, a_scriptFullPath, , , , script_name
10 | sww_shortcut := a_startup "\" script_name ".lnk"
11 |
12 | ifExist, % sww_shortcut
13 | {
14 | fileGetShortcut, % sww_shortcut, target ;# update if script has moved
15 | if (target != a_scriptFullPath)
16 | fileCreateShortcut, % a_scriptFullPath, % sww_shortcut
17 | menu, % sww_menu, check, Start with Windows
18 | }
19 | else menu, % sww_menu, unCheck, Start with Windows
20 |
21 | if (seperator = "2") or (seperator = "3")
22 | menu, % sww_menu, add,
23 | }
24 |
25 |
26 |
27 | start_with_windows: ;# action when tray item is clicked
28 | ifExist, % sww_shortcut
29 | {
30 | fileDelete, % sww_shortcut
31 | menu, % sww_menu, unCheck, Start with Windows
32 | trayTip, Start With Windows, Shortcut removed , 5
33 | }
34 | else
35 | {
36 | fileCreateShortcut, % a_scriptFullPath, % sww_shortcut
37 | menu, % sww_menu, check, Start with Windows
38 | trayTip, Start With Windows, Shortcut created , 5
39 | }
40 | return
41 |
42 |
43 | /*
44 | [script info]
45 | version = 2
46 | description = tray option to start your scripts when windows starts
47 | author = davebrny
48 | source = git.io/vMv74
49 | */
--------------------------------------------------------------------------------
/in-line-calculator/readme.md:
--------------------------------------------------------------------------------
1 | https://github.com/Suprazz/in-line-calculator
2 |
3 | # in-line calculator
4 |
5 | 
6 |
7 |
8 | ### Table of Contents
9 |
10 | - [What's this?](#whats-this)
11 | - [Installation](#installation)
12 | - [Usage](#usage)
13 | - [Options](#options)
14 | - [Credits](#credits)
15 |
16 |
17 |
18 |
19 |
20 | ## What's this?
21 |
22 | An interface-less calculator for Windows that lets you do basic math without having to leave the line you're typing on.
23 |
24 | **Where can it be used?**
25 |
26 | 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.
27 |
28 |
29 |
30 |
31 |
32 | ## Installation
33 |
34 | Download and extract the [latest release](https://github.com/davebrny/in-line-calculator/releases) .zip file. If you already have [AutoHotkey](https://www.autohotkey.com) installed then run `in-line calculator.ahk`, otherwise run the `.exe` version which lets you use the script without having AutoHotkey installed. The script doesn't install anything and it's also portable so it can be run from any location.
35 |
36 |
37 |
38 |
39 |
40 | ## Usage
41 |
42 | Press the equals key to activate the calculator, type out an equation, then use one of the two end keys to calculate it
43 |
44 | ```
45 | =5p5
46 | ```
47 |
48 | The **=** key deletes the equation and pastes the answer:
49 |
50 | ```
51 | 10
52 | ```
53 | The **#** key keeps the equation and pastes the answer at the end:
54 |
55 | ```
56 | 5+5 = 10
57 | ```
58 |
59 |
60 |
61 |
62 | #### What's that p for?
63 |
64 | As well as the regular math symbols (**+ - * /**), letters can be used which makes it easier to type since you don't have to use the shift key.
65 |
66 |
67 | | math key | key to use if you're ~~lazy~~ efficient |
68 | |:--------:|:--------------------------------|
69 | | + | p `(plus)` a `(and)`
70 | | - | m `(minus)` s `(subtract)`
71 | | * | t `(times)` b `(by)` x `(multiply)`
72 | | / | d `(divide)`
73 |
74 |
75 |
76 | Some examples:
77 |
78 | ```
79 | 7 p 11 m 2 = 16
80 | 7 + 11 - 2
81 | ```
82 |
83 | ```
84 | (27 d 4) x 12 = 81
85 | (27 / 4) * 12
86 | ```
87 |
88 |
89 |
90 |
91 | #### How does it work?
92 |
93 | When you press the equals key, the calculator will turn on and start logging the following keys:
94 |
95 | - `0` - `9` (number row or number pad)
96 | - `+` `-` `*` `/`
97 | - `.` `,` `(` `)`
98 | - `a` `b` `d` `m` `p` `s` `t` `x`
99 | - `space` `backspace`
100 |
101 |
102 | If a key is pressed that isn't in the above list then the calculator will turn off and anything that was typed will be cleared from memory.
103 | For example, typing `=5pw5=` won't calculate anything since the `w` key would have turned the calculator off.
104 |
105 |
106 | > *The tray icon can be used to check what state the calculator is in. If the calculator is on the icon will be a "plus" symbol, if it's off then it will be showing the default "equal" symbol.*
107 |
108 | > *You can use the escape key at any time to reset or turn off the calculator*
109 |
110 |
111 |
112 |
113 | ---
114 |
115 |
116 | ## Other features
117 |
118 | **Select an equation**
119 |
120 | Select an equation and use one of the following hotkeys:
121 |
122 | alt + = Result only
123 | alt + # Equation & result
124 |
125 | The equation text can be on multiple lines:
126 | ```
127 | 134
128 | +578
129 | -233
130 | ```
131 |
132 | *This feature uses the clipboard to get the equation text and paste it back again so if it's used on static text (like on this webpage) then it wont work since there is nowhere for the result to be pasted.*
133 |
134 |
135 |
136 | **Add numbers quickly**
137 |
138 | When selecting an equation, if there are no math symbols in the selected text, then every space between the numbers will be replaced with pluses.
139 | `100 200 300` will become `100+200+300`
140 |
141 |
142 |
143 | **History menu**
144 | Use ctrl + alt + = to show a menu with the last 15 calculations.
145 | Clicking an item in the menu will add it to the clipboard. If the ctrl is being held down then only the result is added to the clipboard.
146 |
147 |
148 |
149 | **Windows calculator**
150 |
151 | The keys a b d p m s t x are remapped to send the corresponding math symbols when Windows calculator is open.
152 | The = key is remapped to send enter
153 |
154 |
155 | **Tax calculator**
156 |
157 | The key e is remapped to 1.14975. This way you can type `100+e=` and the tax will be calculated automatically.
158 |
159 |
160 | ## Options
161 |
162 | *(Any time you make any changes to the `settings.ini` file you will need to select "Reload This Script" from the tray icon to update the script with the new settings)*
163 |
164 |
165 | **Custom keys**
166 |
167 | The key that triggers the calculator can be changed to something else beside the equals key by changing the value in `trigger_key`. To have any of the number keys be the trigger that starts the calculator, leave this value empty.
168 |
169 | > Triggering with the number keys can sometimes calculate things that aren't equations. This can happen in situations where you're typing a date like "31-12-2017" and then happen to use one of the end keys right after. One way of avoiding this is by remembering to press the `escape` key to turn off the calculator before pressing an end key. If you forget to do that then `ctrl + z` can always be used to undo the calculation.
170 |
171 | Hotkeys and Hotstring endkeys can be changed to something other than the defaults by changing the values in `result_hotkey`, `equation_hotkey`, `result_endkey` and `equation_endkey`
172 |
173 |
174 | **Enable/Disable**
175 |
176 | To disable both the number row and number pad keys and use the "select equation" feature only, set `enable_hotstrings` to `no`.
177 | There's also option to disable the number row or the number pad individually which is useful if you want to have one set of keys that wont trigger anything.
178 | To disable a hotkey leave its value empty.
179 |
180 |
181 | **NumpadEnter as end key**
182 |
183 | The number pad `enter` key can be used as the `=` end key by settings `numpadEnter_endKey` to `yes`. This will also allow you to the trigger the calculator with this key or if no trigger key is set then it will just function as the default number pad enter.
184 |
185 |
186 | **Calculator timeout**
187 |
188 | The default time the calculator will stay on after typing an equation is 60 seconds. This is so the calculator doesn't stay on when you use one of the trigger keys but don't intend to use the calculator. Change `timeout` to `T120` for 120 seconds, `T30` for 30 seconds or leave it blank to disable the timeout altogether.
189 |
190 |
191 | **Start with windows**
192 |
193 | To have the script start when windows boots up, select "Start With Windows" from the tray icon.
194 |
195 |
196 |
197 |
198 |
199 | ## Credits
200 |
201 | Laszlo, Oldman and many others from the AHK community.
202 |
--------------------------------------------------------------------------------
/in-line-calculator/settings.ini:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GorvGoyl/Autohotkey-Scripts-Windows/fee515400efda5b9c23ea16ba004400e2e6ba00a/in-line-calculator/settings.ini
--------------------------------------------------------------------------------
/left_edge_as_window_switcher.ahk:
--------------------------------------------------------------------------------
1 | ; Sends Alt-Tab (Window switcher) when the mouse is on the left edge of the screen.
2 | ; Keep it there to tab through the other windows.
3 | ;Skrommel @ 2008
4 |
5 |
6 | #NoEnv
7 | #Persistent,On
8 | #SingleInstance,Force
9 | #WinActivateForce
10 | SetBatchLines,-1
11 | SetWinDelay,0
12 | SetKeyDelay,0
13 | CoordMode,Mouse,Screen
14 |
15 | applicationname=AltEgde
16 |
17 | Gosub,MENU
18 | tabbed=0
19 |
20 | Loop
21 | {
22 | MouseGetPos,mx,my
23 |
24 | If (mx=0)
25 | {
26 | If tabbed=0
27 | {
28 | Send,{Alt Down}{Tab}
29 | SetTimer,TAB,500
30 | }
31 | tabbed=1
32 | }
33 | Else
34 | {
35 | If tabbed=1
36 | {
37 | SetTimer,TAB,Off
38 | Send,{Alt Up}
39 | tabbed=0
40 | }
41 | }
42 | Sleep,50
43 | }
44 |
45 |
46 | TAB:
47 | Send,{Alt Down}{Tab}
48 | Return
49 |
50 |
51 | MENU:
52 | Menu,Tray,DeleteAll
53 | Menu,Tray,NoStandard
54 | Menu,Tray,Add,%applicationname%,ABOUT
55 | Menu,Tray,Add,
56 | Menu,Tray,Add,&About...,ABOUT
57 | Menu,Tray,Add,E&xit,EXIT
58 | Menu,Tray,Tip,%applicationname%
59 | Menu,Tray,Default,%applicationname%
60 | Return
61 |
62 |
63 | ABOUT:
64 | Gui,99:Destroy
65 | Gui,99:Margin,20,20
66 | Gui,99:Add,Picture,xm Icon1,%applicationname%.exe
67 | Gui,99:Font,Bold
68 | Gui,99:Add,Text,x+10 yp+10,%applicationname% v1.1
69 | Gui,99:Font
70 | Gui,99:Add,Text,y+10,- Sends Alt-Tab when the mouse is on the left edge of the screen.
71 | Gui,99:Add,Text,y+10,- Keep it there to tab through the other windows.
72 |
73 | Gui,99:Add,Picture,xm y+20 Icon2,%applicationname%.exe
74 | Gui,99:Font,Bold
75 | Gui,99:Add,Text,x+10 yp+10,1 Hour Software by Skrommel
76 | Gui,99:Font
77 | Gui,99:Add,Text,y+10,For more tools, information and donations, please visit
78 | Gui,99:Font,CBlue Underline
79 | Gui,99:Add,Text,y+5 G1HOURSOFTWARE,www.1HourSoftware.com
80 | Gui,99:Font
81 |
82 | Gui,99:Add,Picture,xm y+20 Icon7,%applicationname%.exe
83 | Gui,99:Font,Bold
84 | Gui,99:Add,Text,x+10 yp+10,DonationCoder
85 | Gui,99:Font
86 | Gui,99:Add,Text,y+10,Please support the contributors at
87 | Gui,99:Font,CBlue Underline
88 | Gui,99:Add,Text,y+5 GDONATIONCODER,www.DonationCoder.com
89 | Gui,99:Font
90 |
91 | Gui,99:Add,Picture,xm y+20 Icon6,%applicationname%.exe
92 | Gui,99:Font,Bold
93 | Gui,99:Add,Text,x+10 yp+10,AutoHotkey
94 | Gui,99:Font
95 | Gui,99:Add,Text,y+10,This tool was made using the powerful
96 | Gui,99:Font,CBlue Underline
97 | Gui,99:Add,Text,y+5 GAUTOHOTKEY,www.AutoHotkey.com
98 | Gui,99:Font
99 |
100 | Gui,99:Add,Button,GABOUTOK Default w75,&OK
101 |
102 | Gui,99:Show,,%applicationname% About
103 | hCurs:=DllCall("LoadCursor","UInt",NULL,"Int",32649,"UInt") ;IDC_HAND
104 | OnMessage(0x200,"WM_MOUSEMOVE")
105 | Return
106 |
107 | 1HOURSOFTWARE:
108 | Run,http://www.1hoursoftware.com,,UseErrorLevel
109 | Return
110 |
111 | DONATIONCODER:
112 | Run,http://www.donationcoder.com,,UseErrorLevel
113 | Return
114 |
115 | AUTOHOTKEY:
116 | Run,http://www.autohotkey.com,,UseErrorLevel
117 | Return
118 |
119 | ABOUTOK:
120 | Gui,99:Destroy
121 | OnMessage(0x200,"")
122 | DllCall("DestroyCursor","Uint",hCur)
123 | Return
124 |
125 | WM_MOUSEMOVE(wParam,lParam)
126 | {
127 | Global hCurs
128 | MouseGetPos,,,,ctrl
129 | If ctrl in Static8,Static12,Static16
130 | DllCall("SetCursor","UInt",hCurs)
131 | Return
132 | }
133 | Return
134 |
135 |
136 | EXIT:
137 | ExitApp
--------------------------------------------------------------------------------
/look_up.ahk:
--------------------------------------------------------------------------------
1 | ; alt+g : open highlighted text in browser and do google search / visit site (if it's url)
2 |
3 |
4 | ; run script as admin (reload if not as admin)
5 | if not A_IsAdmin
6 | {
7 | Run *RunAs "%A_ScriptFullPath%" ; Requires v1.0.92.01+
8 | ExitApp
9 | }
10 |
11 | #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
12 | ; #Warn ; Enable warnings to assist with detecting common errors.
13 | SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
14 | SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
15 | #SingleInstance Force
16 | SetTitleMatchMode 2
17 |
18 |
19 | !g::
20 | MyClip := ClipboardAll
21 | Clipboard = ; empty the clipboard
22 | Send, ^c
23 | ClipWait, 2
24 | if ErrorLevel ; ClipWait timed out.
25 | {
26 | return
27 | }
28 | if RegExMatch(Clipboard, "^[^ ]*\.[^ ]*$")
29 | {
30 | Run "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" %Clipboard%
31 | }
32 | else
33 | {
34 | ; Modify some characters that screw up the URL
35 | ; RFC 3986 section 2.2 Reserved Characters (January 2005): !*'();:@&=+$,/?#[]
36 | StringReplace, Clipboard, Clipboard, `r`n, %A_Space%, All
37 | StringReplace, Clipboard, Clipboard, #, `%23, All
38 | StringReplace, Clipboard, Clipboard, &, `%26, All
39 | StringReplace, Clipboard, Clipboard, +, `%2b, All
40 | StringReplace, Clipboard, Clipboard, ", `%22, All
41 | Run % "https://www.google.com/search?hl=en&q=" . clipboard ; uriEncode(clipboard)
42 | }
43 | Clipboard := MyClip
44 | return
45 |
46 | ; Handy function.
47 | ; Copies the selected text to a variable while preserving the clipboard.
48 | GetText(ByRef MyText = "")
49 | {
50 | SavedClip := ClipboardAll
51 | Clipboard =
52 | Send ^c
53 | ClipWait 0.5
54 | If ERRORLEVEL
55 | {
56 | Clipboard := SavedClip
57 | MyText =
58 | Return
59 | }
60 | MyText := Clipboard
61 | Clipboard := SavedClip
62 | Return MyText
63 | }
64 |
65 | ; Pastes text from a variable while preserving the clipboard.
66 | PutText(MyText)
67 | {
68 | SavedClip := ClipboardAll
69 | Clipboard = ; For better compatability
70 | Sleep 20 ; with Clipboard History
71 | Clipboard := MyText
72 | Send ^v
73 | Sleep 100
74 | Clipboard := SavedClip
75 | Return
76 | }
77 |
78 |
--------------------------------------------------------------------------------
/mouseless.ahk:
--------------------------------------------------------------------------------
1 | ; WIN key as mouse left click
2 | ; Right Ctrl key as Win key
3 |
4 | ; run script as admin (reload if not as admin)
5 | if not A_IsAdmin
6 | {
7 | Run *RunAs "%A_ScriptFullPath%" ; Requires v1.0.92.01+
8 | ExitApp
9 | }
10 |
11 | #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
12 | ; #Warn ; Enable warnings to assist with detecting common errors.
13 | SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
14 | SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
15 | #SingleInstance Force
16 | SetTitleMatchMode 2
17 |
18 | LWin::LButton
19 |
20 | RCtrl::LWin
21 |
--------------------------------------------------------------------------------
/move-inactive-window-alt-leftclick/MoveInactiveWin.ahk:
--------------------------------------------------------------------------------
1 | ; alt + left-click: Move a window without activating it.
2 | ;Skrommel @2006
3 |
4 | #SingleInstance,Force
5 | SetWinDelay,0
6 | SetBatchLines,-1
7 | CoordMode,Mouse,Screen
8 |
9 | applicationname=MoveInactiveWin
10 |
11 | Gosub,TRAYMENU
12 | Return
13 |
14 |
15 | !LButton::
16 | MouseGetPos,oldmx,oldmy,mwin,mctrl
17 | Loop
18 | {
19 | GetKeyState,lbutton,LButton,P
20 | GetKeyState,alt,Alt,P
21 | If (lbutton="U" Or alt="U")
22 | Break
23 | MouseGetPos,mx,my
24 | WinGetPos,wx,wy,ww,wh,ahk_id %mwin%
25 | wx:=wx+mx-oldmx
26 | wy:=wy+my-oldmy
27 | WinMove,ahk_id %mwin%,,%wx%,%wy%
28 | oldmx:=mx
29 | oldmy:=my
30 | }
31 | Return
32 |
33 |
34 | TRAYMENU:
35 | Menu,Tray,NoStandard
36 | Menu,Tray,DeleteAll
37 | Menu,Tray,Add,%applicationname%,ABOUT
38 | Menu,Tray,Add,
39 | Menu,Tray,Add,&About...,ABOUT
40 | Menu,Tray,Add,E&xit,EXIT
41 | Menu,Tray,Default,%applicationname%
42 | Return
43 |
44 |
45 | ABOUT:
46 | Gui,99:Destroy
47 | Gui,99:Margin,20,20
48 | Gui,99:Add,Picture,xm Icon1,%applicationname%.exe
49 | Gui,99:Font,Bold
50 | Gui,99:Add,Text,x+10 yp+10,%applicationname% v1.0
51 | Gui,99:Font
52 | Gui,99:Add,Text,y+10,Move a window without activating it
53 | Gui,99:Add,Text,y+10,- Alt-Click and drag to move.
54 | Gui,99:Add,Text,y+10,- Click anywhere within a window to move it.
55 |
56 | Gui,99:Add,Picture,xm y+20 Icon5,%applicationname%.exe
57 | Gui,99:Font,Bold
58 | Gui,99:Add,Text,x+10 yp+10,1 Hour Software by Skrommel
59 | Gui,99:Font
60 | Gui,99:Add,Text,y+10,For more tools, information and donations, please visit
61 | Gui,99:Font,CBlue Underline
62 | Gui,99:Add,Text,y+5 G1HOURSOFTWARE,www.1HourSoftware.com
63 | Gui,99:Font
64 |
65 | Gui,99:Add,Picture,xm y+20 Icon7,%applicationname%.exe
66 | Gui,99:Font,Bold
67 | Gui,99:Add,Text,x+10 yp+10,DonationCoder
68 | Gui,99:Font
69 | Gui,99:Add,Text,y+10,Please support the contributors at
70 | Gui,99:Font,CBlue Underline
71 | Gui,99:Add,Text,y+5 GDONATIONCODER,www.DonationCoder.com
72 | Gui,99:Font
73 |
74 | Gui,99:Add,Picture,xm y+20 Icon6,%applicationname%.exe
75 | Gui,99:Font,Bold
76 | Gui,99:Add,Text,x+10 yp+10,AutoHotkey
77 | Gui,99:Font
78 | Gui,99:Add,Text,y+10,This tool was made using the powerful
79 | Gui,99:Font,CBlue Underline
80 | Gui,99:Add,Text,y+5 GAUTOHOTKEY,www.AutoHotkey.com
81 | Gui,99:Font
82 |
83 | Gui,99:Show,,%applicationname% About
84 | hCurs:=DllCall("LoadCursor","UInt",NULL,"Int",32649,"UInt") ;IDC_HAND
85 | OnMessage(0x200,"WM_MOUSEMOVE")
86 | Return
87 |
88 | 1HOURSOFTWARE:
89 | Run,http://www.1hoursoftware.com,,UseErrorLevel
90 | Return
91 |
92 | DONATIONCODER:
93 | Run,http://www.donationcoder.com,,UseErrorLevel
94 | Return
95 |
96 | AUTOHOTKEY:
97 | Run,http://www.autohotkey.com,,UseErrorLevel
98 | Return
99 |
100 | 99GuiClose:
101 | Gui,99:Destroy
102 | OnMessage(0x200,"")
103 | DllCall("DestroyCursor","Uint",hCur)
104 | Return
105 |
106 | WM_MOUSEMOVE(wParam,lParam)
107 | {
108 | Global hCurs
109 | MouseGetPos,,,,ctrl
110 | If ctrl in Static9,Static13,Static17
111 | DllCall("SetCursor","UInt",hCurs)
112 | Return
113 | }
114 | Return
115 |
116 |
117 | EXIT:
118 | ExitApp
119 |
--------------------------------------------------------------------------------
/move-inactive-window-alt-leftclick/MoveInactiveWin.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GorvGoyl/Autohotkey-Scripts-Windows/fee515400efda5b9c23ea16ba004400e2e6ba00a/move-inactive-window-alt-leftclick/MoveInactiveWin.gif
--------------------------------------------------------------------------------
/move-inactive-window-alt-leftclick/MoveInactiveWinScreen.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GorvGoyl/Autohotkey-Scripts-Windows/fee515400efda5b9c23ea16ba004400e2e6ba00a/move-inactive-window-alt-leftclick/MoveInactiveWinScreen.gif
--------------------------------------------------------------------------------
/open_shell_here.ahk:
--------------------------------------------------------------------------------
1 | ; ctrl+shift+p: open powershell at current folder location in file explorer
2 |
3 |
4 | ; run script as admin (reload if not as admin)
5 | if not A_IsAdmin
6 | {
7 | Run *RunAs "%A_ScriptFullPath%" ; Requires v1.0.92.01+
8 | ExitApp
9 | }
10 | #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
11 | ; #Warn ; Enable warnings to assist with detecting common errors.
12 | SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
13 | SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
14 | #SingleInstance force
15 |
16 |
17 | #IfWinActive ahk_class CabinetWClass
18 | ^+p::
19 | pwshHere()
20 | return
21 | #IfWinActive
22 |
23 |
24 | pwshHere(){
25 | If WinActive("ahk_class CabinetWClass") || WinActive("ahk_class ExploreWClass") {
26 | If WinActive("ahk_class CabinetWClass") || WinActive("ahk_class ExploreWClass") {
27 | WinHWND := WinActive()
28 | For win in ComObjCreate("Shell.Application").Windows
29 | If (win.HWND = WinHWND) {
30 | dir := SubStr(win.LocationURL, 9) ; remove "file:///"
31 | dir := RegExReplace(dir, "%20", " ")
32 | Break
33 | }
34 | }
35 | Run, pwsh, % dir ? dir : A_Desktop
36 | }
37 |
38 | }
--------------------------------------------------------------------------------
/pin_window.ahk:
--------------------------------------------------------------------------------
1 | ; ctrl+alt+p to pin/unpin current window at top
2 |
3 | #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
4 | ; #Warn ; Enable warnings to assist with detecting common errors.
5 | SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
6 | SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
7 |
8 | ^!P:: Winset, Alwaysontop, , A
--------------------------------------------------------------------------------
/script_autorun_startup.vbs:
--------------------------------------------------------------------------------
1 | 'put it in startup folder to run the mentioned ahk scripts at startup
2 | Set WshShell = CreateObject("WScript.Shell" )
3 | WshShell.Run """C:\Users\1gour\OneDrive\Documents\Autohotkey-Scripts-Windows\mouseless.ahk""", 0 'Must quote command if it has spaces; must escape quotes
4 | WshShell.Run """C:\Users\1gour\OneDrive\Documents\Autohotkey-Scripts-Windows\look_up.ahk""", 0
5 | Set WshShell = Nothing
--------------------------------------------------------------------------------
/win_key_to_show_taskbar.ahk:
--------------------------------------------------------------------------------
1 | ; Only shows the taskbar when the Windows key is pushed
2 | ;Skrommel @ 2008
3 |
4 |
5 | #SingleInstance,Force
6 | DetectHiddenWindows,On
7 | SetWinDelay,0
8 | OnExit,EXIT
9 |
10 | applicationname=PushToShow
11 |
12 | WinGet,active,Id,ahk_class Progman
13 | WinGet,taskbar,Id,ahk_class Shell_TrayWnd
14 | Gosub,TRAYMENU
15 | Gosub,AUTOHIDE
16 | Gosub,HIDE
17 | Return
18 |
19 |
20 | ~LWin::
21 | Input,SingleKey,L1 M V I,{LWin Up}
22 | If ErrorLevel<>Match
23 | action=1
24 | Return
25 |
26 |
27 | LWin Up::
28 | If action<>
29 | {
30 | action=
31 | Return
32 | }
33 | WinSet,Region,,ahk_id %taskbar%
34 | If (WinExist("A")<>taskbar)
35 | active:=WinExist("A")
36 | WinActivate,ahk_class Shell_TrayWnd
37 | SetTimer,HIDE,100
38 | Return
39 |
40 |
41 | HIDE:
42 | MouseGetPos,,,mwin
43 | If (mwin=taskbar)
44 | Return
45 | WinActivate,ahk_id %active%
46 |
47 | SHRINK:
48 | WinGetPos,wx,wy,ww,wh,ahk_id %taskbar%
49 | ww-=2
50 | wh-=2
51 | WinSet,Region,2-2 W%ww% H%wh%,ahk_id %taskbar%
52 | SetTimer,HIDE,Off
53 | Return
54 |
55 |
56 | EXIT:
57 | WinSet,Region,,ahk_id %taskbar%
58 | Gosub,NORMAL
59 | ExitApp
60 |
61 |
62 | TRAYMENU:
63 | Menu,Tray,NoStandard
64 | Menu,Tray,DeleteAll
65 | Menu,Tray,Add,%applicationname%,ABOUT
66 | Menu,Tray,Add,
67 | Menu,Tray,Default,%applicationname%
68 | Menu,Tray,Add,&About...,ABOUT
69 | Menu,Tray,Add,E&xit,EXIT
70 | Menu,Tray,Tip,%applicationname%
71 | Return
72 |
73 |
74 | SHOWINFO:
75 | If showinfo=1
76 | showinfo=0
77 | Else
78 | showinfo=1
79 | Return
80 |
81 |
82 | SETTINGS:
83 | Run,%A_ScriptDir%
84 | Return
85 |
86 |
87 | HELP:
88 | Run,Barnacle.rtf
89 | Return
90 |
91 |
92 | ABOUT:
93 | Gui,99:Destroy
94 | Gui,99:Margin,20,20
95 | Gui,99:Add,Picture,xm Icon1,%applicationname%.exe
96 | Gui,99:Font,Bold
97 | Gui,99:Add,Text,x+10 yp+10,%applicationname% v1.0
98 | Gui,99:Font
99 | Gui,99:Add,Text,y+10,Completely hides the taskbar until the windows key is pushed.
100 |
101 | Gui,99:Add,Picture,xm y+20 Icon5,%applicationname%.exe
102 | Gui,99:Font,Bold
103 | Gui,99:Add,Text,x+10 yp+10,1 Hour Software by Skrommel
104 | Gui,99:Font
105 | Gui,99:Add,Text,y+10,For more tools, information and donations, please visit
106 | Gui,99:Font,CBlue Underline
107 | Gui,99:Add,Text,y+5 G1HOURSOFTWARE,www.1HourSoftware.com
108 | Gui,99:Font
109 |
110 | Gui,99:Add,Picture,xm y+20 Icon7,%applicationname%.exe
111 | Gui,99:Font,Bold
112 | Gui,99:Add,Text,x+10 yp+10,DonationCoder
113 | Gui,99:Font
114 | Gui,99:Add,Text,y+10,Please support the contributors at
115 | Gui,99:Font,CBlue Underline
116 | Gui,99:Add,Text,y+5 GDONATIONCODER,www.DonationCoder.com
117 | Gui,99:Font
118 |
119 | Gui,99:Add,Picture,xm y+20 Icon6,%applicationname%.exe
120 | Gui,99:Font,Bold
121 | Gui,99:Add,Text,x+10 yp+10,AutoHotkey
122 | Gui,99:Font
123 | Gui,99:Add,Text,y+10,This tool was made using the powerful
124 | Gui,99:Font,CBlue Underline
125 | Gui,99:Add,Text,y+5 GAUTOHOTKEY,www.AutoHotkey.com
126 | Gui,99:Font
127 |
128 | Gui,99:Show,,%applicationname% About
129 | hCurs:=DllCall("LoadCursor","UInt",NULL,"Int",32649,"UInt") ;IDC_HAND
130 | OnMessage(0x200,"WM_MOUSEMOVE")
131 | Return
132 |
133 | 1HOURSOFTWARE:
134 | Run,http://www.1hoursoftware.com,,UseErrorLevel
135 | Return
136 |
137 | DONATIONCODER:
138 | Run,http://www.donationcoder.com,,UseErrorLevel
139 | Return
140 |
141 | AUTOHOTKEY:
142 | Run,http://www.autohotkey.com,,UseErrorLevel
143 | Return
144 |
145 | 99GuiClose:
146 | Gui,99:Destroy
147 | OnMessage(0x200,"")
148 | DllCall("DestroyCursor","Uint",hCur)
149 | Return
150 |
151 | WM_MOUSEMOVE(wParam,lParam)
152 | {
153 | Global hCurs
154 | MouseGetPos,,,,ctrl
155 | If ctrl in Static7,Static11,Static15
156 | DllCall("SetCursor","UInt",hCurs)
157 | Return
158 | }
159 | Return
160 |
161 |
162 | ShellMessage(wParam,lParam)
163 | {
164 | Global active
165 | If (wParam=4) ;HSHELL_WINDOWACTIVATED
166 | {
167 | WinGetClass,class,ahk_id %lParam%
168 | If (class<>"Shell_TrayWnd")
169 | active:=lParam
170 | If (lParam=0)
171 | WinGet,active,Id,ahk_class Progman
172 | }
173 | }
174 |
175 |
176 | AUTOHIDE: ;Stolen from SKAN at http://www.autohotkey.com/forum/topic26107.html
177 | ABM_SETSTATE := 10
178 | ABS_NORMAL := 0x0
179 | ABS_AUTOHIDE := 0x1
180 | ABS_ALWAYSONTOP := 0x2
181 | VarSetCapacity(APPBARDATA,36,0)
182 | Off:=NumPut(36,APPBARDATA)
183 | Off:=NumPut(WinExist("ahk_class Shell_TrayWnd"),Off+0)
184 |
185 | NumPut(ABS_AUTOHIDE|ABS_ALWAYSONTOP, Off+24)
186 | DllCall("Shell32.dll\SHAppBarMessage",UInt,ABM_SETSTATE,UInt,&APPBARDATA)
187 | Return
188 |
189 | NORMAL:
190 | NumPut(ABS_ALWAYSONTOP,Off+24)
191 | DllCall("Shell32.dll\SHAppBarMessage",UInt,ABM_SETSTATE,UInt,&APPBARDATA)
192 | Return
--------------------------------------------------------------------------------