├── LICENSE ├── README.md ├── apps ├── adobe_acrobat.ahk ├── browser.ahk ├── ms_excel.ahk ├── ms_explorer.ahk ├── ms_outlook.ahk ├── ms_powerpoint.ahk ├── ms_word.ahk └── virtuawin.ahk ├── misc ├── #global_functions.ahk ├── #global_hotkeys.ahk ├── hotstrings.ahk ├── media_control.ahk └── register_user_fonts.ahk └── window_management ├── alternative_tab.ahk ├── extended_scrolling.ahk ├── kde_style_window_dragging.ahk └── smart_window_arrangement.ahk /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Christof Küstner 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # autohotkey 2 | My personal collection of mostly self-made Autohotkey (ahk) scripts. So don't hesitate to use some of the scripts or hotkeys. This repository is not intended for direct use. It is intended as a reference repository or repository to get some useful information for extending your hotkeys. So feel free to cherry pick. I have added comments to describe each hotkey on-line. 3 | 4 | I currently use them on Windows 10. 5 | 6 | ## Content 7 | ### Apps 8 | Hint: Some of the functions used are located in [misc/#global_functions.ahk](misc/%23global_functions.ahk) 9 | - [apps/adobe_acrobat.ahk](apps/adobe_acrobat.ahk) >> Adobe Acrobat 10 | - [apps/browser.ahk](apps/browser.ahk) >> Browser (Chrome / Chromium, Firefox, Internet Explorer) 11 | - [apps/ms_excel.ahk](apps/ms_excel.ahk) >> Microsoft Excel 12 | - [apps/ms_explorer.ahk](apps/ms_explorer.ahk) >> Microsoft Windows Explorer 13 | - [apps/ms_outlook.ahk](apps/ms_outlook.ahk) >> Microsoft Office 14 | - [apps/ms_powerpoint.ahk](apps/ms_powerpoint.ahk) >> Microsoft PowerPoint 15 | - [apps/ms_word.ahk](apps/ms_word.ahk) >> Microsoft Word 16 | - [apps/virtuawin.ahk](apps/virtuawin.ahk) >> Virtuawin 17 | 18 | ### Window Management 19 | Hint: Some of the functions used are located in [misc/#global_functions.ahk](misc/%23global_functions.ahk) 20 | - [window_management/alternative_tab.ahk](window_management/alternative_tab.ahk) >> Alternative Tab for switching applications 21 | - [window_management/extended_scrolling.ahk](window_management/extended_scrolling.ahk) >> Extended scrolling (mostly horizontal by Shift + Wheel in Windows 10) 22 | - [window_management/kde_style_window_dragging.ahk](window_management/kde_style_window_dragging.ahk) >> KDE-style dragging of windows 23 | - [window_management/smart_window_arrangement.ahk](window_management/smart_window_arrangement.ahk) >> Smart window arrangement (almost like Spectacle on macOS) 24 | 25 | ### Misc 26 | - [misc/#global_functions.ahk](misc/%23global_functions.ahk) >> Several useful functions 27 | - [misc/#global_hotkeys.ahk](misc/%23global_hotkeys.ahk) >> Several useful (global) hotkeys, like inserting current date and time 28 | - [misc/hotstrings.ahk](misc/hotstrings.ahk) >> Useful hotstrings (at least for me 😏). I use them to insert salutations or emoji. 29 | - [misc/media_control.ahk](misc/media_control.ahk) >> Media control by mouse 30 | - [misc/register_user_fonts.ahk](misc/register_user_fonts.ahk) >> Register user fonts as user 😈, useful if you have no admin rights on your PC 31 | 32 | ## License 33 | This project is licensed under the terms of the MIT license - see the [LICENSE](LICENSE) file for details. 34 | -------------------------------------------------------------------------------- /apps/adobe_acrobat.ahk: -------------------------------------------------------------------------------- 1 | ;################################################################# 2 | ;##### CfK -- App -- Adobe Acrobat (Professional) 3 | ;# = Super, ^ = Ctrl, ! = Alt, + = Shift, ^>! = AltGr 4 | 5 | #IfWinActive ahk_class AcrobatSDIWindow 6 | ^!k:: 7 | MouseGetPos mouse_x, mouse_y 8 | ; make click in adobe independable of monitor 9 | activeMonitorInfo(monitor_left, monitor_top, monitor_width, monitor_height) 10 | click_x := monitor_left + monitor_width - 223 11 | click_y := monitor_top + 193 12 | MouseClick, left, click_x, click_y 13 | Sleep, 500 14 | Send, ^a 15 | MouseMove %mouse_x%, %mouse_y% 16 | return 17 | 18 | 19 | ^NumpadAdd:: 20 | MouseGetPos mouse_x, mouse_y 21 | ; make click in adobe independable of monitor 22 | activeMonitorInfo(monitor_left, monitor_top, monitor_width, monitor_height) 23 | click_x := monitor_left + monitor_width - 255 24 | click_y := monitor_top + 228 25 | MouseClick, left, click_x, click_y 26 | Sleep, 500 27 | MouseMove %mouse_x%, %mouse_y% 28 | return 29 | 30 | ^NumpadSub:: 31 | MouseGetPos mouse_x, mouse_y 32 | ; make click in adobe independable of monitor 33 | activeMonitorInfo(monitor_left, monitor_top, monitor_width, monitor_height) 34 | click_x := monitor_left + monitor_width - 182 35 | click_y := monitor_top + 228 36 | MouseClick, left, click_x, click_y 37 | Sleep, 500 38 | Send, ^a{DEL}{ESC} 39 | MouseMove %mouse_x%, %mouse_y% 40 | return 41 | 42 | ^+NumpadSub:: 43 | MouseGetPos mouse_x, mouse_y 44 | ; make click in adobe independable of monitor 45 | activeMonitorInfo(monitor_left, monitor_top, monitor_width, monitor_height) 46 | click_x := monitor_left + monitor_width - 224 47 | click_y := monitor_top + 228 48 | MouseClick, left, click_x, click_y 49 | Sleep, 500 50 | MouseMove %mouse_x%, %mouse_y% 51 | return 52 | 53 | ^NumpadMult:: 54 | Send, S 55 | Sleep, 500 56 | MouseClick, left 57 | return 58 | 59 | ^NumpadDiv:: 60 | MouseGetPos mouse_x, mouse_y 61 | ; make click in adobe independable of monitor 62 | activeMonitorInfo(monitor_left, monitor_top, monitor_width, monitor_height) 63 | click_x := monitor_left + monitor_width - 139 64 | click_y := monitor_top + 228 65 | MouseClick, left, click_x, click_y 66 | Sleep, 500 67 | Send, ^a{DEL}{ESC} 68 | MouseMove %mouse_x%, %mouse_y% 69 | return 70 | #IfWinActive 71 | -------------------------------------------------------------------------------- /apps/browser.ahk: -------------------------------------------------------------------------------- 1 | ;################################################################# 2 | ;##### CfK -- APP -- Browser (Firefox, Chromium,. ..) 3 | ;# = Super, ^ = Ctrl, ! = Alt, + = Shift, ^>! = AltGr 4 | 5 | #IfWinActive ahk_class MozillaWindowClass 6 | ;----- ReMap on Mouse: Browser_Back 7 | ^WheelLeft::Browser_Back 8 | return 9 | 10 | ;----- ReMap on Mouse: Browser_Forward 11 | ^WheelRight::Browser_Forward 12 | return 13 | #IfWinActive 14 | 15 | #IfWinActive ahk_class IEFrame 16 | ;----- ReMap on Mouse: Browser_Back 17 | ^WheelLeft::Browser_Back 18 | return 19 | 20 | ;----- ReMap on Mouse: Browser_Forward 21 | ^WheelRight::Browser_Forward 22 | return 23 | #IfWinActive 24 | 25 | #IfWinActive ahk_class Chrome_WidgetWin_1 26 | ;----- ReMap on Mouse: Browser_Back 27 | ^WheelLeft::Browser_Back 28 | return 29 | 30 | ;----- ReMap on Mouse: Browser_Forward 31 | ^WheelRight::Browser_Forward 32 | return 33 | #IfWinActive 34 | -------------------------------------------------------------------------------- /apps/ms_excel.ahk: -------------------------------------------------------------------------------- 1 | ;################################################################# 2 | ;##### CfK -- App -- MS Excel 3 | ;# = Super, ^ = Ctrl, ! = Alt, + = Shift, ^>! = AltGr 4 | 5 | #IfWinActive ahk_class XLMAIN 6 | ; Strg+b = Paste as formala and number format 7 | ^b:: 8 | xlPasteFormulasAndNumberFormats := 11 9 | try { 10 | ComObjActive("Excel.Application").ActiveSheet.PasteSpecial(xlPasteFormulasAndNumberFormats) 11 | } 12 | return 13 | 14 | ; Strg+n = Paste as text only and number format 15 | ^n:: 16 | xlPasteValuesAndNumberFormats := 12 17 | try { 18 | ComObjActive("Excel.Application").ActiveSheet.PasteSpecial(xlPasteValuesAndNumberFormats) 19 | } 20 | return 21 | 22 | ; Strg+Super+b = Paste as emf 23 | ^#b:: 24 | try { 25 | ComObjActive("Excel.Application").ActiveSheet.PasteSpecial("Bild (Erweiterte Metadatei)") 26 | } 27 | return 28 | 29 | ; Strg+Super+n = Paste as png 30 | ^#n:: 31 | try { 32 | ComObjActive("Excel.Application").ActiveSheet.PasteSpecial("Bild (PNG)") 33 | } 34 | return 35 | #IfWinActive -------------------------------------------------------------------------------- /apps/ms_explorer.ahk: -------------------------------------------------------------------------------- 1 | ;################################################################# 2 | ;##### CfK -- App -- MS Windows Explorer 3 | ;# = Super, ^ = Ctrl, ! = Alt, + = Shift, ^>! = AltGr 4 | 5 | getCurrentWindowsExplorerPath() 6 | { 7 | WinGetClass, sClass 8 | if (sClass = "CabinetWClass") { 9 | active_hwnd := WinActive("A") 10 | try { 11 | open_windows := ComObjCreate("Shell.Application").Windows 12 | for win in open_windows { 13 | try { 14 | if (win.HWND == active_hwnd) { 15 | for item in win.Document.SelectedItems { 16 | return item.Path 17 | } 18 | } 19 | } 20 | } 21 | } 22 | } 23 | return "" 24 | } 25 | 26 | #IfWinActive ahk_class CabinetWClass 27 | ; Duplicate selected object (file or folder) !! Ctrl+d = Shift+Del (normal) 28 | ^d::Send, {CTRLDOWN}c{CTRLUP}{CTRLDOWN}v{CTRLUP} 29 | return 30 | #IfWinActive -------------------------------------------------------------------------------- /apps/ms_outlook.ahk: -------------------------------------------------------------------------------- 1 | ;################################################################# 2 | ;##### CfK -- App -- MS Outlook 3 | ;# = Super, ^ = Ctrl, ! = Alt, + = Shift, ^>! = AltGr 4 | 5 | #IfWinActive ahk_class rctrl_renwnd32 6 | ;Paste Links incl. OSX-Link after copied "Long UNC Path" with PathCopyCopy 7 | ^b:: 8 | StringReplace, lnkosx, clipboard, \\, smb:// 9 | StringReplace, lnkosx, lnkosx, \, /, , All 10 | outHTML = 🍏: macOS-Link | : %clipboard% 11 | WinClip.SetHTML(outHTML) 12 | WinClip.Paste() 13 | Send, {Esc 2} 14 | return 15 | 16 | ; QuickSteps #1 over Numpad without SHIFT // AUSNAMEN ZUVOR ALS GELESEN 17 | ; DONE-DEL 18 | ^#LButton:: 19 | #Numpad1:: 20 | Send {CTRLDOWN}{SHIFTDOWN}1{SHIFTUP}{CTRLUP}{UP} 21 | return 22 | ^#MButton:: 23 | #Numpad2:: 24 | Send {CTRLDOWN}{SHIFTDOWN}2{SHIFTUP}{CTRLUP}{UP} 25 | return 26 | ^#RButton:: 27 | #Numpad3:: 28 | Send {CTRLDOWN}{SHIFTDOWN}3{SHIFTUP}{CTRLUP}{UP} 29 | return 30 | #Numpad4:: 31 | Send {CTRLDOWN}{SHIFTDOWN}4{SHIFTUP}{CTRLUP}{UP} 32 | return 33 | #Numpad5:: 34 | Send {CTRLDOWN}{SHIFTDOWN}5{SHIFTUP}{CTRLUP}{UP} 35 | return 36 | #Numpad6:: 37 | Send {CTRLDOWN}{SHIFTDOWN}6{SHIFTUP}{CTRLUP}{UP} 38 | return 39 | 40 | ; READ / UNREAD 41 | ^WheelUp::^u 42 | return 43 | ^WheelDown::^q 44 | return 45 | 46 | ; Super+Numpad0 = Bring delclined appointments back in calender as free 47 | #Numpad0:: 48 | olMail := 43 49 | olAppointment := 26 50 | olSelection := 74 51 | olMeetingRequest := 53 52 | olFree := 0 53 | olMeetingDeclined := 4 54 | olMeetingTentative := 2 55 | olMeetingResponseNegative := 55 56 | olMeetingResponsePositive := 56 57 | olMeetingResponseTentative := 57 58 | ; evtl.1 send decline (prevent from deleting), 2. change free, no reminder, 3. delete manually 59 | try { 60 | ; get current selected olMeetingRequest 61 | selection := ComObjActive("Outlook.Application").ActiveExplorer.Selection 62 | if selection.Count == 1 { 63 | selected_item := selection.Item(1) 64 | appointment_item := "" 65 | ; proceed if olMeetingRequest 66 | if selected_item.Class == olMeetingRequest { 67 | appointment_item := selected_item.GetAssociatedAppointment(True) 68 | ; proceed if selected appointment in calendar 69 | } else if (selected_item.Class == olAppointment) { 70 | appointment_item := selected_item 71 | } 72 | 73 | if (appointment_item != "") { 74 | appointment_item.Subject := "CfK-DECLINED: " appointment_item.Subject 75 | appointment_item.BusyStatus := olFree 76 | appointment_item.ReminderSet := False 77 | appointment_item.Save() 78 | } 79 | } 80 | } 81 | return 82 | 83 | ; Super+Numpad+ = Add travel time to appointment 84 | #NumpadAdd:: 85 | olAppointmentItem := 1 86 | olAppointment := 26 87 | 88 | ; try { 89 | app := ComObjActive("Outlook.Application") 90 | ; get current selected olMeetingRequest 91 | selection := app.ActiveExplorer.Selection 92 | if selection.Count == 1 { 93 | selected_item := selection.Item(1) 94 | ; proceed if olAppointment 95 | if selected_item.Class == olAppointment { 96 | InputBox, travel_time, Travel time in minutes, Please enter the travel time in minutes., , 200, 150 97 | ; if entered something, continue 98 | if (!ErrorLevel) { 99 | ; cast string to integer 100 | travel_time := travel_time + 0 101 | ; WORKAROUND (split datetime string), in ahk_v2 DateParse() or DateAdd() 102 | ; 1234567890123456789 103 | ; DateTime Format: dd.MM.yyyy hh:mm:ss 104 | selected_start_date := selected_item.Start 105 | start_dd := SubStr(selected_start_date, 1, 2) 106 | start_Mon := SubStr(selected_start_date, 4, 2) 107 | start_yyyy := SubStr(selected_start_date, 7, 4) 108 | start_hh := SubStr(selected_start_date, 12, 2) 109 | start_min := SubStr(selected_start_date, 15, 2) 110 | start_ss := SubStr(selected_start_date, 18, 2) 111 | before_start_date_ahk := start_yyyy . start_Mon . start_dd . start_hh . start_min . start_ss 112 | before_start_date_ahk += -1 * travel_time, minutes 113 | FormatTime, before_start_date, %before_start_date_ahk%, dd.MM.yyyy hh:mm:ss 114 | 115 | ; BEFORE 116 | item_before := app.CreateItem(olAppointmentItem) 117 | item_before.Start := before_start_date 118 | item_before.Duration := travel_time 119 | item_before.Subject := "TRAVEL TIME | " selected_item.Subject 120 | item_before.BusyStatus := selected_item.BusyStatus 121 | item_before.Categories := selected_item.Categories 122 | item_before.Sensitivity := selected_item.Sensitivity 123 | item_before.ReminderSet := True 124 | item_before.ReminderMinutesBeforeStart := 0 125 | item_before.Save() 126 | 127 | ; AFTER 128 | item_after := app.CreateItem(olAppointmentItem) 129 | item_after.Start := selected_item.End 130 | item_after.Duration := travel_time 131 | item_after.Subject := "TRAVEL TIME | " selected_item.Subject 132 | item_after.BusyStatus := selected_item.BusyStatus 133 | item_after.Categories := selected_item.Categories 134 | item_after.Sensitivity := selected_item.Sensitivity 135 | item_after.ReminderSet := True 136 | item_after.ReminderMinutesBeforeStart := 0 137 | item_after.Save() 138 | } 139 | } 140 | } 141 | ; } 142 | return 143 | 144 | ; --- IN OPNENED MAIL WINDOW 145 | ; Strg+Shift+y = Highlight/Markierung löschen 146 | ^+y:: 147 | wdNoHighlight := 0 148 | try { 149 | oCurrentMail := ComObjActive("Outlook.Application").ActiveInspector.currentItem 150 | oCurrentWordEditor := oCurrentMail.GetInspector.WordEditor.Application 151 | ; highlight text 152 | oCurrentWordEditor.Selection.Range.HighlightColorIndex := wdNoHighlight 153 | } 154 | return 155 | ; Strg+Shift+x = Gelb markieren 156 | ^+x:: 157 | wdYellow := 7 158 | try { 159 | oCurrentMail := ComObjActive("Outlook.Application").ActiveInspector.currentItem 160 | oCurrentWordEditor := oCurrentMail.GetInspector.WordEditor.Application 161 | ; highlight text 162 | oCurrentWordEditor.Selection.Range.HighlightColorIndex := wdYellow 163 | } 164 | return 165 | #IfWinActive -------------------------------------------------------------------------------- /apps/ms_powerpoint.ahk: -------------------------------------------------------------------------------- 1 | ;################################################################# 2 | ;##### CfK -- App - MS PowerPoint 3 | ;# = Super, ^ = Ctrl, ! = Alt, + = Shift, ^>! = AltGr 4 | 5 | NodeAdjustSettingsGUI() { 6 | global NodeIdsAdjustEdit, AdjustMode1, AdjustMode2, AdjustMode3, AdjustMode4 7 | Gui, +LastFound 8 | GuiHWND := WinExist() ;--get handle to this gui.. 9 | 10 | Gui, Add, Text, , Node ids to be adjusted (comma seperated):`n[first node id will be reference node in case of horizontal and vertical alignment] 11 | Gui, Add, Edit, vNodeIdsAdjustEdit, 12 | Gui, Add, Text, , Adjust mode: 13 | Gui, Add, Radio, Checked vAdjustMode1, horizontal alignment | 14 | Gui, Add, Radio, vAdjustMode2, vertical alignment ––– 15 | Gui, Add, Radio, vAdjustMode3, horizontal distribution |–|–| 16 | Gui, Add, Radio, vAdjustMode4, vertical distribution E 17 | Gui, Add, Button, Default, OK 18 | Gui, Show 19 | 20 | WinWaitClose, ahk_id %GuiHWND% ;--waiting for gui to close 21 | return user_choice ;--returning value 22 | 23 | ;------- 24 | ButtonOK: 25 | user_choice := [] 26 | ; ---node_ids_adjust 27 | GuiControlGet, node_ids_adjust_str, , NodeIdsAdjustEdit 28 | node_ids_adjust_array := StrSplit(node_ids_adjust_str, ",", " ,") 29 | node_ids_adjust := [] 30 | for i, node_id in node_ids_adjust_array { 31 | node_ids_adjust.Insert(0 + node_id) 32 | } 33 | user_choice.Insert(node_ids_adjust) 34 | ; ---adjust_mode 35 | GuiControlGet, adjust_mode1, , AdjustMode1 36 | GuiControlGet, adjust_mode2, , AdjustMode2 37 | GuiControlGet, adjust_mode3, , AdjustMode3 38 | GuiControlGet, adjust_mode4, , AdjustMode4 39 | if (adjust_mode1) { 40 | user_choice.Insert(1) 41 | } else if (adjust_mode2) { 42 | user_choice.Insert(2) 43 | } else if (adjust_mode3) { 44 | user_choice.Insert(3) 45 | } else if (adjust_mode4) { 46 | user_choice.Insert(4) 47 | } else { 48 | user_choice.Insert(-1) 49 | } 50 | Gui, Destroy 51 | return 52 | ;------- 53 | GuiEscape: 54 | GuiClose: 55 | user_choice = -1 56 | Gui, Destroy 57 | return 58 | } 59 | 60 | #IfWinActive ahk_class PPTFrameClass 61 | global ppt_shape_corner_radius := 1.0 62 | global ppt_shape_adjustment1 := 0.0 63 | global ppt_shape_adjustment2 := 0.0 64 | global ppt_shape_adjustment3 := 0.0 65 | global ppt_shape_adjustment4 := 0.0 66 | global ppt_shape_adjustment5 := 0.0 67 | global ppt_shape_adjustment6 := 0.0 68 | global ppt_shape_adjustment7 := 0.0 69 | global ppt_shape_adjustment8 := 0.0 70 | 71 | ; Shift+NumpadAdd: Zoom + 100% 72 | +NumpadAdd:: 73 | try { 74 | zoom := ComObjActive("PowerPoint.Application").ActiveWindow.View.Zoom + 100 75 | if (zoom > 300) 76 | zoom := 400 77 | ComObjActive("PowerPoint.Application").ActiveWindow.View.Zoom := zoom 78 | } 79 | return 80 | 81 | ; Shift+NumpadSub: Zoom - 100% 82 | +NumpadSub:: 83 | try { 84 | zoom := ComObjActive("PowerPoint.Application").ActiveWindow.View.Zoom - 100 85 | if (zoom < 100) 86 | zoom := 10 87 | ComObjActive("PowerPoint.Application").ActiveWindow.View.Zoom := zoom 88 | } 89 | return 90 | 91 | ; Strg+m = Paste as text only 92 | ^m:: 93 | ppPasteText := 7 94 | try { 95 | ComObjActive("PowerPoint.Application").ActiveWindow.View.PasteSpecial(ppPasteText) 96 | } 97 | return 98 | ; Strg+b = Paste as emf 99 | ^b:: 100 | ppPasteEnhancedMetafile := 2 101 | try { 102 | ComObjActive("PowerPoint.Application").ActiveWindow.View.PasteSpecial(ppPasteEnhancedMetafile) 103 | } 104 | return 105 | 106 | ; Strg+n = Paste as png 107 | ^n:: 108 | ppPastePNG := 6 109 | try { 110 | ComObjActive("PowerPoint.Application").ActiveWindow.View.PasteSpecial(ppPastePNG) 111 | } 112 | return 113 | 114 | ; Strg+Space = Insert thin (not breakable) space U+2009 / 8201 (dezimal) 115 | ^Space:: 116 | msoTrue := -1 117 | try { 118 | text_range := ComObjActive("PowerPoint.Application").ActiveWindow.Selection.TextRange 119 | text_range.InsertSymbol(text_range.Font.Name, 0x2009, msoTrue) 120 | } 121 | return 122 | 123 | ; Strg+- = Insert optional hyphen U+0AD / 0173 (dezimal) 124 | ^SC035:: 125 | msoTrue := -1 126 | try { 127 | text_range := ComObjActive("PowerPoint.Application").ActiveWindow.Selection.TextRange 128 | text_range.InsertSymbol(" ", 0x0AD, msoTrue) 129 | } 130 | return 131 | 132 | ; Strg+NumpadSub = Insert en dash U+2013 / 0150 (dezimal) 133 | ^NumpadSub:: 134 | msoTrue := -1 135 | try { 136 | text_range := ComObjActive("PowerPoint.Application").ActiveWindow.Selection.TextRange 137 | text_range.InsertSymbol(text_range.Font.Name, 0x2013, msoTrue) 138 | ; text_range.InsertSymbol(" ", 0x2013, msoTrue) 139 | } 140 | return 141 | 142 | ; Strg+Shift+c: Special Copy 143 | ^+c:: 144 | ; ppSelectionNone = 0; ppSelectionSlides = 1; ppSelectionShapes = 2; ppSelectionText = 3 145 | ppSelectionShapes := 2 146 | ; MsoShapeType 147 | msoAutoShape := 1 148 | msoFreeform := 5 149 | msoPicture := 13 ; msoFreeform and msoPicture not working (picture is beschneiden) 150 | 151 | try { 152 | selection := ComObjActive("PowerPoint.Application").ActiveWindow.Selection 153 | 154 | if (selection.Type == ppSelectionShapes) { 155 | selected_shape := selection.ShapeRange(1) 156 | 157 | ; --- Copy shape corner radius 158 | if (selected_shape.Type in (msoAutoShape, msoFreeform, msoPicture)) { 159 | if (selected_shape.Width < selected_shape.Height) { 160 | ppt_shape_corner_radius := selected_shape.Width * selected_shape.Adjustments(1) 161 | } else { 162 | ppt_shape_corner_radius := selected_shape.Height * selected_shape.Adjustments(1) 163 | } 164 | } 165 | ; Store up to 8 shape adjustments 166 | Loop, % selected_shape.Adjustments.Count { 167 | ppt_shape_adjustment%A_Index% := selected_shape.Adjustments(A_Index) 168 | } 169 | } 170 | ShowToolTip("Special copy (Strg+Shift+B for paste)", 1500) 171 | } 172 | SendInput, ^+c 173 | return 174 | 175 | ; Strg+Shift+b = Special Paste/Apply 176 | ^+b:: 177 | ; ppSelectionNone = 0; ppSelectionSlides = 1; ppSelectionShapes = 2; ppSelectionText = 3 178 | ppSelectionShapes := 2 179 | ; MsoShapeType 180 | msoAutoShape := 1 181 | msoFreeform := 5 182 | msoPicture := 13 183 | 184 | try { 185 | selection := ComObjActive("PowerPoint.Application").ActiveWindow.Selection 186 | if (selection.Type == ppSelectionShapes) { 187 | selected_shape := selection.ShapeRange(1) 188 | 189 | ; --- Paste shape corner radius 190 | if (selected_shape.Type in (msoAutoShape, msoFreeform, msoPicture)) { 191 | if (selected_shape.Width < selected_shape.Height) { 192 | selected_shape.Adjustments(1) := ppt_shape_corner_radius / selected_shape.Width 193 | } else { 194 | selected_shape.Adjustments(1) := ppt_shape_corner_radius / selected_shape.Height 195 | } 196 | } 197 | ; Restore up to 8 shape adjustments (except first, reversed) 198 | Loop, % selected_shape.Adjustments.Count { 199 | counterVar := 9 - A_Index 200 | if (GetKeyState("CapsLock", "T") == 0) and (counterVar != 1) 201 | continue 202 | selected_shape.Adjustments(counterVar) := ppt_shape_adjustment%counterVar% 203 | } 204 | } 205 | } 206 | return 207 | 208 | ; Strg+Shift+l = Toggle German/English auto correction 209 | ^+l:: 210 | msoTrue := -1 211 | msoFalse := 0 212 | wdGerman := 1031 213 | wdEnglishUK := 2057 214 | wdEnglishUS := 1033 215 | msoAutoShape := 1 216 | msoGroup := 6 217 | msoTextBox := 17 218 | msoPlaceholder := 14 219 | 220 | try { 221 | oShapeRange := ComObjActive("PowerPoint.Application").ActiveWindow.Selection.ShapeRange 222 | iNewLangID := -1 223 | if (oShapeRange.Type = msoAutoShape) { 224 | for oShape in oShapeRange { 225 | if (oShape.HasTextFrame = msoTrue) { 226 | if (iNewLangID = -1) 227 | iNewLangID := (oShape.TextFrame.TextRange.LanguageID = wdGerman) ? wdEnglishUS : wdGerman 228 | oShape.TextFrame.TextRange.LanguageID := iNewLangID 229 | } 230 | } 231 | } 232 | else if (oShapeRange.Type = msoGroup) { 233 | Loop, % oShapeRange.GroupItems.Count { 234 | oShape := oShapeRange.GroupItems.Item(A_Index) 235 | if (oShape.HasTextFrame = msoTrue) { 236 | if (iNewLangID = -1) 237 | iNewLangID := (oShape.TextFrame.TextRange.LanguageID = wdGerman) ? wdEnglishUS : wdGerman 238 | oShape.TextFrame.TextRange.LanguageID := iNewLangID 239 | } 240 | } 241 | } 242 | else if (oShapeRange.Type = msoTextBox) or (oShapeRange.Type = msoPlaceholder) { 243 | if (oShapeRange.HasTextFrame = msoTrue) { 244 | if (iNewLangID = -1) 245 | iNewLangID := (oShapeRange.TextFrame.TextRange.LanguageID = wdGerman) ? wdEnglishUS : wdGerman 246 | oShapeRange.TextFrame.TextRange.LanguageID := iNewLangID 247 | } 248 | } 249 | ShowToolTip((iNewLangID = wdGerman) ? "Deutsch" : "English", 1500) 250 | } 251 | return 252 | 253 | ; Strg+Shift+j: AdJust shape nodes 254 | ^+j:: 255 | ; ppSelectionNone = 0; ppSelectionSlides = 1; ppSelectionShapes = 2; ppSelectionText = 3 256 | ppSelectionShapes := 2 257 | msoFreeform := 5 258 | ; MsoEditingType: msoEditingAuto = 0; msoEditingCorner = 1; msoEditingSmooth = 2; msoEditingSymmetric = 3; 259 | ; MsoSegmentType: msoSegmentLine = 0; msoSegmentCurve = 1; 260 | msoTrue := -1 261 | msoFalse := 0 262 | msoBringToFront := 0 263 | msoTextOrientationHorizontal := 1 264 | ppAlignLeft := 1 265 | msoAnchorTop := 1 266 | color_black := 0 267 | color_white := 16777215 268 | 269 | try { 270 | selection := ComObjActive("PowerPoint.Application").ActiveWindow.Selection 271 | if (selection.Type == ppSelectionShapes) { 272 | selected_shape := selection.ShapeRange(1) 273 | 274 | if (selected_shape.Type == msoFreeform) { 275 | active_slide_index := ComObjActive("PowerPoint.Application").ActiveWindow.View.Slide.SlideIndex 276 | active_slide := ComObjActive("PowerPoint.Application").ActivePresentation.Slides(active_slide_index) 277 | shape_nodes := selected_shape.Nodes 278 | 279 | ; write the number to each node on slide and store it 280 | number_boxes := [] 281 | Loop, % shape_nodes.Count { 282 | node := shape_nodes.Item(A_Index) 283 | points := node.Points 284 | number_box := active_slide.Shapes.AddTextbox(msoTextOrientationHorizontal, points[1, 1], points[1, 2], 1, 1) 285 | number_box.TextFrame.MarginBottom := 0 286 | number_box.TextFrame.MarginLeft := 0.3 287 | number_box.TextFrame.MarginRight := 0 288 | number_box.TextFrame.MarginTop := 0.3 289 | number_box.TextFrame.TextRange.ParagraphFormat.Alignment := ppAlignLeft 290 | number_box.TextFrame.VerticalAnchor := msoAnchorTop 291 | number_box.TextFrame.WordWrap := msoFalse 292 | number_box.TextFrame.TextRange.Text := A_Index 293 | number_box.TextFrame.TextRange.Font.Size := 7 294 | number_box.TextFrame.TextRange.Font.Color.RGB := color_black 295 | number_box.TextFrame2.TextRange.Font.Glow.Radius := 30 296 | number_box.TextFrame2.TextRange.Font.Glow.Color.RGB := color_white 297 | number_box.TextFrame2.TextRange.Font.Glow.Transparency := 0.1 298 | number_box.ZOrder(msoBringToFront) 299 | ; store text box 300 | number_boxes.Insert(number_box) 301 | } 302 | ; ask user for adjust mode and nodes 303 | user_choice := NodeAdjustSettingsGUI() 304 | if (user_choice != -1) { 305 | node_ids_adjust := user_choice[1] 306 | adjust_mode := user_choice[2] 307 | 308 | ; check if node_ids to adjust are in shape_nodes.Count 309 | nodes_ids_in_range := True 310 | for i, node_id in node_ids_adjust { 311 | if (node_id > shape_nodes.Count) 312 | or (node_id <= 0) { 313 | nodes_ids_in_range := False 314 | break 315 | } 316 | } 317 | 318 | ; Ok clear to go for the adjustment 319 | if (nodes_ids_in_range) { 320 | ; ---ADJUST WITH REFERENCE 321 | if (adjust_mode == 1) or (adjust_mode == 2) { 322 | ; store reference node id (first one) 323 | node_id_reference := node_ids_adjust.Remove(1) 324 | reference_point := shape_nodes.Item(node_id_reference).Points 325 | 326 | ; adjust depending on mode 327 | if (adjust_mode == 1) { ; horizontal alignment 328 | ref_x := reference_point[1, 1] 329 | for i, node_id in node_ids_adjust { 330 | adjust_node_point := shape_nodes.Item(node_id).Points 331 | cur_y := adjust_node_point[1, 2] 332 | shape_nodes.SetPosition(node_id, ref_x, cur_y) 333 | } 334 | } else if (adjust_mode == 2) { ; vertical alignment 335 | ref_y := reference_point[1, 2] 336 | for i, node_id in node_ids_adjust { 337 | adjust_node_point := shape_nodes.Item(node_id).Points 338 | cur_x := adjust_node_point[1, 1] 339 | shape_nodes.SetPosition(node_id, cur_x, ref_y) 340 | } 341 | } 342 | ; ---ADJUST WITHOUT REFERENCE 343 | } else if (adjust_mode == 3) or (adjust_mode == 4) { 344 | if (node_ids_adjust.MaxIndex() >= 3) { 345 | if (adjust_mode == 3) { ; horizontal distribution 346 | adjust_coord_id := 1 ; x-coordinate 347 | fix_coord_id := 2 ; y-coordinate 348 | } else if (adjust_mode == 4) { ; vertical distribution 349 | adjust_coord_id := 2 ; y-coordinate 350 | fix_coord_id := 1 ; x-coordinate 351 | } 352 | 353 | node_pos_id := {} 354 | ; get node id and positions to be sorted 355 | for i, node_id in node_ids_adjust { 356 | adjust_node_point := shape_nodes.Item(node_id).Points 357 | node_pos := adjust_node_point[1, adjust_coord_id] 358 | node_pos_id[node_pos] := node_id ; is then directly sorted by key 359 | } 360 | ; divide nodes in first and last 361 | ; node_pos_id is automatically sorted by key 362 | node_first := [] 363 | node_last := [] 364 | node_count := 0 365 | for node_pos, node_id in node_pos_id { 366 | if (node_count == 0) 367 | node_first := [node_pos, node_id] 368 | node_last := [node_pos, node_id] 369 | node_count += 1 370 | } 371 | ; compute distribution distance 372 | node_delta := Abs(node_last[1] - node_first[1]) / (node_count - 1) 373 | ; move nodes according to computed distance 374 | i := 1 375 | for node_pos, node_id in node_pos_id { 376 | if (node_first[2] == node_id) ; obmit first node 377 | continue 378 | if (node_last[2] == node_id) ; quit on last node 379 | break 380 | ; move middle node 381 | adjust_node_point := shape_nodes.Item(node_id).Points 382 | fix_pos := adjust_node_point[1, fix_coord_id] 383 | adjust_pos := node_first[1] + node_delta * i 384 | if (adjust_mode == 3) { ; horizontal distribution 385 | shape_nodes.SetPosition(node_id, adjust_pos, fix_pos) 386 | } else if (adjust_mode == 4) { ; vertical distribution 387 | shape_nodes.SetPosition(node_id, fix_pos, adjust_pos) 388 | } 389 | i += 1 390 | } 391 | } else { 392 | MsgBox, % "ERROR: Nodes to be adjustet must be more than two!" 393 | } 394 | } 395 | } else { 396 | MsgBox, % "ERROR: Node id(s) out of range!" 397 | } 398 | } 399 | 400 | ; delete number boxes 401 | for i, number_box in number_boxes { 402 | number_box.Delete 403 | } 404 | } 405 | } 406 | } 407 | return 408 | 409 | ; Strg+Shift+h = Hide/Show Slide 410 | ^+h:: 411 | msoTrue := -1 412 | msoFalse := 0 413 | 414 | try { 415 | slide_range := ComObjActive("PowerPoint.Application").ActiveWindow.Selection.SlideRange 416 | new_slide_visibility := (slide_range.SlideShowTransition.Hidden == msoFalse) ? msoTrue : msoFalse 417 | slide_range.SlideShowTransition.Hidden := new_slide_visibility 418 | } 419 | return 420 | 421 | ; Strg+Shift+t = pure Text --> Remove all margins and disable wordwrap 422 | ^+t:: 423 | msoTrue := -1 424 | msoFalse := 0 425 | msoAutoShape := 1 426 | msoGroup := 6 427 | msoTextBox := 17 428 | msoPlaceholder := 14 429 | ppAutoSizeNone := 0 430 | ppAlignCenter := 2 431 | msoAnchorMiddle := 3 432 | 433 | try { 434 | shape_range := ComObjActive("PowerPoint.Application").ActiveWindow.Selection.ShapeRange 435 | if (shape_range.Type = msoAutoShape) { 436 | for shape in shape_range { 437 | if (shape.HasTextFrame = msoTrue) { 438 | shape.TextFrame.MarginBottom := 0 439 | shape.TextFrame.MarginLeft := 0 440 | shape.TextFrame.MarginRight := 0 441 | shape.TextFrame.MarginTop := 0 442 | shape.TextFrame.WordWrap := msoFalse 443 | shape.TextFrame.AutoSize := ppAutoSizeNone 444 | shape.TextFrame.TextRange.ParagraphFormat.Alignment := ppAlignCenter 445 | shape.TextFrame.VerticalAnchor := msoAnchorMiddle 446 | } 447 | } 448 | } 449 | else if (shape_range.Type = msoGroup) { 450 | Loop, % shape_range.GroupItems.Count { 451 | shape := shape_range.GroupItems.Item(A_Index) 452 | if (shape.HasTextFrame = msoTrue) { 453 | shape.TextFrame.MarginBottom := 0 454 | shape.TextFrame.MarginLeft := 0 455 | shape.TextFrame.MarginRight := 0 456 | shape.TextFrame.MarginTop := 0 457 | shape.TextFrame.WordWrap := msoFalse 458 | shape.TextFrame.AutoSize := ppAutoSizeNone 459 | shape.TextFrame.TextRange.ParagraphFormat.Alignment := ppAlignCenter 460 | shape.TextFrame.VerticalAnchor := msoAnchorMiddle 461 | } 462 | } 463 | } 464 | else if (shape_range.Type = msoTextBox) or (shape_range.Type = msoPlaceholder) { 465 | if (shape_range.HasTextFrame = msoTrue) { 466 | shape_range.TextFrame.MarginBottom := 0 467 | shape_range.TextFrame.MarginLeft := 0 468 | shape_range.TextFrame.MarginRight := 0 469 | shape_range.TextFrame.MarginTop := 0 470 | shape_range.TextFrame.WordWrap := msoFalse 471 | shape_range.TextFrame.AutoSize := ppAutoSizeNone 472 | shape_range.TextFrame.TextRange.ParagraphFormat.Alignment := ppAlignCenter 473 | shape_range.TextFrame.VerticalAnchor := msoAnchorMiddle 474 | } 475 | } 476 | } 477 | return 478 | 479 | ; Strg+Shift+r = Lock/Unlock aspect Ratio of shape 480 | ^+r:: 481 | msoTrue := -1 482 | msoFalse := 0 483 | 484 | try { 485 | shape_range := ComObjActive("PowerPoint.Application").ActiveWindow.Selection.ShapeRange 486 | lock_aspect_ratio := (shape_range.LockAspectRatio == msoTrue) ? msoFalse : msoTrue 487 | shape_range.LockAspectRatio := lock_aspect_ratio 488 | ShowToolTip((lock_aspect_ratio == msoTrue) ? "Locked" : "Unlocked", 1500) 489 | } 490 | return 491 | 492 | ; Strg+Shift+z = Start shape editing 493 | ^+z:: 494 | Send, {AppsKey} 495 | Sleep, 100 496 | Send, b 497 | return 498 | 499 | ; Strg+Home = Move selected object to front 500 | ^Home:: 501 | msoBringToFront := 0 502 | try { 503 | ComObjActive("PowerPoint.Application").ActiveWindow.Selection.ShapeRange.ZOrder(msoBringToFront) 504 | } 505 | return 506 | 507 | ; Strg+End = Move selected object to bottom 508 | ^End:: 509 | msoSendToBack := 1 510 | try { 511 | ComObjActive("PowerPoint.Application").ActiveWindow.Selection.ShapeRange.ZOrder(msoSendToBack) 512 | } 513 | return 514 | 515 | ; Strg+BildUp = Move selected object one layer up 516 | ^PgUp:: 517 | msoBringForward := 2 518 | try { 519 | ComObjActive("PowerPoint.Application").ActiveWindow.Selection.ShapeRange.ZOrder(msoBringForward) 520 | } 521 | return 522 | 523 | ; Strg+BildDown = Move selected object one layer down 524 | ^PgDn:: 525 | msoSendBackward := 3 526 | try { 527 | ComObjActive("PowerPoint.Application").ActiveWindow.Selection.ShapeRange.ZOrder(msoSendBackward) 528 | } 529 | return 530 | 531 | ; Strg+g = Group selected objects 532 | ^g:: 533 | try { 534 | ComObjActive("PowerPoint.Application").ActiveWindow.Selection.ShapeRange.Group().Select() 535 | } 536 | return 537 | 538 | ; Strg+Shift+g = Ungroup selected objects 539 | ^+g:: 540 | try { 541 | ComObjActive("PowerPoint.Application").ActiveWindow.Selection.ShapeRange.Ungroup().Select() 542 | } 543 | return 544 | 545 | ; Align selected objects to the left 546 | ^Numpad7:: 547 | msoTrue := -1 548 | msoFalse := 0 549 | msoAlignLefts := 0 550 | try { 551 | shape_range := ComObjActive("PowerPoint.Application").ActiveWindow.Selection.ShapeRange 552 | relative_to_slide_edge := (shape_range.Count = 1) ? msoTrue : msoFalse ; True: relative to slide edge; False: relative to selected elements 553 | shape_range.Align(msoAlignLefts, relative_to_slide_edge) 554 | } 555 | return 556 | 557 | ; Align selected objects to the left (Reference: last selected) 558 | #^Numpad7:: 559 | try { 560 | shape_range := ComObjActive("PowerPoint.Application").ActiveWindow.Selection.ShapeRange 561 | if (shape_range.Count > 1) { 562 | shape_reference := shape_range.Item(shape_range.Count) 563 | Loop, % shape_range.Count - 1 { 564 | shape := shape_range.Item(A_Index) 565 | shape.Left := shape_reference.Left 566 | } 567 | } 568 | } 569 | return 570 | 571 | ; Align selected objects horizontal 572 | ^Numpad8:: 573 | msoTrue := -1 574 | msoFalse := 0 575 | msoAlignCenters := 1 576 | try { 577 | shape_range := ComObjActive("PowerPoint.Application").ActiveWindow.Selection.ShapeRange 578 | relative_to_slide_edge := (shape_range.Count = 1) ? msoTrue : msoFalse ; True: relative to slide edge; False: relative to selected elements 579 | shape_range.Align(msoAlignCenters, relative_to_slide_edge) 580 | } 581 | return 582 | 583 | ; Align selected objects horizontal (Reference: last selected) 584 | #^Numpad8:: 585 | try { 586 | shape_range := ComObjActive("PowerPoint.Application").ActiveWindow.Selection.ShapeRange 587 | if (shape_range.Count > 1) { 588 | shape_reference := shape_range.Item(shape_range.Count) 589 | Loop, % shape_range.Count - 1 { 590 | shape := shape_range.Item(A_Index) 591 | shape.Left := shape_reference.Left + (shape_reference.Width - shape.Width) / 2 592 | } 593 | } 594 | } 595 | return 596 | 597 | ; Align selected objects to the right 598 | ^Numpad9:: 599 | msoTrue := -1 600 | msoFalse := 0 601 | msoAlignRights := 2 602 | try { 603 | shape_range := ComObjActive("PowerPoint.Application").ActiveWindow.Selection.ShapeRange 604 | relative_to_slide_edge := (shape_range.Count = 1) ? msoTrue : msoFalse ; True: relative to slide edge; False: relative to selected elements 605 | shape_range.Align(msoAlignRights, relative_to_slide_edge) 606 | } 607 | return 608 | 609 | ; Align selected objects to the right (Reference: last selected) 610 | #^Numpad9:: 611 | try { 612 | shape_range := ComObjActive("PowerPoint.Application").ActiveWindow.Selection.ShapeRange 613 | if (shape_range.Count > 1) { 614 | shape_reference := shape_range.Item(shape_range.Count) 615 | Loop, % shape_range.Count - 1 { 616 | shape := shape_range.Item(A_Index) 617 | shape.Left := shape_reference.Left + shape_reference.Width - shape.Width 618 | } 619 | } 620 | } 621 | return 622 | 623 | ; Align selected objects to the top 624 | ^Numpad4:: 625 | msoTrue := -1 626 | msoFalse := 0 627 | msoAlignTops := 3 628 | try { 629 | shape_range := ComObjActive("PowerPoint.Application").ActiveWindow.Selection.ShapeRange 630 | relative_to_slide_edge := (shape_range.Count = 1) ? msoTrue : msoFalse ; True: relative to slide edge; False: relative to selected elements 631 | shape_range.Align(msoAlignTops, relative_to_slide_edge) 632 | } 633 | return 634 | 635 | ; Align selected objects to the top (Reference: last selected) 636 | #^Numpad4:: 637 | try { 638 | shape_range := ComObjActive("PowerPoint.Application").ActiveWindow.Selection.ShapeRange 639 | if (shape_range.Count > 1) { 640 | shape_reference := shape_range.Item(shape_range.Count) 641 | Loop, % shape_range.Count - 1 { 642 | shape := shape_range.Item(A_Index) 643 | shape.Top := shape_reference.Top 644 | } 645 | } 646 | } 647 | return 648 | 649 | ; Align selected objects centered vertically 650 | ^Numpad1:: 651 | msoTrue := -1 652 | msoFalse := 0 653 | msoAlignMiddles := 4 654 | try { 655 | shape_range := ComObjActive("PowerPoint.Application").ActiveWindow.Selection.ShapeRange 656 | relative_to_slide_edge := (shape_range.Count = 1) ? msoTrue : msoFalse ; True: relative to slide edge; False: relative to selected elements 657 | shape_range.Align(msoAlignMiddles, relative_to_slide_edge) 658 | } 659 | return 660 | 661 | ; Align selected objects centered vertically (Reference: last selected) 662 | #^Numpad1:: 663 | try { 664 | shape_range := ComObjActive("PowerPoint.Application").ActiveWindow.Selection.ShapeRange 665 | if (shape_range.Count > 1) { 666 | shape_reference := shape_range.Item(shape_range.Count) 667 | Loop, % shape_range.Count - 1 { 668 | shape := shape_range.Item(A_Index) 669 | shape.Top := shape_reference.Top + (shape_reference.Height - shape.Height) / 2 670 | } 671 | } 672 | } 673 | return 674 | 675 | ; Align selected objects to the bottom 676 | ^Numpad0:: 677 | msoTrue := -1 678 | msoFalse := 0 679 | msoAlignBottoms := 5 680 | try { 681 | shape_range := ComObjActive("PowerPoint.Application").ActiveWindow.Selection.ShapeRange 682 | relative_to_slide_edge := (shape_range.Count = 1) ? msoTrue : msoFalse ; True: relative to slide edge; False: relative to selected elements 683 | shape_range.Align(msoAlignBottoms, relative_to_slide_edge) 684 | } 685 | return 686 | 687 | ; Align selected objects to the bottom (Reference: last selected) 688 | #^Numpad0:: 689 | try { 690 | shape_range := ComObjActive("PowerPoint.Application").ActiveWindow.Selection.ShapeRange 691 | if (shape_range.Count > 1) { 692 | shape_reference := shape_range.Item(shape_range.Count) 693 | Loop, % shape_range.Count - 1 { 694 | shape := shape_range.Item(A_Index) 695 | shape.Top := shape_reference.Top + shape_reference.Height - shape.Height 696 | } 697 | } 698 | } 699 | return 700 | 701 | ; Distribute selected elements horizontally to each other 702 | ^Numpad2:: 703 | msoFalse := 0 704 | msoDistributeHorizontally := 0 705 | try { 706 | shape_range := ComObjActive("PowerPoint.Application").ActiveWindow.Selection.ShapeRange 707 | shape_range.Distribute(msoDistributeHorizontally, msoFalse) ; False: distritbute elements relative 708 | } 709 | return 710 | 711 | ; Distribute selected elements vertically to each other 712 | ^Numpad6:: 713 | msoFalse := 0 714 | msoDistributeVertically := 1 715 | try { 716 | shape_range := ComObjActive("PowerPoint.Application").ActiveWindow.Selection.ShapeRange 717 | shape_range.Distribute(msoDistributeVertically, msoFalse) ; False: distritbute elements relative 718 | } 719 | return 720 | 721 | ; Distribute selected elements horizontally in slide 722 | ^#Numpad2:: 723 | msoTrue := -1 724 | msoDistributeHorizontally := 0 725 | try { 726 | shape_range := ComObjActive("PowerPoint.Application").ActiveWindow.Selection.ShapeRange 727 | shape_range.Distribute(msoDistributeHorizontally, msoTrue) ; True: distritbute elements relative in slide 728 | } 729 | return 730 | 731 | ; Distribute selected elements vertically in slide 732 | ^#Numpad6:: 733 | msoTrue := -1 734 | msoDistributeVertically := 1 735 | try { 736 | shape_range := ComObjActive("PowerPoint.Application").ActiveWindow.Selection.ShapeRange 737 | shape_range.Distribute(msoDistributeVertically, msoTrue) ; True: distritbute elements relative in slide 738 | } 739 | return 740 | #IfWinActive -------------------------------------------------------------------------------- /apps/ms_word.ahk: -------------------------------------------------------------------------------- 1 | ;################################################################# 2 | ;##### CfK -- App -- MS Word 3 | ;# = Super, ^ = Ctrl, ! = Alt, + = Shift, ^>! = AltGr 4 | 5 | #IfWinActive ahk_class OpusApp 6 | ; Strg+Shift+w = Toogle warning on saving documents with comments 7 | ; "Vor dem Drucken, Speichern oder Senden einer Datei mit Überarbeitungen" 8 | ; "oder Kommentaren warnen" 9 | ^+w:: 10 | msoTrue := -1 11 | msoFalse := 0 12 | 13 | try { 14 | word := ComObjActive("Word.Application") 15 | show_warning := word.Options.WarnBeforeSavingPrintingSendingMarkup 16 | if (show_warning == msoTrue) { 17 | word.Options.WarnBeforeSavingPrintingSendingMarkup := msoFalse 18 | ShowtoolTip("Show warning before saving: NO", 2000) 19 | } else { 20 | word.Options.WarnBeforeSavingPrintingSendingMarkup := msoTrue 21 | ShowtoolTip("Show warning before saving: YES", 2000) 22 | } 23 | } 24 | return 25 | 26 | ; EDIT TEXT MODE ---------------------------------------------------------- 27 | ; Strg+Shift+e = Toggle track changes 28 | ^+e:: 29 | try { 30 | oWordDoc := ComObjActive("Word.Application").ActiveDocument 31 | bTrackChanges := oWordDoc.TrackRevisions 32 | ; .TrackMoves 33 | ; .TrackFormatting 34 | if (bTrackChanges == -1) { ; -1 = msoTrue 35 | oWordDoc.TrackRevisions := 0 ; 0 = msoFalse 36 | ShowtoolTip("Track changes: NO", 2000) 37 | } else { 38 | oWordDoc.TrackRevisions := -1 ; -1 = msoTrue 39 | ShowtoolTip("Track changes: YES", 2000) 40 | } 41 | } 42 | return 43 | 44 | ; Strg+Shift+r = Toggle Markups show/hide 45 | ^+r:: 46 | try { 47 | oWordView := ComObjActive("Word.Application").ActiveWindow.View 48 | oWordView.RevisionsView := 0 ; 0 = wdRevisionsViewFinal 49 | ;oWordView.MarkupMode := 0 ; 0 = wdBalloonRevisions 50 | if (oWordView.ShowRevisionsAndComments == -1) { ; -1 = msoTrue 51 | oWordView.ShowRevisionsAndComments := 0 ; 0 = msoFalse 52 | ShowtoolTip("Markups visible: NO", 2000) 53 | } else { 54 | oWordView.ShowRevisionsAndComments := -1 ; -1 = msoTrue 55 | ShowtoolTip("Markups visible: YES", 2000) 56 | } 57 | } 58 | return 59 | 60 | ; HIGHLIGHT TEXT ---------------------------------------------------------- 61 | ; https://msdn.microsoft.com/en-us/library/office/ff195343.aspx enum WdColorIndex 62 | ; 0 = wdNoHighlight, 4 = wdBrightGreen, 7 = wdYellow, 6 = wdRed, 5 = wdPink, 63 | 64 | ; Strg+Shift+y = Highlight/Markierung löschen 65 | ^+y:: 66 | try { 67 | ; stop tracking changes (if tracked) 68 | oWordDoc := ComObjActive("Word.Application").ActiveDocument 69 | bTrackChanges := oWordDoc.TrackRevisions 70 | oWordDoc.TrackRevisions := 0 ; 0 = msoFalse 71 | ; remove highlight from text 72 | ComObjActive("Word.Application").Selection.Range.HighlightColorIndex := 0 ; 0 = wdNoHighlight 73 | ; restore tracking changes status 74 | oWordDoc.TrackRevisions := bTrackChanges 75 | } 76 | return 77 | ; Strg+Shift+x = Gelb markieren 78 | ^+x:: 79 | try { 80 | ; stop tracking changes (if tracked) 81 | oWordDoc := ComObjActive("Word.Application").ActiveDocument 82 | bTrackChanges := oWordDoc.TrackRevisions 83 | oWordDoc.TrackRevisions := 0 ; 0 = msoFalse 84 | ; highlight text 85 | ComObjActive("Word.Application").Selection.Range.HighlightColorIndex := 7 ; 7 = wdYellow 86 | ; restore tracking changes status 87 | oWordDoc.TrackRevisions := bTrackChanges 88 | } 89 | return 90 | ; Strg+Shift+c= Magenta markieren 91 | ^+c:: 92 | try { 93 | ; stop tracking changes (if tracked) 94 | oWordDoc := ComObjActive("Word.Application").ActiveDocument 95 | bTrackChanges := oWordDoc.TrackRevisions 96 | oWordDoc.TrackRevisions := 0 ; 0 = msoFalse 97 | ; highlight text 98 | ComObjActive("Word.Application").Selection.Range.HighlightColorIndex := 5 ; 5 = wdPink 99 | ; restore tracking changes status 100 | oWordDoc.TrackRevisions := bTrackChanges 101 | } 102 | return 103 | ; Strg+Shift+v = Grün markieren 104 | ^+v:: 105 | try { 106 | ; stop tracking changes (if tracked) 107 | oWordDoc := ComObjActive("Word.Application").ActiveDocument 108 | bTrackChanges := oWordDoc.TrackRevisions 109 | oWordDoc.TrackRevisions := 0 ; 0 = msoFalse 110 | ; highlight text 111 | ComObjActive("Word.Application").Selection.Range.HighlightColorIndex := 4 ; 4 = wdBrightGreen 112 | ; restore tracking changes status 113 | oWordDoc.TrackRevisions := bTrackChanges 114 | } 115 | return 116 | ; Strg+Shift+b = Türkis markieren 117 | ^+b:: 118 | try { 119 | ; stop tracking changes (if tracked) 120 | oWordDoc := ComObjActive("Word.Application").ActiveDocument 121 | bTrackChanges := oWordDoc.TrackRevisions 122 | oWordDoc.TrackRevisions := 0 ; 0 = msoFalse 123 | ; highlight text 124 | ComObjActive("Word.Application").Selection.Range.HighlightColorIndex := 3 ; 3 = wdTurquoise 125 | ; restore tracking changes status 126 | oWordDoc.TrackRevisions := bTrackChanges 127 | } 128 | return 129 | ; Strg+Shift+n = Rot markieren 130 | ^+n:: 131 | try { 132 | ; stop tracking changes (if tracked) 133 | oWordDoc := ComObjActive("Word.Application").ActiveDocument 134 | bTrackChanges := oWordDoc.TrackRevisions 135 | oWordDoc.TrackRevisions := 0 ; 0 = msoFalse 136 | ; highlight text 137 | ComObjActive("Word.Application").Selection.Range.HighlightColorIndex := 6 ; 6 = wdRed 138 | ; restore tracking changes status 139 | oWordDoc.TrackRevisions := bTrackChanges 140 | } 141 | return 142 | 143 | ; INSERT / DELETE --------------------------------------------------------- 144 | ; Strg+m = Paste as text only 145 | ^m:: 146 | try { 147 | ComObjActive("Word.Application").Selection.PasteSpecial(ComObjMissing(),ComObjMissing(),0,ComObjMissing(),2) ; 0 = wdInLine; 2 = wdPasteText 148 | } 149 | return 150 | 151 | ; Strg+b = Paste as emf 152 | ^b:: 153 | try { 154 | ComObjActive("Word.Application").Selection.PasteSpecial(ComObjMissing(),ComObjMissing(),0,ComObjMissing(),9) ; 0 = wdInLine; 9 = wdPasteEnhancedMetafile 155 | } 156 | return 157 | 158 | ; Strg+n = Paste as png 159 | ^n:: 160 | try { 161 | ComObjActive("Word.Application").Selection.PasteSpecial(ComObjMissing(),ComObjMissing(),0,ComObjMissing(),14) ; 0 = wdInLine; 14 = wdPastePNG 162 | } 163 | return 164 | 165 | ; Strg+Space = Insert thin (not breakable) space U+2009 / 8201 (dezimal) 166 | ; Word: 2009{ALT}{C} 167 | ^Space:: 168 | msoTrue := -1 169 | try { 170 | ComObjActive("Word.Application").Selection.InsertSymbol(0x2009, "", msoTrue) 171 | } 172 | return 173 | 174 | ; Strg+Super++(Numpad) = Zeile in Word-Tabelle unterhalb hinzufügen 175 | ^#NumpadAdd:: 176 | try { 177 | ComObjActive("Word.Application").Selection.InsertRowsBelow(1) 178 | } 179 | return 180 | 181 | ; Strg+Super+-(Numpad) = Aktuelle Zeile in Word-Tabelle löschen 182 | ^#NumpadSub:: 183 | try { 184 | ComObjActive("Word.Application").Selection.Rows.Delete() 185 | } 186 | return 187 | 188 | ; Strg+Shift+l = Toggle German/English auto correction 189 | ^+l:: 190 | wdGerman := 1031 191 | wdEnglishUK := 2057 192 | wdEnglishUS := 1033 193 | 194 | try { 195 | oSelection := ComObjActive("Word.Application").Selection 196 | iNewLangID := (oSelection.LanguageID = wdGerman) ? wdEnglishUS : wdGerman 197 | oSelection.LanguageID := iNewLangID 198 | ShowToolTip((iNewLangID = wdGerman) ? "Deutsch" : "English", 1500) 199 | } 200 | return 201 | 202 | ; Strg+Shift+Super+l = Toggle spellchecking 203 | ^+#l:: 204 | msoTrue := -1 205 | msoFalse := 0 206 | 207 | try { 208 | oSelection := ComObjActive("Word.Application").Selection 209 | iNewProofing := (oSelection.NoProofing = msoFalse) ? msoTrue : msoFalse 210 | oSelection.NoProofing := iNewProofing 211 | ShowToolTip((iNewProofing = msoFalse) ? "Spellchecking: YES" : "Spellchecking: NO", 1500) 212 | } 213 | return 214 | #IfWinActive -------------------------------------------------------------------------------- /apps/virtuawin.ahk: -------------------------------------------------------------------------------- 1 | ;################################################################# 2 | ;##### CfK -- APP -- VirtuaWin 3 | ;# = Super, ^ = Ctrl, ! = Alt, + = Shift, ^>! = AltGr 4 | 5 | ;----- ReMap: Ctrl+Alt+WheelUp -> Ctrl+Alt+Up 6 | ^!WheelUp::^!Up 7 | return 8 | 9 | ;----- ReMap: Ctrl+Alt+Down -> Ctrl+Alt+Down 10 | ^!WheelDown::^!Down 11 | return 12 | 13 | ;----- ReMap: Ctrl+Alt+Shift+WheelUp -> Ctrl+Alt+Shift+Up 14 | ^!+WheelUp::^!+Up 15 | return 16 | 17 | ;----- ReMap: Ctrl+Alt+Shift+Down -> Ctrl+Alt+Shift+Down 18 | ^!+WheelDown::^!+Down 19 | return 20 | 21 | ;----- ReMap: Ctrl+Alt+MiddleMouseButton -> Ctrl+Alt+w 22 | ^RButton::^!w 23 | return -------------------------------------------------------------------------------- /misc/#global_functions.ahk: -------------------------------------------------------------------------------- 1 | ;################################################################# 2 | ;##### CfK -- core -- Global functions 3 | ;# = Super, ^ = Ctrl, ! = Alt, + = Shift, ^>! = AltGr 4 | 5 | ShowToolTip(sText, iDuration) 6 | { 7 | ToolTip, %sText% 8 | SetTimer, RemoveToolTip, %iDuration% 9 | } 10 | 11 | RemoveToolTip: 12 | SetTimer, RemoveToolTip, Off 13 | ToolTip 14 | return 15 | 16 | BringToFront(process_id) 17 | { 18 | ; ; Process, wait, %process_id%, 4 19 | ; ; WinActivate, ahk_pid %process_id% 20 | ; ; WinRestore, ahk_pid %process_id% 21 | ; ; WinSet, Top,, ahk_pid %process_id% 22 | ; WinWait, ahk_pid %process_id%, , 10 23 | ; WinActivate, ahk_pid %process_id% 24 | ; WinSet, Top, , ahk_pid %process_id% 25 | ; Loop, 12 26 | ; { 27 | ; if WinExist("ahk_pid " . process_id) 28 | ; { 29 | ; WinActivate, ahk_pid %process_id% 30 | ; WinSet, Top, , ahk_pid %process_id% 31 | ; ; ShowToolTip("Brought to Front", 2000) 32 | ; Break 33 | ; } 34 | ; ; ShowToolTip("failed", 100) 35 | ; Sleep, 250 36 | ; } 37 | return 38 | } 39 | 40 | hasValue(haystack, needle) { 41 | if (!isObject(haystack)) 42 | return false 43 | if (haystack.Length()==0) 44 | return false 45 | for k, v in haystack 46 | if (v == needle) 47 | return true 48 | return false 49 | } 50 | 51 | RunGetOutput(cmd) { 52 | shell := ComObjCreate("WScript.Shell") 53 | exec := shell.Exec("cmd.exe /q /c " cmd) 54 | if (A_LastError) 55 | return 0 56 | return exec.StdOut.ReadAll() 57 | } 58 | 59 | inRDP() { 60 | RegRead, CN, HKCU, Volatile Environment, CLIENTNAME 61 | RegRead, SN, HKCU, Volatile Environment, SESSIONNAME 62 | If (SN == "") 63 | { 64 | Loop, Reg, HKEY_CURRENT_USER\Volatile Environment, K 65 | { 66 | RegRead, CN, HKCU, Volatile Environment\%a_LoopRegName%, CLIENTNAME 67 | RegRead, SN, HKCU, Volatile Environment\%a_LoopRegName%, SESSIONNAME 68 | If (SN <> "") 69 | break 70 | } 71 | } 72 | 73 | If (SN == "") 74 | return "" 75 | Else 76 | return CN 77 | } 78 | 79 | updateTrayIcon() { 80 | If A_ISSUSPENDED = 1 81 | Menu, Tray, Icon, .\#ico\CfKs.ico, 1, 1 82 | Else If A_ISSUSPAUSED = 1 83 | Menu, Tray, Icon, .\#ico\CfKp.ico, 1, 1 84 | Else 85 | Menu, Tray, Icon, .\#ico\CfK.ico, 1, 1 86 | } 87 | 88 | ; isWinVisible(WinTitle) 89 | ; { 90 | ; WinGet, Style, Style, %WinTitle% 91 | ; Transform, Result, BitAnd, %Style%, 0x10000000 ; 0x10000000 is WS_VISIBLE. 92 | ; if (Result <> 0) ;Window is Visible 93 | ; { 94 | ; Return 1 95 | ; } 96 | ; Else ;Window is Hidden 97 | ; { 98 | ; Return 0 99 | ; } 100 | ; } 101 | 102 | ; Retrieves the size of the monitor, the mouse is present 103 | activeMonitorInfo(ByRef monitor_left, ByRef monitor_top, ByRef monitor_width, ByRef monitor_height) { 104 | CoordMode, Mouse, Screen 105 | MouseGetPos, mouse_x , mouse_y 106 | SysGet, monitor_count, MonitorCount 107 | Loop %monitor_count% 108 | { 109 | SysGet, curMon, Monitor, %a_index% 110 | if (mouse_x >= curMonLeft and mouse_x <= curMonRight and mouse_y >= curMonTop and mouse_y <= curMonBottom) 111 | { 112 | monitor_left := curMonLeft 113 | monitor_top := curMonTop 114 | monitor_height := curMonBottom - curMonTop 115 | monitor_width := curMonRight - curMonLeft 116 | return 117 | } 118 | } 119 | } 120 | 121 | ; Retrieves the workarea on monitor, the mouse is present 122 | activeMonitorWorkArea(ByRef workarea_left, ByRef workarea_top, ByRef workarea_width, ByRef workarea_height) { 123 | CoordMode, Mouse, Screen 124 | MouseGetPos, mouse_x , mouse_y 125 | SysGet, monitor_count, MonitorCount 126 | Loop %monitor_count% 127 | { 128 | SysGet, curMon, Monitor, %a_index% 129 | if (mouse_x >= curMonLeft and mouse_x <= curMonRight and mouse_y >= curMonTop and mouse_y <= curMonBottom) 130 | { 131 | SysGet, workArea, MonitorWorkArea, %a_index% 132 | workarea_left := workAreaLeft 133 | workarea_top := workAreaTop 134 | workarea_height := workAreaBottom - workAreaTop 135 | workarea_width := workAreaRight - workAreaLeft 136 | return 137 | } 138 | } 139 | } 140 | 141 | ; Retrives the size and position of windows taskbar 142 | taskbarInfo(ByRef taskbar_left, ByRef taskbar_top, ByRef taskbar_width, ByRef taskbar_height) { 143 | WinGetPos, taskbar_left, taskbar_top, taskbar_width, taskbar_height, ahk_class Shell_TrayWnd 144 | } 145 | 146 | RunWithProxy(ByRef target) { 147 | ; cmd /V /C "set http_proxy=http://sfl-hza-prx-02.schaeffler.com:8080&&C:\CfK\Clementine\clementine.exe" 148 | target_call := "SET http_proxy=http://sfl-hza-prx-02.schaeffler.com:8080" 149 | target_call := target_call . " && SET http_proxys=http://sfl-hza-prx-02.schaeffler.com:8080" 150 | target_call := target_call . " && SET ftp_proxy=http://sfl-hza-prx-02.schaeffler.com:8080" 151 | target_call := target_call . " && START " . target 152 | Run, cmd.exe /c %target_call%, , , NewPID 153 | BringToFront(NewPID) 154 | } 155 | 156 | TriggerWebProxyAuthentication() { 157 | ; US public broadcasting GDPR-compliant site, very small 158 | URL := "https://text.npr.org/robots.txt" 159 | try { 160 | ie := ComObjCreate("InternetExplorer.Application") 161 | ie.Visible := false ; hide IE 162 | ie.Navigate(URL) 163 | ; give the browser some time to load the url 164 | sleep 5000 165 | ; quit the instance of the IE 166 | ie.quit() 167 | return 1 168 | } catch { 169 | return 0 170 | } 171 | } 172 | -------------------------------------------------------------------------------- /misc/#global_hotkeys.ahk: -------------------------------------------------------------------------------- 1 | ;################################################################# 2 | ;##### CfK -- Global hotkeys 3 | ;# = Super, ^ = Ctrl, ! = Alt, + = Shift, ^>! = AltGr 4 | 5 | ;----- WORKAROUND: Super -> Disable windows menu opening on shortcut 6 | ;~LWin Up:: 7 | ;return 8 | ;~RWin Up:: 9 | ;return 10 | 11 | ;----- Super+. -> Insert Date Format without - 12 | #.:: 13 | FormatTime, sDate,, yyyy-MM-dd 14 | SendInput, %sDate% 15 | return 16 | 17 | ;----- Strg+Super+. -> Insert Date with - 18 | ^#.:: 19 | FormatTime, sDate,, yyyyMMdd 20 | SendInput, %sDate% 21 | return 22 | 23 | ;----- Strg+Alt+Super+. -> Insert Date with - 24 | ^!#.:: 25 | FormatTime, sDate,, yyyy-MM-dd 26 | WeekOfYear = %A_YDay% 27 | WeekOfYear /= 7 28 | WeekOfYear++ ; Convert from 0-base to 1-base 29 | SendInput, [DAF] Status Report %sDate% for KW%WeekOfYear% 30 | return 31 | 32 | ;----- Super+, -> Insert Time (without :) 33 | #,:: 34 | FormatTime, sTime,, HHmm 35 | SendInput, %sTime% 36 | return 37 | 38 | ;----- Super+- -> Insert Date_Time (date without -) 39 | #-:: 40 | FormatTime, sDateTime,, yyyyMMdd--HHmm 41 | SendInput, %sDateTime% 42 | return 43 | 44 | ;----- Strg+Super+, -> Insert Time 45 | ^#,:: 46 | FormatTime, sTime,, HH:mm 47 | SendInput, %sTime% 48 | return 49 | 50 | ;----- Strg+Super+- -> Insert Date_Time (date with -) 51 | ^#-:: 52 | FormatTime, sDateTime,, yyyy-MM-dd--HHmm 53 | SendInput, %sDateTime% 54 | return 55 | 56 | ;----- Alt+Strg+Super+Shift+h --> Hide current window 57 | !^+#h:: 58 | WinGetTitle, Title, A 59 | WinHide, %Title% 60 | return 61 | 62 | ; ;----- Alt+Strg+Super+Shift+c --> Clear cashes 63 | ; !^+#c:: 64 | ; ; clementine 65 | ; EnvGet, USERPROFILE, USERPROFILE 66 | ; Run, rm -R "%USERPROFILE%\.config\Clementine\spotify-cache\Storage" 67 | ; Run, rm -R "%USERPROFILE%\.config\Clementine\networkcache" 68 | ; ; pyinstaller 69 | ; Run, rm -R "%USERPROFILE%\AppData\Roaming\pyinstaller" 70 | ; ; .mediathek3 71 | ; Run, rm -R "%USERPROFILE%\.mediathek3" 72 | ; ; jupyther 73 | ; Run, rm -R "%USERPROFILE%\AppData\Roaming\jupyter" 74 | ; ; Downloads 75 | ; Run, rm -R "%USERPROFILE%\Downloads\*.*" 76 | 77 | ; return 78 | 79 | ; ;----- Alt+Strg+Super+Shift+l --> Link caches in Local/Roaming Folder to C:\ 80 | ; !^+#l:: 81 | ; cache_local := ["Microsoft\Outlook", "fontconfig"] 82 | ; cache_roaming := ["Spotify", "texstudio", "Adobe"] 83 | 84 | ; ; Local 85 | ; EnvGet, USERPROFILE, USERPROFILE 86 | ; for index, app_name in cache_local { 87 | ; RunWait, junction -d "%USERPROFILE%\AppData\Local\%app_name%" 88 | ; RunWait, rm -Rf "%USERPROFILE%\AppData\Local\%app_name%" 89 | ; RunWait, junction "%USERPROFILE%\AppData\Local\%app_name%" "C:\Benutzerdaten\kuestner\cache_Local\%app_name%" 90 | ; } 91 | 92 | ; ; Roaming 93 | ; EnvGet, USERPROFILE, USERPROFILE 94 | ; for index, app_name in cache_roaming { 95 | ; RunWait, junction -d "%USERPROFILE%\AppData\Roaming\%app_name%" 96 | ; RunWait, rm -Rf "%USERPROFILE%\AppData\Roaming\%app_name%" 97 | ; RunWait, junction "%USERPROFILE%\AppData\Roaming\%app_name%" "C:\Benutzerdaten\kuestner\cache_Roaming\%app_name%" 98 | ; } 99 | ; return 100 | 101 | ;----- Super+q -> hide outlook envelope 102 | ;#q:: 103 | ; try { 104 | ; ; Workaround: Get top item in sent folder and mark it unread and read to hide the outlook envelope 105 | ; oFolderSentMail := ComObjActive("Outlook.Application").Session.GetDefaultFolder(5) ; 5 = Outlook.OlDefaultFolders.olFolderSentMail 106 | ; oLastItem := oFolderSentMail.Items(oFolderSentMail.Items.Count) 107 | ; oLastItem.UnRead := 1 ; True (mark unread) 108 | ; oLastItem.UnRead := 0 ; False (mark read) 109 | ; } 110 | ;return 111 | 112 | ;----- Super+L -> Mute, Lock screen and turn off monitor 113 | #l:: 114 | ; Send {Volume_Mute} ; unmuted bei gemuted ;( 115 | ; Send {Volume_Down 50} 116 | Send, {Media_Stop 2} 117 | Sleep 500 118 | Run, %A_WinDir%\System32\rundll32.exe user32.dll`, LockWorkStation 119 | Sleep 1500 120 | SendMessage 0x112, 0xF170, 2, , Program Manager 121 | return 122 | 123 | ;----- Strg+Super+Shift+S -> Toggle Screensaver activation 124 | !^+#s:: 125 | ; Check Screensaver Status 126 | DllCall("SystemParametersInfo", Int,16, UInt,NULL, "UInt *",bIsScreensaverActive, Int,0) 127 | If (bIsScreensaverActive) 128 | { 129 | DllCall("SystemParametersInfo", Int,17, Int,0, UInt,NULL, Int,2) 130 | MsgBox Screensaver disabled! 131 | } 132 | Else 133 | { 134 | DllCall("SystemParametersInfo", Int,17, Int,1, UInt,NULL, Int,2) 135 | MsgBox Screensaver enabled! 136 | } 137 | return 138 | 139 | ;------ Super + H --> detect other autohotkeyscripts 140 | #h:: 141 | DetectHiddenWindows, On 142 | WinGet, wList, List, ahk_class AutoHotkey 143 | MsgBox % "AutoHoteky scripts running: " wList 144 | return 145 | 146 | ;------ Strg+Super+Y --> Show pid of current window 147 | ^#y:: 148 | MouseGetPos, mouseX, mouseY, mouseid, mousecontrol 149 | WinGet, processid, PID, ahk_id %mouseid% 150 | WinGetClass, winclass, ahk_id %mouseid% 151 | WinGetTitle, wintitle, ahk_id %mouseid% 152 | WinGetPos, window_x, window_y, window_width, window_height, ahk_id %mouseid% 153 | out = procces_id: %processid%`nahk_id: %mouseid%`nahk_class (Class): %winclass%`ncontrol (ClassNN): %mousecontrol%`ntitle: %wintitle%`nmouse coord (x, y): %mouseX%, %mouseY%`nwindow dimensions (x, y, w, h): %window_x%, %window_y%, %window_width%, %window_height% 154 | WinClip.SetText(out) 155 | ShowToolTip(out, 7000) 156 | return 157 | 158 | ;------ Strg+Shift+Super+F5 --> Trigger Web Proxy Authentication 159 | ^+#F5:: 160 | ShowToolTip("Triggering Web Proxy...", 4500) 161 | trigger_ok := TriggerWebProxyAuthentication() 162 | if (trigger_ok == 1) { 163 | ShowToolTip("Triggered Web Proxy: OK", 3000) 164 | } else { 165 | ShowToolTip("Triggered Web Proxy: !!!FAILED!!!", 3000) 166 | } 167 | return 168 | 169 | ; ;----- Super+Pause -> Suspend Windows 170 | ; #Pause:: 171 | ; ;Run rundll32.exe user32.dll`,LockWorkStation 172 | ; ;Sleep 1000 173 | ; DllCall("PowrProf\SetSuspendState", "int", 0, "int", 0, "int", 0) 174 | ; return 175 | 176 | ; ;----- Fast Scrolling 177 | ; #WheelDown:: 178 | ; Send {WheelDown 3} 179 | ; ; Sleep, 75 180 | ; return 181 | 182 | ; #WheelUp:: 183 | ; Send {WheelUp 3} 184 | ; ; Sleep, 75 185 | ; return 186 | -------------------------------------------------------------------------------- /misc/hotstrings.ahk: -------------------------------------------------------------------------------- 1 | ;################################################################# 2 | ;##### CfK -- hotstrings 3 | ;# = Super, ^ = Ctrl, ! = Alt, + = Shift, ^>! = AltGr 4 | 5 | ; salutations 6 | :O:vg.::Viele Grüße`nChristof{Up 2} 7 | :O:vgg.::Viele Grüße`nChristof Küstner{Up 2} 8 | :O:lg.::Liebe Grüße`nChristof{Up 2} 9 | :O:gd.::Danke und viele Grüße`nChristof{Up 2} 10 | :O:gdd.::Danke und viele Grüße`nChristof Küstner{Up 2} 11 | :O:dg.::Danke und viele Grüße`nChristof{Up 2} 12 | :O:dgg.::Danke und viele Grüße`nChristof Küstner{Up 2} 13 | :O:br.::Best regards,`nChristof{Up 2} 14 | :O:brr.::Best regards,`nChristof Küstner{Up 2} 15 | :O:kr.::Kind regards,`nChristof{Up 2} 16 | :O:krr.::Kind regards,`nChristof Küstner{Up 2} 17 | :O:ys.::Yours sincerely,`nChristof Küstner{Up 2} 18 | :O:mfg.::Mit freundlichen Grüßen`nChristof Küstner{Up 2} 19 | 20 | ; unicode characters 21 | :O::DONE::✔ 22 | :O::HM::🤔 23 | :O::SWEAT::😅 24 | :O::EYE::😲 25 | :O::CHEEK::😊 26 | :O::ROCK::🤘 27 | -------------------------------------------------------------------------------- /misc/media_control.ahk: -------------------------------------------------------------------------------- 1 | ;################################################################# 2 | ;##### CfK -- media control 3 | ;# = Super, ^ = Ctrl, ! = Alt, + = Shift, ^>! = AltGr 4 | 5 | ;----- ReMap: Increase Volume with Mouse 6 | ^+WheelUp:: 7 | Send, {Volume_Up} 8 | return 9 | 10 | ;----- ReMap: Decrease Volume with Mouse 11 | ^+WheelDown:: 12 | Send, {Volume_Down} 13 | return 14 | 15 | ;----- ReMap: Next Track with Mouse 16 | ^+#RButton:: 17 | Send, {Media_Next} 18 | return 19 | 20 | ;----- ReMap: Prev Track with Mouse 21 | ^+#LButton:: 22 | Send, {Media_Prev} 23 | return 24 | 25 | ;----- ReMap: Play/Pause with Mouse 26 | ^+#MButton:: 27 | Send, {Media_Play_Pause} 28 | return 29 | -------------------------------------------------------------------------------- /misc/register_user_fonts.ahk: -------------------------------------------------------------------------------- 1 | ;################################################################# 2 | ;##### CfK -- register user fonts 3 | ;# = Super, ^ = Ctrl, ! = Alt, + = Shift, ^>! = AltGr 4 | #NoEnv 5 | 6 | ; FONT location (linux-like): ~/.fonts 7 | ; Source: https://autohotkey.com/board/topic/31031-portable-font/ 8 | EnvGet, HOME, HOME 9 | global USER_FONT_LOCATION := HOME "\.fonts" 10 | 11 | ; Register all fonts in USER_FONT_LOCATION 12 | Loop, %USER_FONT_LOCATION%\*.* 13 | { 14 | DllCall("AddFontResource", Str, A_LoopFileFullPath) 15 | ; DllCall("RemoveFontResource", Str, A_LoopFileFullPath) 16 | } 17 | ; Broadcast the change 18 | PostMessage, 0x1D,,,, ahk_id 0xFFFF 19 | -------------------------------------------------------------------------------- /window_management/alternative_tab.ahk: -------------------------------------------------------------------------------- 1 | ;################################################################# 2 | ;##### CfK -- Alternative Tab 3 | ;# = Super, ^ = Ctrl, ! = Alt, + = Shift, ^>! = AltGr 4 | 5 | ; ; ----- Switch between Apps same class 6 | ; ^+a::Send, {LWinDOWN}1{LWinUP} 7 | ; return 8 | ; ^+s::Send, {LWinDOWN}2{LWinUP} 9 | ; return 10 | ; ^+d::Send, {LWinDOWN}3{LWinUP} 11 | ; return 12 | 13 | ; ; Switching between windows of the same app 14 | ; !SC056:: ; Next window Cmd+\ (left from Z) 15 | ; WinGetClass, ActiveClass, A 16 | ; WinGet, WinClassCount, Count, ahk_class %ActiveClass% 17 | ; IF WinClassCount = 1 18 | ; Return 19 | ; Else 20 | ; WinSet, Bottom,, A 21 | ; WinActivate, ahk_class %ActiveClass% 22 | ; return 23 | 24 | ; --- Activate next window of same application 25 | #SC056:: ; Super+< (Key left from Y (or Z on EN keyboards)) 26 | WS_VISIBLE := 0x10000000 27 | 28 | WinGetClass, active_class, A 29 | WinGet, win_class_count, Count, ahk_class %active_class% 30 | if (win_class_count = 1) 31 | return 32 | else 33 | WinGet, win_list, List, % "ahk_class " active_class 34 | 35 | Loop, % win_list 36 | { 37 | index := win_list - A_Index + 1 38 | next_ahk_id := win_list%index% 39 | 40 | ; Check if compatible next window 41 | WinGet, next_win_style, Style, % "ahk_id " next_ahk_id 42 | WinGet, next_win_state, MinMax, % "ahk_id " next_ahk_id 43 | if (next_win_style & WS_VISIBLE) 44 | ; and (next_win_state <> -1) ; check min/max state 45 | { 46 | WinActivate, % "ahk_id " next_ahk_id 47 | break 48 | } 49 | } 50 | ; TODO: Windows Explorer and Chrome 51 | ; see https://autohotkey.com/docs/misc/WinTitle.htm#ahk_group 52 | return 53 | 54 | ; --- Activate last used window 55 | ; global tab_last_active_ahk_id := 0x0 56 | global tab_win_list := "" 57 | global tab_win_list_index := 0 58 | 59 | cycleLastUsedWindows() { 60 | WS_VISIBLE := 0x10000000 61 | 62 | WinGetTitle, active_title, A 63 | Loop, % tab_win_list 64 | { 65 | ; index := tab_win_list - A_INDEX + 1 66 | index := A_INDEX + tab_win_list_index + 1 67 | next_ahk_id := tab_win_list%index% 68 | 69 | ; TODO: https://jacksautohotkeyblog.wordpress.com/2017/05/27/check-window-status-with-winget-exstyle-autohotkey-tip/ 70 | ; TODO: Use styles to determine if it is a real visible window 71 | 72 | ; Check if compatible next window 73 | WinGet, next_win_style, Style, % "ahk_id " next_ahk_id 74 | WinGet, next_win_state, MinMax, % "ahk_id " next_ahk_id 75 | WinGetTitle, next_title, % "ahk_id " next_ahk_id 76 | ; visible and not minimized and exists 77 | if (next_win_style & WS_VISIBLE) ; visible 78 | and (next_win_state <> -1) ; not minimized 79 | and (WinExist("ahk_id " next_ahk_id)) ; should exist 80 | and (active_title <> next_title) 81 | ; and (next_ahk_id <> tab_last_active_ahk_id) 82 | and (next_title <> "") 83 | and (next_title <> "Program Manager") 84 | and (next_title <> "Microsoft Store") 85 | and (next_title <> "VirtuaWinMainClass") 86 | and (!inStr(next_title, "Host für die Windows Shell")) 87 | { 88 | ; MsgBox, % "break: " active_title " >> "next_active_title 89 | WinActivate, % "ahk_id " next_ahk_id 90 | ;tab_last_active_ahk_id := next_ahk_id 91 | tab_win_list_index := index 92 | break 93 | } 94 | } 95 | } 96 | 97 | #SC029 Up:: ; Super+^ (Key above tab) 98 | WinGet, tab_win_list, List 99 | tab_win_list_index := 0 100 | cycleLastUsedWindows() 101 | return 102 | 103 | #SC029:: ; Super+^ (Key above tab) 104 | cycleLastUsedWindows() 105 | return 106 | 107 | !#SC029:: 108 | ; list al visible "windows" >> TODO: Check Other Styles 109 | WS_VISIBLE := 0x10000000 110 | delim := "`r`n" 111 | WinGet, win_list, List 112 | Loop, % win_list 113 | { 114 | current_ahk_id := win_list%A_Index% 115 | 116 | WinGet, win_style, Style, % "ahk_id " current_ahk_id 117 | WinGet, win_state, MinMax, % "ahk_id " current_ahk_id 118 | WinGetTitle, win_title, % "ahk_id " current_ahk_id 119 | If (win_style & WS_VISIBLE) ; visible 120 | and (win_state <> -1) ; not minimized 121 | and (WinExist("ahk_id " current_ahk_id)) ; should exist 122 | and (win_title <> "") 123 | and (win_title <> "Program Manager") 124 | and (win_title <> "Microsoft Store") 125 | and (win_title <> "VirtuaWinMainClass") 126 | and (!inStr(win_title, "Host für die Windows Shell")) 127 | { 128 | out .= ( out="" ? "" : delim ) win_title 129 | } 130 | } 131 | MsgBox, % out 132 | return 133 | -------------------------------------------------------------------------------- /window_management/extended_scrolling.ahk: -------------------------------------------------------------------------------- 1 | ;################################################################# 2 | ;##### CfK -- extended scrolling - mostly horizontal 3 | ;# = Super, ^ = Ctrl, ! = Alt, + = Shift, ^>! = AltGr 4 | 5 | ; PowerPoint horizontal scolling 6 | #IfWinActive ahk_class PPTFrameClass 7 | +WheelDown:: ; RIGHT 8 | ScrollStep := 5.0 9 | com_object := ComObjActive("PowerPoint.Application") 10 | com_object.ActiveWindow.SmallScroll(0,0,ScrollStep,0) 11 | return 12 | 13 | +WheelUp:: ; LEFT 14 | ScrollStep := 5.0 15 | com_object := ComObjActive("PowerPoint.Application") 16 | com_object.ActiveWindow.SmallScroll(0,0,0,ScrollStep) 17 | return 18 | #IfWinActive 19 | 20 | ; Excel horizontal scolling 21 | #IfWinActive ahk_class XLMAIN 22 | +WheelDown:: ; RIGHT 23 | ScrollStep := 3.0 24 | com_object := ComObjActive("Excel.Application") 25 | com_object.ActiveWindow.SmallScroll(0,0,ScrollStep,0) 26 | return 27 | 28 | +WheelUp:: ; LEFT 29 | ScrollStep := 3.0 30 | com_object := ComObjActive("Excel.Application") 31 | com_object.ActiveWindow.SmallScroll(0,0,0,ScrollStep) 32 | return 33 | #IfWinActive 34 | 35 | ; Outlook calendar horizontal scolling 36 | #IfWinActive ahk_class rctrl_renwnd32 37 | ; WinGetClass, sClass, ahk_id %hWin% 38 | MouseGetPos,,,, sClassNN 39 | if (sClassNN == "DayViewWnd1") ; Outlook Calender Viewport 40 | { 41 | +WheelDown:: ; RIGHT 42 | ; Controlsend, , {Shift UP}{Ctrl DOWN}{Right}{Ctrl UP}, ahk_id %hWin% 43 | SendInput, {Ctrl DOWN}{Right}{Ctrl UP} 44 | return 45 | 46 | +WheelUp:: ; LEFT 47 | ; Controlsend, , {Shift UP}{Ctrl DOWN}{Left}{Ctrl UP}, ahk_id %hWin% 48 | SendInput, {Ctrl DOWN}{Left}{Ctrl UP} 49 | return 50 | } 51 | #IfWinActive -------------------------------------------------------------------------------- /window_management/kde_style_window_dragging.ahk: -------------------------------------------------------------------------------- 1 | ;################################################################# 2 | ;##### CfK -- Easy Window Dragging 3 | ;# = Super, ^ = Ctrl, ! = Alt, + = Shift, ^>! = AltGr 4 | #NoEnv 5 | SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. 6 | DetectHiddenWindows, On 7 | SetTitleMatchMode, RegEx 8 | SetWinDelay, 2 9 | CoordMode, Mouse 10 | RETURN ; end of auto-execute section 11 | 12 | moveMouseCursorToActiveWindow() 13 | { 14 | WinGetTitle, Title2, A 15 | 16 | ; Activate top window 17 | WinActivate, %Title2% 18 | 19 | ;WinGetPos, xtemp, ytemp,,, A 20 | 21 | ; 10 is speed, 16, 16 is a good place to doubleclick and close window. 22 | MouseMove, 16, 16, 10 23 | } 24 | 25 | moveActiveWindowToMouseCursor() 26 | { 27 | WinGet, active_id, ID, A 28 | WinActivate, ahk_id %active_id% 29 | WinRestore, ahk_id %active_id% ; This un-maximizes fullscreen things to prevent UI bug. 30 | 31 | ; Mouse screen coords = mouse relative + win coords therefore.. 32 | WinGetPos, win_x, win_y, win_width, win_height, ahk_id %active_id% ; get active windows location 33 | MouseGetPos, mouse_x, mouse_y ; get mouse location 34 | 35 | ;; Calculate actual position 36 | move_x := mouse_x - win_width / 2 37 | move_y := mouse_y - 10 38 | 39 | WinMove, ahk_id %active_id%, , %move_x%, %move_y% ; move window to mouse 40 | } 41 | 42 | ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 43 | ;+++++ Easy Window Dragging -- KDE style (requires XP/2k/NT) -- by Jonny (modified without double alt and winkey instead of alt) 44 | ;http://www.autohotkey.com/docs/scripts/EasyWindowDrag_%28KDE%29.htm 45 | 46 | #LButton:: 47 | ; Get the initial mouse position and window id, and 48 | ; abort if the window is maximized. 49 | MouseGetPos,KDE_X1,KDE_Y1,KDE_id 50 | WinGet,KDE_Win,MinMax,ahk_id %KDE_id% 51 | If KDE_Win 52 | return 53 | ; Get the initial window position. 54 | WinGetPos,KDE_WinX1,KDE_WinY1,,,ahk_id %KDE_id% 55 | Loop 56 | { 57 | GetKeyState,KDE_Button,LButton,P ; Break if button has been released. 58 | If KDE_Button = U 59 | break 60 | MouseGetPos,KDE_X2,KDE_Y2 ; Get the current mouse position. 61 | KDE_X2 -= KDE_X1 ; Obtain an offset from the initial mouse position. 62 | KDE_Y2 -= KDE_Y1 63 | KDE_WinX2 := (KDE_WinX1 + KDE_X2) ; Apply this offset to the window position. 64 | KDE_WinY2 := (KDE_WinY1 + KDE_Y2) 65 | WinMove,ahk_id %KDE_id%,,%KDE_WinX2%,%KDE_WinY2% ; Move the window to the new position. 66 | } 67 | return 68 | 69 | #RButton:: 70 | ; Get the initial mouse position and window id, and 71 | ; abort if the window is maximized. 72 | MouseGetPos,KDE_X1,KDE_Y1,KDE_id 73 | WinGet,KDE_Win,MinMax,ahk_id %KDE_id% 74 | If KDE_Win 75 | return 76 | ; Get the initial window position and size. 77 | WinGetPos,KDE_WinX1,KDE_WinY1,KDE_WinW,KDE_WinH,ahk_id %KDE_id% 78 | ; Define the window region the mouse is currently in. 79 | ; The four regions are Up and Left, Up and Right, Down and Left, Down and Right. 80 | If (KDE_X1 < KDE_WinX1 + KDE_WinW / 2) 81 | KDE_WinLeft := 1 82 | Else 83 | KDE_WinLeft := -1 84 | If (KDE_Y1 < KDE_WinY1 + KDE_WinH / 2) 85 | KDE_WinUp := 1 86 | Else 87 | KDE_WinUp := -1 88 | Loop 89 | { 90 | GetKeyState,KDE_Button,RButton,P ; Break if button has been released. 91 | If KDE_Button = U 92 | break 93 | MouseGetPos,KDE_X2,KDE_Y2 ; Get the current mouse position. 94 | ; Get the current window position and size. 95 | WinGetPos,KDE_WinX1,KDE_WinY1,KDE_WinW,KDE_WinH,ahk_id %KDE_id% 96 | KDE_X2 -= KDE_X1 ; Obtain an offset from the initial mouse position. 97 | KDE_Y2 -= KDE_Y1 98 | ; Then, act according to the defined region. 99 | WinMove,ahk_id %KDE_id%,, KDE_WinX1 + (KDE_WinLeft+1)/2*KDE_X2 ; X of resized window 100 | , KDE_WinY1 + (KDE_WinUp+1)/2*KDE_Y2 ; Y of resized window 101 | , KDE_WinW - KDE_WinLeft *KDE_X2 ; W of resized window 102 | , KDE_WinH - KDE_WinUp *KDE_Y2 ; H of resized window 103 | KDE_X1 := (KDE_X2 + KDE_X1) ; Reset the initial position for the next iteration. 104 | KDE_Y1 := (KDE_Y2 + KDE_Y1) 105 | } 106 | return 107 | 108 | #MButton:: 109 | moveActiveWindowToMouseCursor() 110 | return -------------------------------------------------------------------------------- /window_management/smart_window_arrangement.ahk: -------------------------------------------------------------------------------- 1 | ;################################################################# 2 | ;##### CfK -- smart window arrangement 3 | ;# = Super, ^ = Ctrl, ! = Alt, + = Shift, ^>! = AltGr 4 | 5 | ;----- Alt+Super+Left: Move/Toggle 1/3 oder 2/3 left 6 | !#Left:: 7 | WinGetPos, current_x, current_y, current_width, current_height, A 8 | activeMonitorWorkArea(workarea_left, workarea_top, workarea_width, workarea_height) 9 | 10 | new_width := Floor(workarea_width / 3) 11 | new_height := workarea_height 12 | new_x := workarea_left 13 | new_y := workarea_top 14 | if (new_x == current_x and current_width < workarea_width / 2 and new_y == current_y and new_height == current_height) 15 | { 16 | new_width := new_width * 2 17 | } 18 | WinMove, A,, new_x, new_y, new_width, new_height 19 | return 20 | 21 | ;----- Alt+Super+Right: Move/Toggle 1/3 oder 2/3 right 22 | !#Right:: 23 | WinGetPos, current_x, current_y, current_width, current_height, A 24 | activeMonitorWorkArea(workarea_left, workarea_top, workarea_width, workarea_height) 25 | 26 | new_width := Floor(workarea_width / 3) 27 | new_height := workarea_height 28 | new_x := workarea_left + new_width * 2 29 | new_y := workarea_top 30 | if (new_x == current_x and current_width < workarea_width / 2 and new_y == current_y and new_height == current_height) 31 | { 32 | new_x := new_x - new_width 33 | new_width := new_width * 2 34 | } 35 | WinMove, A,, new_x, new_y, new_width, new_height 36 | return 37 | 38 | ;----- Alt+Super+Up: Move/Toggle 1/3 oder 2/3 up 39 | !#Up:: 40 | WinGetPos, current_x, current_y, current_width, current_height, A 41 | activeMonitorWorkArea(workarea_left, workarea_top, workarea_width, workarea_height) 42 | 43 | new_width := workarea_width 44 | new_height := Floor(workarea_height / 3) 45 | new_x := workarea_left 46 | new_y := workarea_top 47 | 48 | if (new_x == current_x and new_width == current_width and new_y == current_y and current_height < workarea_height / 2) 49 | { 50 | new_height := new_height * 2 51 | } 52 | WinMove, A,, new_x, new_y, new_width, new_height 53 | return 54 | 55 | ;----- Alt+Super+Down: Move/Toggle 1/3 oder 2/3 down 56 | !#Down:: 57 | WinGetPos, current_x, current_y, current_width, current_height, A 58 | activeMonitorWorkArea(workarea_left, workarea_top, workarea_width, workarea_height) 59 | 60 | new_width := workarea_width 61 | new_height := Floor(workarea_height / 3) 62 | new_x := workarea_left 63 | new_y := workarea_top + new_height * 2 64 | if (new_x == current_x and new_width == current_width and new_y == current_y and current_height < workarea_height / 2) 65 | { 66 | new_y := new_y - new_height 67 | new_height := new_height * 2 68 | } 69 | WinMove, A,, new_x, new_y, new_width, new_height 70 | return 71 | 72 | ;----- Alt+Super+PageUp: Move window 1/2 top 73 | !#PgUp:: 74 | WinGetPos, current_x, current_y, current_width, current_height, A 75 | activeMonitorWorkArea(workarea_left, workarea_top, workarea_width, workarea_height) 76 | 77 | new_width := workarea_width 78 | new_height := Floor(workarea_height / 2) 79 | new_x := workarea_left 80 | new_y := workarea_top 81 | WinMove, A,, new_x, new_y, new_width, new_height 82 | return 83 | 84 | ;----- Alt+Super+PageDown: Move window 1/2 bottom 85 | !#PgDn:: 86 | WinGetPos, current_x, current_y, current_width, current_height, A 87 | activeMonitorWorkArea(workarea_left, workarea_top, workarea_width, workarea_height) 88 | 89 | new_width := workarea_width 90 | new_height := Floor(workarea_height / 2) 91 | new_x := workarea_left 92 | new_y := workarea_top + new_height 93 | WinMove, A,, new_x, new_y, new_width, new_height 94 | return 95 | 96 | ;----- Alt+Super+Ins: Move window 1/2 left-top 97 | !#Ins:: 98 | WinGetPos, current_x, current_y, current_width, current_height, A 99 | activeMonitorWorkArea(workarea_left, workarea_top, workarea_width, workarea_height) 100 | 101 | new_width := Floor(workarea_width / 2) 102 | new_height := Floor(workarea_height / 2) 103 | new_x := workarea_left 104 | new_y := workarea_top 105 | WinMove, A,, new_x, new_y, new_width, new_height 106 | return 107 | 108 | ;----- Alt+Super+Del: Move window 1/2 left-bottom 109 | !#Del:: 110 | WinGetPos, current_x, current_y, current_width, current_height, A 111 | activeMonitorWorkArea(workarea_left, workarea_top, workarea_width, workarea_height) 112 | 113 | new_width := Floor(workarea_width / 2) 114 | new_height := Floor(workarea_height / 2) 115 | new_x := workarea_left 116 | new_y := workarea_top + new_height 117 | WinMove, A,, new_x, new_y, new_width, new_height 118 | return 119 | 120 | ;----- Alt+Super+Home: Move window 1/2 right-top 121 | !#Home:: 122 | WinGetPos, current_x, current_y, current_width, current_height, A 123 | activeMonitorWorkArea(workarea_left, workarea_top, workarea_width, workarea_height) 124 | 125 | new_width := Floor(workarea_width / 2) 126 | new_height := Floor(workarea_height / 2) 127 | new_x := workarea_left + new_width 128 | new_y := workarea_top 129 | WinMove, A,, new_x, new_y, new_width, new_height 130 | return 131 | 132 | ;----- Alt+Super+End: Move window 1/2 right-bottom 133 | !#End:: 134 | WinGetPos, current_x, current_y, current_width, current_height, A 135 | activeMonitorWorkArea(workarea_left, workarea_top, workarea_width, workarea_height) 136 | 137 | new_width := Floor(workarea_width / 2) 138 | new_height := Floor(workarea_height / 2) 139 | new_x := workarea_left + new_width 140 | new_y := workarea_top + new_height 141 | WinMove, A,, new_x, new_y, new_width, new_height 142 | return 143 | 144 | ;----- Alt+Super+Numpad7: Move window 1/3 left-top 145 | !#Numpad7:: 146 | WinGetPos, current_x, current_y, current_width, current_height, A 147 | activeMonitorWorkArea(workarea_left, workarea_top, workarea_width, workarea_height) 148 | 149 | new_width := Floor(workarea_width / 3) 150 | new_height := Floor(workarea_height / 3) 151 | new_x := workarea_left 152 | new_y := workarea_top 153 | WinMove, A,, new_x, new_y, new_width, new_height 154 | return 155 | 156 | ;----- Alt+Super+Numpad4: Move window 1/3 left-middle 157 | !#Numpad4:: 158 | WinGetPos, current_x, current_y, current_width, current_height, A 159 | activeMonitorWorkArea(workarea_left, workarea_top, workarea_width, workarea_height) 160 | 161 | new_width := Floor(workarea_width / 3) 162 | new_height := Floor(workarea_height / 3) 163 | new_x := workarea_left 164 | new_y := workarea_top + new_height 165 | WinMove, A,, new_x, new_y, new_width, new_height 166 | return 167 | 168 | ;----- Alt+Super+Numpad1: Move window 1/3 left-bottom 169 | !#Numpad1:: 170 | WinGetPos, current_x, current_y, current_width, current_height, A 171 | activeMonitorWorkArea(workarea_left, workarea_top, workarea_width, workarea_height) 172 | 173 | new_width := Floor(workarea_width / 3) 174 | new_height := Floor(workarea_height / 3) 175 | new_x := workarea_left 176 | new_y := workarea_top + new_height * 2 177 | WinMove, A,, new_x, new_y, new_width, new_height 178 | return 179 | 180 | ;----- Alt+Super+Numpad8: Move window 1/3 center-top 181 | !#Numpad8:: 182 | WinGetPos, current_x, current_y, current_width, current_height, A 183 | activeMonitorWorkArea(workarea_left, workarea_top, workarea_width, workarea_height) 184 | 185 | new_width := Floor(workarea_width / 3) 186 | new_height := Floor(workarea_height / 3) 187 | new_x := workarea_left + new_width 188 | new_y := workarea_top 189 | WinMove, A,, new_x, new_y, new_width, new_height 190 | return 191 | 192 | ;----- Alt+Super+Numpad5: Move window 1/3 center-middle 193 | !#Numpad5:: 194 | WinGetPos, current_x, current_y, current_width, current_height, A 195 | activeMonitorWorkArea(workarea_left, workarea_top, workarea_width, workarea_height) 196 | 197 | new_width := Floor(workarea_width / 3) 198 | new_height := Floor(workarea_height / 3) 199 | new_x := workarea_left + new_width 200 | new_y := workarea_top + new_height 201 | WinMove, A,, new_x, new_y, new_width, new_height 202 | return 203 | 204 | ;----- Alt+Super+Numpad2: Move window 1/3 center-bottom 205 | !#Numpad2:: 206 | WinGetPos, current_x, current_y, current_width, current_height, A 207 | activeMonitorWorkArea(workarea_left, workarea_top, workarea_width, workarea_height) 208 | 209 | new_width := Floor(workarea_width / 3) 210 | new_height := Floor(workarea_height / 3) 211 | new_x := workarea_left + new_width 212 | new_y := workarea_top + new_height * 2 213 | WinMove, A,, new_x, new_y, new_width, new_height 214 | return 215 | 216 | ;----- Alt+Super+Numpad9: Move window 1/3 right-top 217 | !#Numpad9:: 218 | WinGetPos, current_x, current_y, current_width, current_height, A 219 | activeMonitorWorkArea(workarea_left, workarea_top, workarea_width, workarea_height) 220 | 221 | new_width := Floor(workarea_width / 3) 222 | new_height := Floor(workarea_height / 3) 223 | new_x := workarea_left + new_width * 2 224 | new_y := workarea_top 225 | WinMove, A,, new_x, new_y, new_width, new_height 226 | return 227 | 228 | ;----- Alt+Super+Numpad6: Move window 1/3 right-middle 229 | !#Numpad6:: 230 | WinGetPos, current_x, current_y, current_width, current_height, A 231 | activeMonitorWorkArea(workarea_left, workarea_top, workarea_width, workarea_height) 232 | 233 | new_width := Floor(workarea_width / 3) 234 | new_height := Floor(workarea_height / 3) 235 | new_x := workarea_left + new_width * 2 236 | new_y := workarea_top + new_height 237 | WinMove, A,, new_x, new_y, new_width, new_height 238 | return 239 | 240 | ;----- Alt+Super+Numpad3: Move window 1/3 right-bottom 241 | !#Numpad3:: 242 | WinGetPos, current_x, current_y, current_width, current_height, A 243 | activeMonitorWorkArea(workarea_left, workarea_top, workarea_width, workarea_height) 244 | 245 | new_width := Floor(workarea_width / 3) 246 | new_height := Floor(workarea_height / 3) 247 | new_x := workarea_left + new_width * 2 248 | new_y := workarea_top + new_height * 2 249 | WinMove, A,, new_x, new_y, new_width, new_height 250 | return 251 | 252 | ;----- Alt+Super+NumpadAdd: Move window to the 1/3 horizontal center 253 | !#NumpadAdd:: 254 | WinGetPos, current_x, current_y, current_width, current_height, A 255 | activeMonitorWorkArea(workarea_left, workarea_top, workarea_width, workarea_height) 256 | 257 | new_width := Floor(workarea_width / 3) 258 | new_height := workarea_height 259 | new_x := workarea_left + new_width 260 | new_y := workarea_top 261 | WinMove, A,, new_x, new_y, new_width, new_height 262 | return 263 | 264 | ;----- Alt+Super+Numpad0: Move window to the 1/3 vertical center 265 | !#Numpad0:: 266 | WinGetPos, current_x, current_y, current_width, current_height, A 267 | activeMonitorWorkArea(workarea_left, workarea_top, workarea_width, workarea_height) 268 | 269 | new_width := workarea_width 270 | new_height := Floor(workarea_height / 3) 271 | new_x := workarea_left 272 | new_y := workarea_top + new_height 273 | WinMove, A,, new_x, new_y, new_width, new_height 274 | return --------------------------------------------------------------------------------