Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Requires AutoHotkey v2.0
- SetTitleMatchMode 2
- global Tab1 := "Messenger"
- global Tab2 := "YouTube"
- ; Check to see if chrome is open r.
- if !WinExist("Google Chrome"){
- Run "chrome.exe"
- Sleep 200
- Winmove 1272, -8, 2575, 1408, "ahk_exe chrome.exe"
- Sleep 1000
- Goto StartSearch
- }
- StartSearch:
- if WinExist("Google Chrome"){
- WinActivate("ahk_exe chrome.exe")
- WinWaitActive("ahk_exe chrome.exe", , 2)
- ;Search for Messenger
- SearchMessenger:
- SendInput "^+A"
- Sleep 300
- SendInput Tab1 "{Enter}"
- Sleep 500
- ;Check Messenger is active and if so store ID in a global variable
- if WinExist(Tab1){
- WinActivate(Tab1)
- global ActiveID1 := WinGetID("A") ;Store Messenger ID as Variable
- } else if !WinExist(Tab1){
- run "chrome.exe https://www.facebook.com/messages/t/100011211997085 --new-window "
- Sleep 200
- Goto SearchMessenger ;rechecks to see if messenger is active
- }
- ;Search for YouTube
- SearchYouTube:
- SendInput "^+A"
- Sleep 300
- SendInput Tab2 "{Enter}"
- Sleep 500
- ;Check YouTube is active and if so store ID in a global variable
- if WinExist(Tab2){
- WinActivate(Tab2)
- global ActiveID2 := WinGetID("A") ;Store YouTube ID as Variable
- } else if !WinExist(Tab2){
- run "chrome.exe https://www.youtube.com --new-window "
- Sleep 200
- Goto SearchYouTube ;rechecks to see if YouTube is active
- }
- }
- ; MsgBox "Messenger ID is " ActiveID1 " YouTube ID is " ActiveID2 From here both youtube and messenger ID is set
- ; Activate and move Messenger window via it's ID
- WinActivate ("ahk_id" ActiveID1)
- WinWaitActive ("ahk_id" ActiveID1)
- WinRestore ActiveID1
- WinMove 3922, 140, 1117, 899, ActiveID1 ; move messenger window
- WinMaximize ActiveID1
- ; Activate and Move YouTube window via it's ID
- WinActivate "ahk_id" ActiveID2
- WinRestore ActiveID2
- WinMove 1272, -8, 1117, 899, ActiveID2 ; move youtube window
- WinMaximize ActiveID2
Advertisement
Comments
-
- function main(workbook: ExcelScript.Workbook) {
- let worksheet = workbook.getWorksheet("in");
- let wsRange = worksheet.getUsedRange();
- let usedRange = worksheet.getUsedRange();
- let columnERange = usedRange.getColumn(4);
- let columnE = worksheet.getRange("E:E");
- let closer = wsRange.getValues();
- columnE.setNumberFormat("General");
- let columnD = worksheet.getRange("D:D").getUsedRange();
- let values = columnD.getValues();
- let reGex: RegExp = /^\d{10}$/;
- let lastRow = columnD.getRowCount();
- let colD = worksheet.getRange("D2:D" + lastRow);
- let colE = worksheet.getRange("E2:E" + lastRow);
- let colDvalue = colD.getValues();
- let rowCount = usedRange.getRowCount();
- let lastRow2 = colD.getLastRow();
- console.log(lastRow)
- for (let i = 0; i < rowCount; i++) {
- let offsetCell = worksheet.getCell(i, 3);
- let cellAddress = offsetCell.getAddress();
- console.log(colDvalue[i][0])
- colE.setFormula("=LEFT(" + cellAddress + ",3)");
- }
- }
-
- #Requires AutoHotkey v2.0
- #SingleInstance Force
- >::
- {
- If WinActive("ahk_class Qt51514QWindow")
- {
- Send "{LShift down}{.}{LShift up}"
- }
- Else
- {
- Send "{LWin down}{LShift down}{V}{LWin up}{LShift up}{Enter}"
- }
- }
-
- #Requires AutoHotkey v2.0
- #SingleInstance Force
- MyGui := Gui(, "AppPicker")
- MyGui.Opt("+AlwaysOnTop")
- MyGui.Add("Button", "w50", "Edge").OnEvent("Click", Options) ;Edge
- MyGui.Add("Button", "w50", "Outlook").OnEvent("Click", Options) ;Outlook
- MyGui.Add("Button", "w50", "Teams").OnEvent("Click", Options) ;Teams
- MyGui.Add("Button", "w50", "Code").OnEvent("Click", Options) ;Code
- MyGui.Add("Button", "w50", "Folders").OnEvent("Click", Options) ;Folders
- Options(thisbtn, *)
- {
- MyGui.Hide()
- Send thisbtn.text
- Send "{Tab}"
- }
- #HotIf WinActive("ahk_exe code.exe")
- ^Space::
- Position(*)
- {
- MouseGetPos &xpos, &ypos
- WinGetPos &X, &Y, &W, &H, "A"
- MyGui.Show("x" W / 2 "y" H / 2)
- }
- #HotIf
- #HotIf WinExist("AppPicker")
- Esc::
- {
- WinActivate("AppPicker")
- MyGui.Hide()
- }
- #HotIf
- #Down::
- {
- WinMinimize "A"
- }
-
- g_MaxWindows := 50
- g_Hotkey := "+``"
- g_UnHotkey := "^``"
- g_StandardMenu := false
- A_HotkeyModifierTimeout := 100
- SetWinDelay 10
- SetKeyDelay 0
- #SingleInstance Force
- Persistent
- g_WindowIDs := []
- g_WindowTitles := []
- Hotkey g_Hotkey, Minimize
- Hotkey g_UnHotkey, UnMinimize
- OnExit RestoreAllThenExit
- if g_StandardMenu = true
- A_TrayMenu.Add
- else
- {
- A_TrayMenu.Delete
- A_TrayMenu.Add "E&xit and Unhide All", RestoreAllThenExit
- }
- A_TrayMenu.Add "&Unhide All Hidden Windows", RestoreAll
- A_TrayMenu.Add
- g_MaxLength := 260
- Minimize(*)
- {
- if g_WindowIDs.Length >= g_MaxWindows
- {
- MsgBox "No more than " g_MaxWindows " may be hidden simultaneously."
- return
- }
- if !WinWait("A", , 2)
- return
- ActiveID := WinGetID()
- ActiveTitle := WinGetTitle()
- ActiveClass := WinGetClass()
- if ActiveClass ~= "Shell_TrayWnd|Progman"
- {
- MsgBox "The desktop and taskbar cannot be hidden."
- return
- }
- Send "!{esc}"
- WinHide
- if ActiveTitle = ""
- ActiveTitle := "ahk_class " ActiveClass
- ActiveTitle := SubStr(ActiveTitle, 1, g_MaxLength)
- for WindowTitle in g_WindowTitles
- {
- if WindowTitle = ActiveTitle
- {
- ActiveIDShort := Format("{:X}", ActiveID)
- ActiveIDShortLength := StrLen(ActiveIDShort)
- ActiveTitleLength := StrLen(ActiveTitle)
- ActiveTitleLength += ActiveIDShortLength
- ActiveTitleLength += 1
- if ActiveTitleLength > g_MaxLength
- {
- TrimCount := ActiveTitleLength
- TrimCount -= g_MaxLength
- ActiveTitle := SubStr(ActiveTitle, 1, -TrimCount)
- }
- ActiveTitle .= " " ActiveIDShort
- break
- }
- }
- AlreadyExists := false
- for WindowID in g_WindowIDs
- {
- if WindowID = ActiveID
- {
- AlreadyExists := true
- break
- }
- }
- if AlreadyExists = false
- {
- A_TrayMenu.Add ActiveTitle, RestoreFromTrayMenu
- g_WindowIDs.Push(ActiveID)
- g_WindowTitles.Push(ActiveTitle)
- }
- }
- RestoreFromTrayMenu(ThisMenuItem, *)
- {
- A_TrayMenu.Delete ThisMenuItem
- for WindowTitle in g_WindowTitles
- {
- if WindowTitle = ThisMenuItem
- {
- IDToRestore := g_WindowIDs[A_Index]
- WinShow IDToRestore
- WinActivate IDToRestore
- g_WindowIDs.RemoveAt(A_Index)
- g_WindowTitles.RemoveAt(A_Index)
- break
- }
- }
- }
- UnMinimize(*)
- {
- if g_WindowIDs.Length > 0
- {
- IDToRestore := g_WindowIDs.Pop()
- WinShow IDToRestore
- WinActivate IDToRestore
- MenuToRemove := g_WindowTitles.Pop()
- A_TrayMenu.Delete MenuToRemove
- }
- }
- RestoreAllThenExit(*)
- {
- RestoreAll()
- ExitApp
- }
- RestoreAll(*)
- {
- for WindowID in g_WindowIDs
- {
- IDToRestore := WindowID
- WinShow IDToRestore
- WinActivate IDToRestore
- MenuToRemove := g_WindowTitles[A_Index]
- A_TrayMenu.Delete MenuToRemove
- }
- global g_WindowIDs := []
- global g_WindowTitles := []
- }
- #Requires AutoHotkey v2.0
- #SingleInstance Force
- #NoTrayIcon
- MINIMIZED := []
- STATE_MINIMIZED := -1
- return
- ; Win + Alt + Down = Minimize Window
- #!Down::
- {
- global
- for index, winid in MINIMIZED
- {
- if (!WinExist(winid) || WinGetMinMax(winid) != STATE_MINIMIZED)
- {
- MINIMIZED.RemoveAt(index)
- }
- }
- if (hwnd := WinExist("A"))
- {
- winid := "ahk_id " hwnd
- if (WinGetMinMax(winid) != STATE_MINIMIZED)
- {
- PostMessage 0x0112, 0xF020, 0, , winid ; 0x0112 = WM_SYSCOMMAND, 0xF020 = SC_MINIMIZE
- MINIMIZED.Push(winid)
- }
- }
- }
- ; Win + Alt + Up = Restore Window
- #!Up::
- {
- global
- for index, winid in MINIMIZED
- {
- if (!WinExist(winid) || WinGetMinMax(winid) != STATE_MINIMIZED)
- {
- MINIMIZED.RemoveAt(index)
- }
- }
- if (MINIMIZED.Length)
- {
- winid := MINIMIZED.Pop()
- PostMessage 0x0112, 0xF120, 0, , winid ; 0x0112 = WM_SYSCOMMAND, 0xF120 = SC_RESTORE
- }
- }
-
- #Requires AutoHotkey v2.0
- #SingleInstance Force
- MyGui := Gui(, "AppPicker")
- MyGui.Opt("+AlwaysOnTop")
- MyGui.Add("Button", "w50", "Edge").OnEvent("Click", OpenEdge) ;Edge
- MyGui.Add("Button", "w50", "Outlook").OnEvent("Click", OpenOutlook) ;Outlook
- MyGui.Add("Button", "w50", "Teams").OnEvent("Click", OpenTeams) ;Teams
- MyGui.Add("Button", "w50", "Explorer").OnEvent("Click", OpenExplorer) ;Code
- MyGui.Add("Button", "w50", "Code").OnEvent("Click", OpenCode) ;Folders
- Numlock::
- {
- MyGui.Show()
- }
- #HotIf WinActive("AppPicker")
- a::
- OpenEdge(thisbtn, *)
- {
- MyGui.Hide()
- WinActivate("ahk_exe msedge.exe")
- }
- #HotIf
- #HotIf WinActive("AppPicker")
- s::
- OpenOutlook(thisbtn, *)
- {
- MyGui.Hide()
- Send "#{2}"
- }
- #HotIf
- #HotIf WinActive("AppPicker")
- d::
- OpenTeams(thisbtn, *)
- {
- MyGui.Hide()
- Send "#{3}"
- }
- #HotIf
- #HotIf WinActive("AppPicker")
- f::
- OpenExplorer(thisbtn, *)
- {
- MyGui.Hide()
- Send "#{AppsKey}"
- }
- #HotIf
- #HotIf WinActive("AppPicker")
- g::
- OpenCode(thisbtn, *)
- {
- MyGui.Hide()
- WinActivate("ahk_exe code.exe")
- }
- #HotIf
- Options(thisbtn, *)
- {
- MyGui.Hide()
- Send thisbtn.text
- Send "{Tab}"
- }
- ^Space::
- Position(*)
- {
- MouseGetPos &xpos, &ypos
- WinGetPos &X, &Y, &W, &H, "A"
- MyGui.Show("x" W / 2 "y" H / 2)
- }
- #HotIf WinExist("AppPicker")
- Esc::
- {
- WinActivate("AppPicker")
- MyGui.Hide()
- }
- #HotIf
- #Down::
- {
- WinMinimize "A"
- }
- ; ^F13::
- ; {
- ; loop
- ; {
- ; MouseMove 0, 1, 5000, "R"
- ; Sleep 5000
- ; MouseMove 0, -1, 5000, "R"
- ; }
- ; }
- ; Return
- ; F13::
- ; {
- ; Send "!{Space}"
- ; }
- ; F14::
- ; {
- ; Send "{Menu}"
- ; }
- ; ^+o::
- ; ^+e::
- ; editor_open_folder(hk)
- ; {
- ; path := WinGetTitle("A")
- ; if RegExMatch(path, "\*?\K(.*)\\[^\\]+(?= [-*] )", &path)
- ; if (FileExist(path[0]) && hk = "^+e")
- ; Run Format('explorer.exe /select,"{1}"', path[0])
- ; else
- ; Run Format('explorer.exe "{1}"', path[1])
- ; }
- ; #HotIf WinActive("ahk_exe code.exe")
- ; ^F14::
- ; Position(*)
- ; {
- ; MouseGetPos &xpos, &ypos
- ; WinGetPos &X, &Y, &W, &H, "A"
- ; MyGui.Show("x" W / 2 "y" H / 2)
- ; MsgBox
- ; (
- ; "The active window:
- ; x: `t" X "
- ; y: `t" Y "
- ; -
- ; w: `t" W "
- ; h: `t" H "
- ; -
- ; The cursor is at X" xpos " Y" ypos
- ; )
- ; }
- ; #HotIf
- ; #HotIf WinActive("ahk_exe Fusion360.exe")
- ; RButton::
- ; {
- ; Send "{Shift Down}"
- ; Send "{MButton Down}"
- ; while GetKeyState("RButton", "P")
- ; {
- ; Sleep 10
- ; }
- ; Send "{MButton Up}"
- ; Send "{Shift Up}"
- ; Return
- ; }
- ; #HotIf
-
- #Requires AutoHotkey v2.0
- #SingleInstance Force
- MyGui := Gui(, "AppPicker")
- MyGui.Opt("+AlwaysOnTop")
- MyGui.Add("Button", "w50", "Edge").OnEvent("Click", OpenEdge) ;Edge
- MyGui.Add("Button", "w50", "Outlook").OnEvent("Click", OpenOutlook) ;Outlook
- MyGui.Add("Button", "w50", "Teams").OnEvent("Click", OpenTeams) ;Teams
- MyGui.Add("Button", "w50", "Explorer").OnEvent("Click", OpenExplorer) ;Code
- MyGui.Add("Button", "w50", "Code").OnEvent("Click", OpenCode) ;Folders
- MyGui.Add("Button", "w50", "Tableau").OnEvent("Click", OpenTableau) ;Tableau
- MyGui.Add("Button", "w50", "Google").OnEvent("Click", OpenGoogle) ;Google
- Numlock::
- {
- MyGui.Show()
- }
- #HotIf WinActive("AppPicker")
- a::
- OpenEdge(thisbtn, *)
- {
- MyGui.Hide()
- WinActivate("ahk_exe msedge.exe", , "Microsoft Lists - Lists")
- }
- #HotIf
- #HotIf WinActive("AppPicker")
- s::
- OpenOutlook(thisbtn, *)
- {
- MyGui.Hide()
- WinActivate("ahk_exe Outlook.exe")
- }
- #HotIf
- #HotIf WinActive("AppPicker")
- d::
- OpenTeams(thisbtn, *)
- {
- MyGui.Hide()
- WinActivate("ahk_exe Teams.exe")
- }
- #HotIf
- #HotIf WinActive("AppPicker")
- f::
- OpenExplorer(thisbtn, *)
- {
- MyGui.Hide()
- Run("C:\Users\jduphold\QuickLinks")
- }
- #HotIf
- #HotIf WinActive("AppPicker")
- v::
- OpenCode(thisbtn, *)
- {
- MyGui.Hide()
- WinActivate("ahk_exe code.exe")
- }
- #HotIf
- #HotIf WinActive("AppPicker")
- ^g::
- OpenGoogle(thisbtn, *)
- {
- MyGui.Hide()
- WinActivate("ahk_exe msedge.exe")
- Send "https://www.google.com"
- }
- #HotIf
- #HotIf WinActive("AppPicker")
- t::
- OpenTableau(thisbtn, *)
- {
- MyGui.Hide()
- WinActivate("ahk_exe tableau.exe")
- }
- #HotIf
- Options(thisbtn, *)
- {
- MyGui.Hide()
- Send thisbtn.text
- Send "{Tab}"
- }
- ^Space::
- Position(*)
- {
- MouseGetPos &xpos, &ypos
- WinGetPos &X, &Y, &W, &H, "A"
- MyGui.Show("x" W / 2 "y" H / 2)
- }
- #HotIf WinExist("AppPicker")
- Esc::
- {
- WinActivate("AppPicker")
- MyGui.Hide()
- }
- #HotIf
- #Down::
- {
- WinMinimize "A"
- }
- #HotIf WinActive("AppPicker")
- +S::
- {
- win := "Sound ahk_class #32770 ahk_exe rundll32.exe"
- if !WinExist(win)
- Run A_WinDir . "\System32\mmsys.cpl"
- else if !WinActive(win)
- WinActivate
- else
- WinClose
- }
- #HotIf
- #HotIf WinActive("AppPicker")
- g::
- OpenGoogleIt(thisbtn, *)
- {
- MyGui.Hide()
- Browser := '"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe"'
- win := 'ahk_class Chrome_WidgetWin_1 ahk_exe MsEdge.exe'
- ClipSaved := ClipboardAll()
- if !ClipWait(1)
- {
- A_Clipboard := ClipSaved
- }
- string := Trim(A_Clipboard, " `t`r`n")
- reg := RegExMatch(string, "i)^\S+\.(com|de|gov|io|jp|net|org|to|tv|uk)|(\/.*)$") ? "" : "https://www.google.com/search?q="
- ; Attach the prefix and wrap text in quotes.
- ; Characters between quotes are parsed as a single argument for most Windows apps.
- ; AHK's quoting rules are ... interesting.
- ; '"' is a string containing a quote.
- url := '"' . reg . string . '"'
- ; Open Browser
- Run(Browser . ' --new-tab ' . url)
- A_Clipboard := ClipSaved
- }
- #HotIf
- !f::
- {
- runThis := '"C:\Program Files\Microsoft Office\root\Office16\OUTLOOK.EXE"'
- win := 'ahk_class Notepad++ ahk_exe notepad++.exe'
- if !WinExist(win)
- {
- Run(runThis, , 'Max', &winNew)
- if WinWait('ahk_pid ' . winNew, , 3)
- WinActivate('ahk_pid ' . winNew)
- }
- else if !WinActive(win)
- WinActivate(win)
- else
- WinClose(win)
- }
- F13:: maximize_all()
- maximize_all() {
- ; Map of exe names (Mapping is faster than iterating through an array or parsing a string)
- processes := Map('msedge.exe', 1)
- processes.Default := 0 ; Set a default when key not found
- for _, id in WinGetList() { ; Loop through each window
- id := 'ahk_id ' id ; Create a window id (Window handles are unique)
- if (WinGetMinMax(id) = 0 ; If the window is a normal/restored state
- && processes[WinGetProcessName(id)]) ; AND the process name is a found in the processes map
- WinMaximize(id) ; Maximize that window
- }
- }
- Friday: In @ 5:15pm
- ; #HotIf WinActive("AppPicker")
- ; ^c::
- ; {
- ; WinWait "ahk_class rctrl_renwnd32"
- ; If WinExist("Inbox - [email protected] - Outlook")
- ; {
- ; ; Activate Outlook
- ; WinActivate("Inbox - [email protected] - Outlook")
- ; ; Switch to Calendar view
- ; Send "^2"
- ; Send "!vr"
- ; }
- ; }
- ; #HotIf
- ; ^F13::
- ; {
- ; loop
- ; {
- ; MouseMove 0, 1, 5000, "R"
- ; Sleep 5000
- ; MouseMove 0, -1, 5000, "R"
- ; }
- ; }
- ; Return
- ; F13::
- ; {
- ; Send "!{Space}"
- ; }
- ; F14::
- ; {
- ; Send "{Menu}"
- ; }
- ; ^+o::
- ; ^+e::
- ; editor_open_folder(hk)
- ; {
- ; path := WinGetTitle("A")
- ; if RegExMatch(path, "\*?\K(.*)\\[^\\]+(?= [-*] )", &path)
- ; if (FileExist(path[0]) && hk = "^+e")
- ; Run Format('explorer.exe /select,"{1}"', path[0])
- ; else
- ; Run Format('explorer.exe "{1}"', path[1])
- ; }
- ; #HotIf WinActive("ahk_exe code.exe")
- ; ^F14::
- ; Position(*)
- ; {
- ; MouseGetPos &xpos, &ypos
- ; WinGetPos &X, &Y, &W, &H, "A"
- ; MyGui.Show("x" W / 2 "y" H / 2)
- ; MsgBox
- ; (
- ; "The active window:
- ; x: `t" X "
- ; y: `t" Y "
- ; -
- ; w: `t" W "
- ; h: `t" H "
- ; -
- ; The cursor is at X" xpos " Y" ypos
- ; )
- ; }
- ; #HotIf
- ; #HotIf WinActive("ahk_exe Fusion360.exe")
- ; RButton::
- ; {
- ; Send "{Shift Down}"
- ; Send "{MButton Down}"
- ; while GetKeyState("RButton", "P")
- ; {
- ; Sleep 10
- ; }
- ; Send "{MButton Up}"
- ; Send "{Shift Up}"
- ; Return
- ; }
- ; #HotIf
-
- #Requires AutoHotkey v2.0
- #SingleInstance Force
- Persistent
- g_MaxWindows := 25
- g_StandardMenu := false
- g_Hotkey := "^+T"
- g_UnHotkey := "^+!T"
- Hotkey g_Hotkey, Minimize
- Hotkey g_UnHotkey, UnMinimize
- A_HotkeyModifierTimeout := 100
- SetWinDelay 10
- SetKeyDelay 0
- g_WindowIDs := []
- g_WindowTitles := []
- if g_StandardMenu = true
- A_TrayMenu.Add
- else
- {
- A_TrayMenu.Delete
- A_TrayMenu.Add "&Exit and Unhide All", RestoreAllThenExit
- }
- A_TrayMenu.Add "&Unhide All Hidden Windows", RestoreAll
- A_TrayMenu.Add
- g_MaxLength := 260
- Minimize(*)
- {
- if g_WindowIDs.Length >= g_MaxWindows
- {
- MsgBox "No more than " g_MaxWindows " may be hidden simultaneously."
- return
- }
- if !WinWait("A", , 2)
- return
- ActiveID := WinGetID()
- ActiveTitle := WinGetTitle()
- ActiveClass := WinGetClass()
- if ActiveClass ~= "Shell_TrayWnd|Progman"
- {
- MsgBox "The desktop and taskbar cannot be hidden."
- return
- }
- Send "!{esc}"
- WinHide
- if ActiveTitle = ""
- ActiveTitle := "ahk_class " ActiveClass
- ActiveTitle := SubStr(ActiveTitle, 1, g_MaxLength)
- for WindowTitle in g_WindowTitles
- {
- if WindowTitle = ActiveTitle
- {
- ActiveIDShort := Format("{:X}", ActiveID)
- ActiveIDShortLength := StrLen(ActiveIDShort)
- ActiveTitleLength := StrLen(ActiveTitle)
- ActiveTitleLength += ActiveIDShortLength
- ActiveTitleLength += 1
- if ActiveTitleLength > g_MaxLength
- {
- TrimCount := ActiveTitleLength
- TrimCount -= g_MaxLength
- ActiveTitle := SubStr(ActiveTitle, 1, -TrimCount)
- }
- ActiveTitle .= " " ActiveIDShort
- break
- }
- }
- AlreadyExists := false
- for WindowID in g_WindowIDs
- {
- if WindowID = ActiveID
- {
- AlreadyExists := true
- break
- }
- }
- if AlreadyExists = false
- {
- A_TrayMenu.Add ActiveTitle, RestoreFromTrayMenu
- g_WindowIDs.Push(ActiveID)
- g_WindowTitles.Push(ActiveTitle)
- }
- }
- RestoreFromTrayMenu(ThisMenuItem, *)
- {
- A_TrayMenu.Delete ThisMenuItem
- for WindowTitle in g_WindowTitles
- {
- if WindowTitle = ThisMenuItem
- {
- IDToRestore := g_WindowIDs[A_Index]
- WinShow IDToRestore
- WinActivate IDToRestore
- g_WindowIDs.RemoveAt(A_Index)
- g_WindowTitles.RemoveAt(A_Index)
- break
- }
- }
- }
- UnMinimize(*)
- {
- if g_WindowIDs.Length > 0
- {
- IDToRestore := g_WindowIDs.Pop()
- WinShow IDToRestore
- WinActivate IDToRestore
- MenuToRemove := g_WindowTitles.Pop()
- A_TrayMenu.Delete MenuToRemove
- }
- }
- RestoreAllThenExit(*)
- {
- RestoreAll()
- ExitApp
- }
- RestoreAll(*)
- {
- for WindowID in g_WindowIDs
- {
- IDToRestore := WindowID
- WinShow IDToRestore
- WinActivate IDToRestore
- MenuToRemove := g_WindowTitles[A_Index]
- A_TrayMenu.Delete MenuToRemove
- }
- global g_WindowIDs := []
- global g_WindowTitles := []
- }
- MINIMIZED := []
- STATE_MINIMIZED := -1
- ; Minimize Window = Win + Alt + Down
- #!Down::
- {
- global
- for index, winid in MINIMIZED
- {
- if (!WinExist(winid) || WinGetMinMax(winid) != STATE_MINIMIZED)
- {
- MINIMIZED.RemoveAt(index)
- }
- }
- if (hwnd := WinExist("A"))
- {
- winid := "ahk_id " hwnd
- if (WinGetMinMax(winid) != STATE_MINIMIZED)
- {
- PostMessage 0x0112, 0xF020, 0, , winid ; 0x0112 = WM_SYSCOMMAND, 0xF020 = SC_MINIMIZE
- MINIMIZED.Push(winid)
- }
- }
- }
- ; Restore Window = Win + Alt + Up = Restore Window
- #!Up::
- {
- global
- for index, winid in MINIMIZED
- {
- if (!WinExist(winid) || WinGetMinMax(winid) != STATE_MINIMIZED)
- {
- MINIMIZED.RemoveAt(index)
- }
- }
- if (MINIMIZED.Length)
- {
- winid := MINIMIZED.Pop()
- PostMessage 0x0112, 0xF120, 0, , winid ; 0x0112 = WM_SYSCOMMAND, 0xF120 = SC_RESTORE
- }
- }
Add Comment
Please, Sign In to add comment