mikesaa309

Window mover script

Feb 16th, 2023
403
0
Never
7
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Requires AutoHotkey v2.0
  2.  
  3.  
  4. SetTitleMatchMode 2
  5.  
  6. global Tab1 := "Messenger"
  7. global Tab2 := "YouTube"
  8.  
  9. ; Check to see if chrome is open r.
  10. if !WinExist("Google Chrome"){
  11.      Run "chrome.exe"
  12.      Sleep 200
  13.      Winmove 1272, -8, 2575, 1408, "ahk_exe chrome.exe"
  14.      Sleep 1000
  15.      Goto StartSearch
  16. }
  17.  
  18. StartSearch:
  19. if WinExist("Google Chrome"){
  20.    WinActivate("ahk_exe chrome.exe")
  21.    WinWaitActive("ahk_exe chrome.exe", , 2)
  22.  
  23.    ;Search for Messenger
  24.    SearchMessenger:
  25.    SendInput "^+A"
  26.    Sleep 300
  27.    SendInput Tab1 "{Enter}"
  28.    Sleep 500
  29.  
  30.   ;Check Messenger is active and if so store ID in a global variable
  31.   if WinExist(Tab1){
  32.      WinActivate(Tab1)
  33.      global ActiveID1 := WinGetID("A") ;Store Messenger ID as Variable
  34. } else if !WinExist(Tab1){
  35.      run "chrome.exe https://www.facebook.com/messages/t/100011211997085 --new-window "
  36.      Sleep 200
  37.      Goto SearchMessenger ;rechecks to see if messenger is active
  38. }
  39.  
  40.  ;Search for YouTube
  41.  SearchYouTube:
  42.  SendInput "^+A"
  43.  Sleep 300
  44.  SendInput Tab2 "{Enter}"
  45.  Sleep 500
  46.  
  47. ;Check YouTube is active and if so store ID in a global variable
  48. if WinExist(Tab2){
  49.    WinActivate(Tab2)
  50.    global ActiveID2 := WinGetID("A") ;Store YouTube ID as Variable
  51. } else if !WinExist(Tab2){
  52.    run "chrome.exe https://www.youtube.com --new-window "
  53.    Sleep 200
  54.    Goto SearchYouTube ;rechecks to see if YouTube is active
  55. }
  56. }
  57.  
  58.  
  59.  ; MsgBox "Messenger ID is " ActiveID1 " YouTube ID is " ActiveID2 From here both youtube and messenger ID is set
  60.  
  61.  
  62.  ; Activate and move Messenger window via it's ID
  63.  
  64.      WinActivate ("ahk_id" ActiveID1)
  65.      WinWaitActive ("ahk_id" ActiveID1)
  66.      WinRestore ActiveID1
  67.      WinMove 3922, 140, 1117, 899, ActiveID1 ; move messenger window
  68.      WinMaximize ActiveID1
  69.  
  70. ; Activate and Move YouTube window via it's ID
  71.  
  72.      WinActivate "ahk_id" ActiveID2
  73.      WinRestore ActiveID2
  74.      WinMove 1272, -8, 1117, 899, ActiveID2 ; move youtube window
  75.      WinMaximize ActiveID2
Advertisement
Comments
  • InAbstenia
    1 year
    # text 1.04 KB | 0 0
    1. function main(workbook: ExcelScript.Workbook) {
    2.  
    3. let worksheet = workbook.getWorksheet("in");
    4. let wsRange = worksheet.getUsedRange();
    5. let usedRange = worksheet.getUsedRange();
    6. let columnERange = usedRange.getColumn(4);
    7. let columnE = worksheet.getRange("E:E");
    8. let closer = wsRange.getValues();
    9.  
    10. columnE.setNumberFormat("General");
    11.  
    12. let columnD = worksheet.getRange("D:D").getUsedRange();
    13. let values = columnD.getValues();
    14. let reGex: RegExp = /^\d{10}$/;
    15. let lastRow = columnD.getRowCount();
    16. let colD = worksheet.getRange("D2:D" + lastRow);
    17. let colE = worksheet.getRange("E2:E" + lastRow);
    18. let colDvalue = colD.getValues();
    19. let rowCount = usedRange.getRowCount();
    20. let lastRow2 = colD.getLastRow();
    21.  
    22. console.log(lastRow)
    23.  
    24. for (let i = 0; i < rowCount; i++) {
    25. let offsetCell = worksheet.getCell(i, 3);
    26. let cellAddress = offsetCell.getAddress();
    27. console.log(colDvalue[i][0])
    28. colE.setFormula("=LEFT(" + cellAddress + ",3)");
    29. }
    30. }
  • InAbstenia
    1 year
    # text 0.25 KB | 0 0
    1. #Requires AutoHotkey v2.0
    2. #SingleInstance Force
    3.  
    4. >::
    5. {
    6. If WinActive("ahk_class Qt51514QWindow")
    7. {
    8. Send "{LShift down}{.}{LShift up}"
    9. }
    10. Else
    11. {
    12. Send "{LWin down}{LShift down}{V}{LWin up}{LShift up}{Enter}"
    13. }
    14. }
  • InAbstenia
    1 year
    # text 0.88 KB | 0 0
    1. #Requires AutoHotkey v2.0
    2. #SingleInstance Force
    3.  
    4. MyGui := Gui(, "AppPicker")
    5. MyGui.Opt("+AlwaysOnTop")
    6. MyGui.Add("Button", "w50", "Edge").OnEvent("Click", Options) ;Edge
    7. MyGui.Add("Button", "w50", "Outlook").OnEvent("Click", Options) ;Outlook
    8. MyGui.Add("Button", "w50", "Teams").OnEvent("Click", Options) ;Teams
    9. MyGui.Add("Button", "w50", "Code").OnEvent("Click", Options) ;Code
    10. MyGui.Add("Button", "w50", "Folders").OnEvent("Click", Options) ;Folders
    11.  
    12.  
    13. Options(thisbtn, *)
    14. {
    15. MyGui.Hide()
    16. Send thisbtn.text
    17. Send "{Tab}"
    18. }
    19.  
    20.  
    21. #HotIf WinActive("ahk_exe code.exe")
    22. ^Space::
    23. Position(*)
    24. {
    25. MouseGetPos &xpos, &ypos
    26. WinGetPos &X, &Y, &W, &H, "A"
    27. MyGui.Show("x" W / 2 "y" H / 2)
    28. }
    29. #HotIf
    30.  
    31.  
    32. #HotIf WinExist("AppPicker")
    33. Esc::
    34. {
    35. WinActivate("AppPicker")
    36. MyGui.Hide()
    37. }
    38. #HotIf
    39.  
    40.  
    41. #Down::
    42. {
    43. WinMinimize "A"
    44. }
  • InAbstenia
    1 year
    # text 4.24 KB | 0 0
    1. g_MaxWindows := 50
    2. g_Hotkey := "+``"
    3. g_UnHotkey := "^``"
    4. g_StandardMenu := false
    5.  
    6. A_HotkeyModifierTimeout := 100
    7. SetWinDelay 10
    8. SetKeyDelay 0
    9.  
    10. #SingleInstance Force
    11. Persistent
    12.  
    13. g_WindowIDs := []
    14. g_WindowTitles := []
    15.  
    16. Hotkey g_Hotkey, Minimize
    17. Hotkey g_UnHotkey, UnMinimize
    18.  
    19. OnExit RestoreAllThenExit
    20.  
    21. if g_StandardMenu = true
    22. A_TrayMenu.Add
    23. else
    24. {
    25. A_TrayMenu.Delete
    26. A_TrayMenu.Add "E&xit and Unhide All", RestoreAllThenExit
    27. }
    28. A_TrayMenu.Add "&Unhide All Hidden Windows", RestoreAll
    29. A_TrayMenu.Add
    30.  
    31. g_MaxLength := 260
    32.  
    33. Minimize(*)
    34. {
    35. if g_WindowIDs.Length >= g_MaxWindows
    36. {
    37. MsgBox "No more than " g_MaxWindows " may be hidden simultaneously."
    38. return
    39. }
    40. if !WinWait("A", , 2)
    41. return
    42. ActiveID := WinGetID()
    43. ActiveTitle := WinGetTitle()
    44. ActiveClass := WinGetClass()
    45. if ActiveClass ~= "Shell_TrayWnd|Progman"
    46. {
    47. MsgBox "The desktop and taskbar cannot be hidden."
    48. return
    49. }
    50. Send "!{esc}"
    51. WinHide
    52. if ActiveTitle = ""
    53. ActiveTitle := "ahk_class " ActiveClass
    54. ActiveTitle := SubStr(ActiveTitle, 1, g_MaxLength)
    55. for WindowTitle in g_WindowTitles
    56. {
    57. if WindowTitle = ActiveTitle
    58. {
    59. ActiveIDShort := Format("{:X}", ActiveID)
    60. ActiveIDShortLength := StrLen(ActiveIDShort)
    61. ActiveTitleLength := StrLen(ActiveTitle)
    62. ActiveTitleLength += ActiveIDShortLength
    63. ActiveTitleLength += 1
    64. if ActiveTitleLength > g_MaxLength
    65. {
    66. TrimCount := ActiveTitleLength
    67. TrimCount -= g_MaxLength
    68. ActiveTitle := SubStr(ActiveTitle, 1, -TrimCount)
    69. }
    70. ActiveTitle .= " " ActiveIDShort
    71. break
    72. }
    73. }
    74. AlreadyExists := false
    75. for WindowID in g_WindowIDs
    76. {
    77. if WindowID = ActiveID
    78. {
    79. AlreadyExists := true
    80. break
    81. }
    82. }
    83. if AlreadyExists = false
    84. {
    85. A_TrayMenu.Add ActiveTitle, RestoreFromTrayMenu
    86. g_WindowIDs.Push(ActiveID)
    87. g_WindowTitles.Push(ActiveTitle)
    88. }
    89. }
    90.  
    91. RestoreFromTrayMenu(ThisMenuItem, *)
    92. {
    93. A_TrayMenu.Delete ThisMenuItem
    94. for WindowTitle in g_WindowTitles
    95. {
    96. if WindowTitle = ThisMenuItem
    97. {
    98. IDToRestore := g_WindowIDs[A_Index]
    99. WinShow IDToRestore
    100. WinActivate IDToRestore
    101. g_WindowIDs.RemoveAt(A_Index)
    102. g_WindowTitles.RemoveAt(A_Index)
    103. break
    104. }
    105. }
    106. }
    107.  
    108. UnMinimize(*)
    109. {
    110. if g_WindowIDs.Length > 0
    111. {
    112. IDToRestore := g_WindowIDs.Pop()
    113. WinShow IDToRestore
    114. WinActivate IDToRestore
    115. MenuToRemove := g_WindowTitles.Pop()
    116. A_TrayMenu.Delete MenuToRemove
    117. }
    118. }
    119.  
    120. RestoreAllThenExit(*)
    121. {
    122. RestoreAll()
    123. ExitApp
    124. }
    125.  
    126. RestoreAll(*)
    127. {
    128. for WindowID in g_WindowIDs
    129. {
    130. IDToRestore := WindowID
    131. WinShow IDToRestore
    132. WinActivate IDToRestore
    133. MenuToRemove := g_WindowTitles[A_Index]
    134. A_TrayMenu.Delete MenuToRemove
    135. }
    136. global g_WindowIDs := []
    137. global g_WindowTitles := []
    138. }
    139.  
    140. #Requires AutoHotkey v2.0
    141. #SingleInstance Force
    142. #NoTrayIcon
    143.  
    144. MINIMIZED := []
    145. STATE_MINIMIZED := -1
    146.  
    147. return
    148.  
    149. ; Win + Alt + Down = Minimize Window
    150. #!Down::
    151. {
    152. global
    153.  
    154. for index, winid in MINIMIZED
    155. {
    156. if (!WinExist(winid) || WinGetMinMax(winid) != STATE_MINIMIZED)
    157. {
    158. MINIMIZED.RemoveAt(index)
    159. }
    160. }
    161.  
    162. if (hwnd := WinExist("A"))
    163. {
    164. winid := "ahk_id " hwnd
    165.  
    166. if (WinGetMinMax(winid) != STATE_MINIMIZED)
    167. {
    168. PostMessage 0x0112, 0xF020, 0, , winid ; 0x0112 = WM_SYSCOMMAND, 0xF020 = SC_MINIMIZE
    169. MINIMIZED.Push(winid)
    170. }
    171. }
    172. }
    173.  
    174. ; Win + Alt + Up = Restore Window
    175. #!Up::
    176. {
    177. global
    178.  
    179. for index, winid in MINIMIZED
    180. {
    181. if (!WinExist(winid) || WinGetMinMax(winid) != STATE_MINIMIZED)
    182. {
    183. MINIMIZED.RemoveAt(index)
    184. }
    185. }
    186.  
    187. if (MINIMIZED.Length)
    188. {
    189. winid := MINIMIZED.Pop()
    190. PostMessage 0x0112, 0xF120, 0, , winid ; 0x0112 = WM_SYSCOMMAND, 0xF120 = SC_RESTORE
    191. }
    192. }
  • InAbstenia
    1 year
    # text 2.72 KB | 0 0
    1. #Requires AutoHotkey v2.0
    2. #SingleInstance Force
    3.  
    4. MyGui := Gui(, "AppPicker")
    5. MyGui.Opt("+AlwaysOnTop")
    6. MyGui.Add("Button", "w50", "Edge").OnEvent("Click", OpenEdge) ;Edge
    7. MyGui.Add("Button", "w50", "Outlook").OnEvent("Click", OpenOutlook) ;Outlook
    8. MyGui.Add("Button", "w50", "Teams").OnEvent("Click", OpenTeams) ;Teams
    9. MyGui.Add("Button", "w50", "Explorer").OnEvent("Click", OpenExplorer) ;Code
    10. MyGui.Add("Button", "w50", "Code").OnEvent("Click", OpenCode) ;Folders
    11.  
    12.  
    13. Numlock::
    14. {
    15. MyGui.Show()
    16. }
    17.  
    18.  
    19. #HotIf WinActive("AppPicker")
    20. a::
    21. OpenEdge(thisbtn, *)
    22. {
    23. MyGui.Hide()
    24. WinActivate("ahk_exe msedge.exe")
    25. }
    26. #HotIf
    27.  
    28.  
    29. #HotIf WinActive("AppPicker")
    30. s::
    31. OpenOutlook(thisbtn, *)
    32. {
    33. MyGui.Hide()
    34. Send "#{2}"
    35. }
    36. #HotIf
    37.  
    38.  
    39. #HotIf WinActive("AppPicker")
    40. d::
    41. OpenTeams(thisbtn, *)
    42. {
    43. MyGui.Hide()
    44. Send "#{3}"
    45. }
    46. #HotIf
    47.  
    48.  
    49. #HotIf WinActive("AppPicker")
    50. f::
    51. OpenExplorer(thisbtn, *)
    52. {
    53. MyGui.Hide()
    54. Send "#{AppsKey}"
    55. }
    56. #HotIf
    57.  
    58.  
    59. #HotIf WinActive("AppPicker")
    60. g::
    61. OpenCode(thisbtn, *)
    62. {
    63. MyGui.Hide()
    64. WinActivate("ahk_exe code.exe")
    65. }
    66. #HotIf
    67.  
    68.  
    69. Options(thisbtn, *)
    70. {
    71. MyGui.Hide()
    72. Send thisbtn.text
    73. Send "{Tab}"
    74. }
    75.  
    76. ^Space::
    77. Position(*)
    78. {
    79. MouseGetPos &xpos, &ypos
    80. WinGetPos &X, &Y, &W, &H, "A"
    81. MyGui.Show("x" W / 2 "y" H / 2)
    82. }
    83.  
    84.  
    85. #HotIf WinExist("AppPicker")
    86. Esc::
    87. {
    88. WinActivate("AppPicker")
    89. MyGui.Hide()
    90. }
    91. #HotIf
    92.  
    93.  
    94. #Down::
    95. {
    96. WinMinimize "A"
    97. }
    98.  
    99.  
    100. ; ^F13::
    101. ; {
    102. ; loop
    103. ; {
    104. ; MouseMove 0, 1, 5000, "R"
    105. ; Sleep 5000
    106. ; MouseMove 0, -1, 5000, "R"
    107. ; }
    108. ; }
    109. ; Return
    110.  
    111. ; F13::
    112. ; {
    113. ; Send "!{Space}"
    114. ; }
    115.  
    116. ; F14::
    117. ; {
    118. ; Send "{Menu}"
    119. ; }
    120.  
    121. ; ^+o::
    122. ; ^+e::
    123. ; editor_open_folder(hk)
    124. ; {
    125. ; path := WinGetTitle("A")
    126. ; if RegExMatch(path, "\*?\K(.*)\\[^\\]+(?= [-*] )", &path)
    127. ; if (FileExist(path[0]) && hk = "^+e")
    128. ; Run Format('explorer.exe /select,"{1}"', path[0])
    129. ; else
    130. ; Run Format('explorer.exe "{1}"', path[1])
    131. ; }
    132.  
    133. ; #HotIf WinActive("ahk_exe code.exe")
    134. ; ^F14::
    135. ; Position(*)
    136. ; {
    137. ; MouseGetPos &xpos, &ypos
    138. ; WinGetPos &X, &Y, &W, &H, "A"
    139. ; MyGui.Show("x" W / 2 "y" H / 2)
    140. ; MsgBox
    141. ; (
    142. ; "The active window:
    143. ; x: `t" X "
    144. ; y: `t" Y "
    145. ; -
    146. ; w: `t" W "
    147. ; h: `t" H "
    148. ; -
    149. ; The cursor is at X" xpos " Y" ypos
    150. ; )
    151. ; }
    152. ; #HotIf
    153.  
    154. ; #HotIf WinActive("ahk_exe Fusion360.exe")
    155. ; RButton::
    156. ; {
    157. ; Send "{Shift Down}"
    158. ; Send "{MButton Down}"
    159. ; while GetKeyState("RButton", "P")
    160. ; {
    161. ; Sleep 10
    162. ; }
    163. ; Send "{MButton Up}"
    164. ; Send "{Shift Up}"
    165. ; Return
    166. ; }
    167. ; #HotIf
    168.  
  • InAbstenia
    1 year
    # text 5.84 KB | 0 0
    1. #Requires AutoHotkey v2.0
    2. #SingleInstance Force
    3.  
    4. MyGui := Gui(, "AppPicker")
    5. MyGui.Opt("+AlwaysOnTop")
    6. MyGui.Add("Button", "w50", "Edge").OnEvent("Click", OpenEdge) ;Edge
    7. MyGui.Add("Button", "w50", "Outlook").OnEvent("Click", OpenOutlook) ;Outlook
    8. MyGui.Add("Button", "w50", "Teams").OnEvent("Click", OpenTeams) ;Teams
    9. MyGui.Add("Button", "w50", "Explorer").OnEvent("Click", OpenExplorer) ;Code
    10. MyGui.Add("Button", "w50", "Code").OnEvent("Click", OpenCode) ;Folders
    11. MyGui.Add("Button", "w50", "Tableau").OnEvent("Click", OpenTableau) ;Tableau
    12. MyGui.Add("Button", "w50", "Google").OnEvent("Click", OpenGoogle) ;Google
    13.  
    14.  
    15. Numlock::
    16. {
    17. MyGui.Show()
    18. }
    19.  
    20.  
    21. #HotIf WinActive("AppPicker")
    22. a::
    23. OpenEdge(thisbtn, *)
    24. {
    25. MyGui.Hide()
    26. WinActivate("ahk_exe msedge.exe", , "Microsoft Lists - Lists")
    27. }
    28. #HotIf
    29.  
    30.  
    31. #HotIf WinActive("AppPicker")
    32. s::
    33. OpenOutlook(thisbtn, *)
    34. {
    35. MyGui.Hide()
    36. WinActivate("ahk_exe Outlook.exe")
    37. }
    38. #HotIf
    39.  
    40.  
    41. #HotIf WinActive("AppPicker")
    42. d::
    43. OpenTeams(thisbtn, *)
    44. {
    45. MyGui.Hide()
    46. WinActivate("ahk_exe Teams.exe")
    47. }
    48. #HotIf
    49.  
    50.  
    51. #HotIf WinActive("AppPicker")
    52. f::
    53. OpenExplorer(thisbtn, *)
    54. {
    55. MyGui.Hide()
    56. Run("C:\Users\jduphold\QuickLinks")
    57. }
    58. #HotIf
    59.  
    60.  
    61. #HotIf WinActive("AppPicker")
    62. v::
    63. OpenCode(thisbtn, *)
    64. {
    65. MyGui.Hide()
    66. WinActivate("ahk_exe code.exe")
    67. }
    68. #HotIf
    69.  
    70. #HotIf WinActive("AppPicker")
    71. ^g::
    72. OpenGoogle(thisbtn, *)
    73. {
    74. MyGui.Hide()
    75. WinActivate("ahk_exe msedge.exe")
    76. Send "https://www.google.com"
    77. }
    78. #HotIf
    79.  
    80. #HotIf WinActive("AppPicker")
    81. t::
    82. OpenTableau(thisbtn, *)
    83. {
    84. MyGui.Hide()
    85. WinActivate("ahk_exe tableau.exe")
    86. }
    87. #HotIf
    88.  
    89.  
    90. Options(thisbtn, *)
    91. {
    92. MyGui.Hide()
    93. Send thisbtn.text
    94. Send "{Tab}"
    95. }
    96.  
    97. ^Space::
    98. Position(*)
    99. {
    100. MouseGetPos &xpos, &ypos
    101. WinGetPos &X, &Y, &W, &H, "A"
    102. MyGui.Show("x" W / 2 "y" H / 2)
    103. }
    104.  
    105.  
    106. #HotIf WinExist("AppPicker")
    107. Esc::
    108. {
    109. WinActivate("AppPicker")
    110. MyGui.Hide()
    111. }
    112. #HotIf
    113.  
    114.  
    115. #Down::
    116. {
    117. WinMinimize "A"
    118. }
    119.  
    120. #HotIf WinActive("AppPicker")
    121. +S::
    122. {
    123. win := "Sound ahk_class #32770 ahk_exe rundll32.exe"
    124. if !WinExist(win)
    125. Run A_WinDir . "\System32\mmsys.cpl"
    126. else if !WinActive(win)
    127. WinActivate
    128. else
    129. WinClose
    130. }
    131. #HotIf
    132.  
    133.  
    134. #HotIf WinActive("AppPicker")
    135. g::
    136. OpenGoogleIt(thisbtn, *)
    137. {
    138. MyGui.Hide()
    139. Browser := '"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe"'
    140. win := 'ahk_class Chrome_WidgetWin_1 ahk_exe MsEdge.exe'
    141.  
    142. ClipSaved := ClipboardAll()
    143. if !ClipWait(1)
    144. {
    145. A_Clipboard := ClipSaved
    146. }
    147.  
    148. string := Trim(A_Clipboard, " `t`r`n")
    149. reg := RegExMatch(string, "i)^\S+\.(com|de|gov|io|jp|net|org|to|tv|uk)|(\/.*)$") ? "" : "https://www.google.com/search?q="
    150.  
    151. ; Attach the prefix and wrap text in quotes.
    152. ; Characters between quotes are parsed as a single argument for most Windows apps.
    153. ; AHK's quoting rules are ... interesting.
    154. ; '"' is a string containing a quote.
    155. url := '"' . reg . string . '"'
    156.  
    157. ; Open Browser
    158. Run(Browser . ' --new-tab ' . url)
    159. A_Clipboard := ClipSaved
    160. }
    161. #HotIf
    162.  
    163. !f::
    164. {
    165. runThis := '"C:\Program Files\Microsoft Office\root\Office16\OUTLOOK.EXE"'
    166. win := 'ahk_class Notepad++ ahk_exe notepad++.exe'
    167.  
    168. if !WinExist(win)
    169. {
    170. Run(runThis, , 'Max', &winNew)
    171. if WinWait('ahk_pid ' . winNew, , 3)
    172. WinActivate('ahk_pid ' . winNew)
    173. }
    174. else if !WinActive(win)
    175. WinActivate(win)
    176. else
    177. WinClose(win)
    178. }
    179.  
    180.  
    181. F13:: maximize_all()
    182.  
    183. maximize_all() {
    184. ; Map of exe names (Mapping is faster than iterating through an array or parsing a string)
    185. processes := Map('msedge.exe', 1)
    186. processes.Default := 0 ; Set a default when key not found
    187.  
    188. for _, id in WinGetList() { ; Loop through each window
    189. id := 'ahk_id ' id ; Create a window id (Window handles are unique)
    190. if (WinGetMinMax(id) = 0 ; If the window is a normal/restored state
    191. && processes[WinGetProcessName(id)]) ; AND the process name is a found in the processes map
    192. WinMaximize(id) ; Maximize that window
    193. }
    194. }
    195.  
    196.  
    197. Friday: In @ 5:15pm
    198. ; #HotIf WinActive("AppPicker")
    199. ; ^c::
    200. ; {
    201. ; WinWait "ahk_class rctrl_renwnd32"
    202. ; If WinExist("Inbox - [email protected] - Outlook")
    203. ; {
    204. ; ; Activate Outlook
    205. ; WinActivate("Inbox - [email protected] - Outlook")
    206.  
    207. ; ; Switch to Calendar view
    208. ; Send "^2"
    209. ; Send "!vr"
    210. ; }
    211. ; }
    212. ; #HotIf
    213.  
    214. ; ^F13::
    215. ; {
    216. ; loop
    217. ; {
    218. ; MouseMove 0, 1, 5000, "R"
    219. ; Sleep 5000
    220. ; MouseMove 0, -1, 5000, "R"
    221. ; }
    222. ; }
    223. ; Return
    224.  
    225. ; F13::
    226. ; {
    227. ; Send "!{Space}"
    228. ; }
    229.  
    230. ; F14::
    231. ; {
    232. ; Send "{Menu}"
    233. ; }
    234.  
    235. ; ^+o::
    236. ; ^+e::
    237. ; editor_open_folder(hk)
    238. ; {
    239. ; path := WinGetTitle("A")
    240. ; if RegExMatch(path, "\*?\K(.*)\\[^\\]+(?= [-*] )", &path)
    241. ; if (FileExist(path[0]) && hk = "^+e")
    242. ; Run Format('explorer.exe /select,"{1}"', path[0])
    243. ; else
    244. ; Run Format('explorer.exe "{1}"', path[1])
    245. ; }
    246.  
    247. ; #HotIf WinActive("ahk_exe code.exe")
    248. ; ^F14::
    249. ; Position(*)
    250. ; {
    251. ; MouseGetPos &xpos, &ypos
    252. ; WinGetPos &X, &Y, &W, &H, "A"
    253. ; MyGui.Show("x" W / 2 "y" H / 2)
    254. ; MsgBox
    255. ; (
    256. ; "The active window:
    257. ; x: `t" X "
    258. ; y: `t" Y "
    259. ; -
    260. ; w: `t" W "
    261. ; h: `t" H "
    262. ; -
    263. ; The cursor is at X" xpos " Y" ypos
    264. ; )
    265. ; }
    266. ; #HotIf
    267.  
    268. ; #HotIf WinActive("ahk_exe Fusion360.exe")
    269. ; RButton::
    270. ; {
    271. ; Send "{Shift Down}"
    272. ; Send "{MButton Down}"
    273. ; while GetKeyState("RButton", "P")
    274. ; {
    275. ; Sleep 10
    276. ; }
    277. ; Send "{MButton Up}"
    278. ; Send "{Shift Up}"
    279. ; Return
    280. ; }
    281. ; #HotIf
    282.  
  • InAbstenia
    1 year
    # text 4.19 KB | 0 0
    1. #Requires AutoHotkey v2.0
    2. #SingleInstance Force
    3. Persistent
    4.  
    5. g_MaxWindows := 25
    6. g_StandardMenu := false
    7.  
    8. g_Hotkey := "^+T"
    9. g_UnHotkey := "^+!T"
    10.  
    11. Hotkey g_Hotkey, Minimize
    12. Hotkey g_UnHotkey, UnMinimize
    13.  
    14. A_HotkeyModifierTimeout := 100
    15. SetWinDelay 10
    16. SetKeyDelay 0
    17.  
    18. g_WindowIDs := []
    19. g_WindowTitles := []
    20.  
    21. if g_StandardMenu = true
    22. A_TrayMenu.Add
    23. else
    24. {
    25. A_TrayMenu.Delete
    26. A_TrayMenu.Add "&Exit and Unhide All", RestoreAllThenExit
    27. }
    28. A_TrayMenu.Add "&Unhide All Hidden Windows", RestoreAll
    29. A_TrayMenu.Add
    30.  
    31. g_MaxLength := 260
    32.  
    33. Minimize(*)
    34. {
    35. if g_WindowIDs.Length >= g_MaxWindows
    36. {
    37. MsgBox "No more than " g_MaxWindows " may be hidden simultaneously."
    38. return
    39. }
    40. if !WinWait("A", , 2)
    41. return
    42. ActiveID := WinGetID()
    43. ActiveTitle := WinGetTitle()
    44. ActiveClass := WinGetClass()
    45. if ActiveClass ~= "Shell_TrayWnd|Progman"
    46. {
    47. MsgBox "The desktop and taskbar cannot be hidden."
    48. return
    49. }
    50. Send "!{esc}"
    51. WinHide
    52. if ActiveTitle = ""
    53. ActiveTitle := "ahk_class " ActiveClass
    54. ActiveTitle := SubStr(ActiveTitle, 1, g_MaxLength)
    55. for WindowTitle in g_WindowTitles
    56. {
    57. if WindowTitle = ActiveTitle
    58. {
    59. ActiveIDShort := Format("{:X}", ActiveID)
    60. ActiveIDShortLength := StrLen(ActiveIDShort)
    61. ActiveTitleLength := StrLen(ActiveTitle)
    62. ActiveTitleLength += ActiveIDShortLength
    63. ActiveTitleLength += 1
    64. if ActiveTitleLength > g_MaxLength
    65. {
    66. TrimCount := ActiveTitleLength
    67. TrimCount -= g_MaxLength
    68. ActiveTitle := SubStr(ActiveTitle, 1, -TrimCount)
    69. }
    70. ActiveTitle .= " " ActiveIDShort
    71. break
    72. }
    73. }
    74. AlreadyExists := false
    75. for WindowID in g_WindowIDs
    76. {
    77. if WindowID = ActiveID
    78. {
    79. AlreadyExists := true
    80. break
    81. }
    82. }
    83. if AlreadyExists = false
    84. {
    85. A_TrayMenu.Add ActiveTitle, RestoreFromTrayMenu
    86. g_WindowIDs.Push(ActiveID)
    87. g_WindowTitles.Push(ActiveTitle)
    88. }
    89. }
    90.  
    91. RestoreFromTrayMenu(ThisMenuItem, *)
    92. {
    93. A_TrayMenu.Delete ThisMenuItem
    94. for WindowTitle in g_WindowTitles
    95. {
    96. if WindowTitle = ThisMenuItem
    97. {
    98. IDToRestore := g_WindowIDs[A_Index]
    99. WinShow IDToRestore
    100. WinActivate IDToRestore
    101. g_WindowIDs.RemoveAt(A_Index)
    102. g_WindowTitles.RemoveAt(A_Index)
    103. break
    104. }
    105. }
    106. }
    107.  
    108. UnMinimize(*)
    109. {
    110. if g_WindowIDs.Length > 0
    111. {
    112. IDToRestore := g_WindowIDs.Pop()
    113. WinShow IDToRestore
    114. WinActivate IDToRestore
    115. MenuToRemove := g_WindowTitles.Pop()
    116. A_TrayMenu.Delete MenuToRemove
    117. }
    118. }
    119.  
    120. RestoreAllThenExit(*)
    121. {
    122. RestoreAll()
    123. ExitApp
    124. }
    125.  
    126. RestoreAll(*)
    127. {
    128. for WindowID in g_WindowIDs
    129. {
    130. IDToRestore := WindowID
    131. WinShow IDToRestore
    132. WinActivate IDToRestore
    133. MenuToRemove := g_WindowTitles[A_Index]
    134. A_TrayMenu.Delete MenuToRemove
    135. }
    136. global g_WindowIDs := []
    137. global g_WindowTitles := []
    138. }
    139.  
    140. MINIMIZED := []
    141. STATE_MINIMIZED := -1
    142.  
    143. ; Minimize Window = Win + Alt + Down
    144. #!Down::
    145. {
    146. global
    147.  
    148. for index, winid in MINIMIZED
    149. {
    150. if (!WinExist(winid) || WinGetMinMax(winid) != STATE_MINIMIZED)
    151. {
    152. MINIMIZED.RemoveAt(index)
    153. }
    154. }
    155.  
    156. if (hwnd := WinExist("A"))
    157. {
    158. winid := "ahk_id " hwnd
    159.  
    160. if (WinGetMinMax(winid) != STATE_MINIMIZED)
    161. {
    162. PostMessage 0x0112, 0xF020, 0, , winid ; 0x0112 = WM_SYSCOMMAND, 0xF020 = SC_MINIMIZE
    163. MINIMIZED.Push(winid)
    164. }
    165. }
    166. }
    167.  
    168. ; Restore Window = Win + Alt + Up = Restore Window
    169. #!Up::
    170. {
    171. global
    172.  
    173. for index, winid in MINIMIZED
    174. {
    175. if (!WinExist(winid) || WinGetMinMax(winid) != STATE_MINIMIZED)
    176. {
    177. MINIMIZED.RemoveAt(index)
    178. }
    179. }
    180.  
    181. if (MINIMIZED.Length)
    182. {
    183. winid := MINIMIZED.Pop()
    184. PostMessage 0x0112, 0xF120, 0, , winid ; 0x0112 = WM_SYSCOMMAND, 0xF120 = SC_RESTORE
    185. }
    186. }
Add Comment
Please, Sign In to add comment