Focusjump.ahk

From Lucca's Wiki
Revision as of 17:26, 10 December 2024 by 45.27.172.161 (talk)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search
#Requires AutoHotkey v2.0
;Make a file in the script's folder called lefthanded.txt if you do want left handed keybinds
A_MaxHotkeysPerInterval := 20000


;CapsLock, Numlock, and ScrollLock state
SetCapsLockState "AlwaysOff"
SetScrollLockState "AlwaysOff"
SetNumLockState "AlwaysOff"
;Screenshot on PrintScreen Key & f14
F14::
PrintScreen::Run "ms-screenclip:"
;ScreenConnect Only Hotkeys:
#HotIf WinActive("ahk_exe ScreenConnect.ClientService.exe") or WinActive("ahk_exe ScreenConnect.WindowsClient.exe")
#HotIf
#h::Run "hudu_search\hudusearch.bat"
;Clipboard buffers
clipboardBufferArray := []
clipboardBufferArray.Length := 9
clipboardBufferArray.Default := "No value set for this clipboard buffer"
NumpadEnd::clipboardBufferArray[1] := clipboardBufferWriteIn(1)
NumpadDown::clipboardBufferArray[2] := clipboardBufferWriteIn(2)
NumpadPgDn::clipboardBufferArray[3] := clipboardBufferWriteIn(3)
NumpadLeft::clipboardBufferArray[4] := clipboardBufferWriteIn(4)
NumpadClear::clipboardBufferArray[5] := clipboardBufferWriteIn(5)
NumpadRight::clipboardBufferArray[6] := clipboardBufferWriteIn(6)
NumpadHome::clipboardBufferArray[7] := clipboardBufferWriteIn(7)
NumpadUp::clipboardBufferArray[8] := clipboardBufferWriteIn(8)
NumpadPgUp::clipboardBufferArray[9] := clipboardBufferWriteIn(9)


#+1::clipboardBufferArray[1] := clipboardBuffer(1)
#+2::clipboardBufferArray[2] := clipboardBuffer(2)
#+3::clipboardBufferArray[3] := clipboardBuffer(3)
#+4::clipboardBufferArray[4] := clipboardBuffer(4)
#+5::clipboardBufferArray[5] := clipboardBuffer(5)
#+6::clipboardBufferArray[6] := clipboardBuffer(6)
#+7::clipboardBufferArray[7] := clipboardBuffer(7)
#+8::clipboardBufferArray[8] := clipboardBuffer(8)
#+9::clipboardBufferArray[9] := clipboardBuffer(9)
NumpadIns & NumpadEnd::send("{Raw}" clipboardBufferArray[1])
NumpadIns & NumpadDown::send("{Raw}" clipboardBufferArray[2])
NumpadIns & NumpadPgDn::send("{Raw}" clipboardBufferArray[3])
NumpadIns & NumpadLeft::send("{Raw}" clipboardBufferArray[4])
NumpadIns & NumpadClear::send("{Raw}" clipboardBufferArray[5])
NumpadIns & NumpadRight::send("{Raw}" clipboardBufferArray[6])
NumpadIns & NumpadHome::send("{Raw}" clipboardBufferArray[7])
NumpadIns & NumpadUp::send("{Raw}" clipboardBufferArray[8])
NumpadIns & NumpadPgUp::send("{Raw}" clipboardBufferArray[9])


clipboardBuffer(bufferID){
Send("^c")
Sleep 100
newClip := A_Clipboard
MsgBox "Stored to clip buffer " bufferID ":`n===============`n`n " newClip ,, "T0.3"
return(newClip)
}
clipboardBufferWriteIn(bufferID){
newClip := clipboardBufferArray[bufferID]
newClip := InputBox("Write into buffer",,, clipboardBufferArray[bufferID]).value
MsgBox "Stored to clip buffer " bufferID ":`n===============`n`n " newClip ,, "T0.3"
return(newClip)
}
clipboardBufferAuto(bufferID){
oldClip := A_Clipboard
A_Clipboard := ""
Send "^c"
;if !ClipWait(2)
{
 MsgBox "The attempt to copy text onto the clipboard failed."
 return
}
newClip := A_Clipboard
MsgBox "Stored to clip buffer " bufferID ":`n===============`n`n " newClip
A_Clipboard := oldClip
return(newClip)
}
;quick hudu copy
#Backspace::{
huduCopy(1)
huduCopy(2)
huduCopy(3)
}
#+Backspace::{
huduCopy(1)
huduCopy(2)
}
huduCopy(bufferID){
A_Clipboard := ""
;KeyWait "LButton", "D"
Click
ClipWait
clipboardBufferArray[bufferID] := A_Clipboard
MouseMove 25, 0, 1000, "R"
Sleep 50
}


;Wiki Code block setup
!+end::{
Send "{home}"
Sleep 50
Send "+{end}"
Sleep 50
Send "^x"
Sleep 50
Send ""
Sleep 50
Send "^v"
Sleep 50
Send ""
}
;Hotstrings:
::smth::something
::wfh::working from home
::pcn::PC Name:
::i::I
::cg2g::closing g2g
; ::lmk::let me know
::atp::at this point
::btw::by the way
::idk::I don't know
::ik::I know
::ig::I guess
::mip::Marked ticket as "In Progress"
::ctt::Called to troubleshoot, `n`n
::w2vm::Called, went to voicemail.
::cw2vm::Called, went to voicemail.
::clavm::Called, left a voicemail.
::iirc::if I recall correctly
::afaik::as far as I know
::wdym::what do you mean
::myemail::gianlucca.pirovano@wheelhouseit.com
!+e::Send("gianlucca.pirovano@wheelhouseit.com")
;!+p::Send("PC Name:")
::todaysdate::{
TimeString := FormatTime("ddd, MMM dd, yyyy hh:mm")
send(TimeString)
}
::tylp::{
Send "{Raw}`n`nThank you and have a wonderful rest of your day!`nLucca P."
}
::nphawd::
{
SendText "No problem! Have a wonderful rest of your day."
}
!g::SendText "Hello, this is Lucca with Wheelhouse IT."
!+g::SendText "No problem! Have a wonderful rest of your day."
::acc::account
#+e::Run '"C:\Users\Gianlucca.Pirovano\OneDrive - Wheelhouse IT\Documents\Scripts\copyResponses.py" "8"'


;RC Hotkeys
numpadDel::^!+#f1 ; Enter Number
numpadDiv::^!+#f2 ; Mute
numpadMult::^!+#f3 ; Hold
;numpadSub::endCall() ; End Call
numpadAdd::^!+#f5 ; Transfer
NumLock::rcFocus()
;Focus Apps
focusOutlook(){
WinActivate("ahk_exe OUTLOOK.EXE")
CenterMouseOnActiveWindow()
}
minimizeOutlook(){
WinMinimize("ahk_exe OUTLOOK.EXE")
}
!o::focusOutlook()
!+o::minimizeOutlook()
;Each Monitor's Center Coordinates (Relative to the primary monitor), change these as needed
if !(FileExist(A_Desktop . "\luccaworkingfromhome.txt")){
mon1x := -447
mon1y := 543
mon2x := 964
mon2y := 552
mon3x := 2479
mon3y := 52
mon4x := 2032
mon4y := 1488
mon5x := 835
mon5y := 1511
mon6x := 3462
mon6y := 662
mon7x := 2278
mon7y := 2434
mon7leftx := 2042
mon7rightx := 2516
mon7topy := 2042
mon7bottomy := 2837
}
if (FileExist(A_Desktop . "\luccaworkingfromhome.txt")){
mon1x := -807
mon1y := -527
mon2x := 1215
mon2y := -543
mon3x := 645
mon3y := 475
mon4x := -655
mon4y := 395
mon5x := 835
mon5y := 1511
mon6x := 3462
mon6y := 662
mon7x := 2278
mon7y := 2434
mon7leftx := 2042
mon7rightx := 2516
mon7topy := 2042
mon7bottomy := 2837
}
#HotIf (FileExist(A_Desktop . "\luccaworkingfromhome.txt"))
#HotIf
;RingCentral X and Y coordinate
rcX := 1170
rcY := 1253
;reload this script with hotkey Alt+Shift+R to apply changes
!+r::Reload
;open powershell on ctrl+alt+t
;^!t::Run "pwsh -Noexit"


;Move Windows between monitors:
#HotIf !(FileExist("lefthanded.txt"))
#+z::MoveWindowToMonitor(mon1x,mon1y)
#+x::MoveWindowToMonitor(mon2x,mon2y)
#+c::MoveWindowToMonitor(mon3x,mon3y)
#+v::MoveWindowToMonitor(mon4x,mon4y)
#HotIf
;Move focus between montiors:
#HotIf !(FileExist("lefthanded.txt"))
#v::FocusMonitor(mon4x,mon4y)
#z::FocusMonitor(mon1x,mon1y)
#x::FocusMonitor(mon2x,mon2y)
#c::FocusMonitor(mon3x,mon3y)
#HotIf
;Snap Windows to sides of screen:
#HotIf !(FileExist("lefthanded.txt"))
$#a::SnapLeft()
$#s::SnapDown()
$#w::SnapUp()
$#d::SnapRight()
#HotIf
;Automatically request from chatgpt and copy to clipboard
!Insert::{
callername := InputBox("What is the caller's name?", "Caller Name Input",, "Mario")
companyname := InputBox("What is the company's name?", "Caller Name Input",, "Company's name")
affectedusers := InputBox("Who are the affected users?", "Caller Name Input",, "everyone!!!!! HELP!")
listofproblems := InputBox("What are all of the problems", "Caller Name Input",, "The cobblestone generator.")
input := InputBox("What will you send to ChatGPT", "inputbox", "w1200 h300", "Summarize the following facts into a complete sentence (or sentences), reply only with the summary and begin your response with 'caller is calling in regarding', replace 'caller' with the caller's name if available. Always mention the client name if available. Mention the names of affected users if available and never speculate: The caller's name is " . callername . ", the client's name is " . companyname . ", The problem is affecting " . affectedusers . ". " . listofproblems . ".")
Run Format('"C:\Python312\python.exe" "C:\Users\Gianlucca.Pirovano\OneDrive - Wheelhouse IT\Documents\Scripts\ai.py" "{1}"', input.Value),,"Min"
}
;Left Handed Keybinds!
#HotIf (FileExist("lefthanded.txt"))
;Escape::Lwin
Capslock & a::Lwin
CapsLock & h::Left
CapsLock & j::Down
CapsLock & k::Up
CapsLock & l::Right
!+j::^+PgDn
!+k::^+PgUp
!j::^PgDn
!k::^PgUp
!h::!Left
!l::!Right
!+f::^+f
!x::^w
!+x::^+t
;#+r::Run Format('"C:\Python312\python.exe" "C:\Users\Gianlucca.Pirovano\OneDrive - Wheelhouse IT\Documents\Scripts\ai.py" "{1}"', input.Value),,"Min"
#+r::Run "C:\Users\Gianlucca.Pirovano\OneDrive - Wheelhouse IT\Documents\Scripts\copyResponses.py"
#^r::Run "C:\Users\Gianlucca.Pirovano\OneDrive - Wheelhouse IT\Documents\Scripts\copyResponses-lol.py"
CapsLock::Escape
;AppsKey::RWin
AppsKey & space::Send "shutdown /L"
AppsKey & m::Send "mmsys.cpl"
AppsKey & u::{
CoordMode "Mouse", "Screen"
Click(926, 94)
}
Appskey & p::Send "ms-settings:printers"
Appskey & c::Send "control /name Microsoft.Printers"
Appskey & d::Send "DISM /Online /Cleanup-Image /RestoreHealth"
Appskey & s::Send "Start-ADSyncSyncCycle -PolicyType Delta"
Appskey & n::Send "net user /add whitadminlocal"
Appskey & a::Send "net localgroup administrators whitadminlocal /add"
Appskey & r::Send "shutdown /r /t 0"
Appskey & k::Send "rundll32.exe user32.dll,LockWorkStation"
>!\::!Tab
>+!|::!+Tab
^AppsKey::^z
!AppsKey::{
Send('{f3}')
WinWait("Manage: Work - Microsoft Edge", , 1)
MoveWindowToMonitor(mon6x,mon6y)
SnapUp()
}
;CapsLock & Space::Click
CapsLock & Space::CenterMouseOnActiveWindow()
Capslock & m::AppsKey
;Insert::{
;Send "^a"
;Sleep 5
;Send "^c"
;}
^+Insert::{
Send "^a"
Sleep 5
Send "^+v"
}
^/::^x
^.::^c
^,::^v
^'::^a
^o::^t
^;::^s
!+Enter::Run "cmd"
#m::Run "msedge.exe -inprivate https://admin.microsoft.com"
#space::Click
AppsKey & ,::^F3
AppsKey & .::!F3
AppsKey & /::^!F3
AppsKey & Enter::+F3
AppsKey & l::#+F4
AppsKey & `;::^+F4
AppsKey & '::#F4
AppsKey::AppsKey
#+i::f7
>!]::WinClose "A"
^\::^Tab
^+\::^+Tab
;Move Windows between monitors:
!+M::MoveWindowToMonitor(mon4x,mon4y)
!+N::MoveWindowToMonitor(mon5x,mon5y)
!+,::MoveWindowToMonitor(mon1x,mon1y)
!+.::MoveWindowToMonitor(mon2x,mon2y)
!+/::MoveWindowToMonitor(mon3x,mon3y)
!+\::{
MoveWindowToMonitor(mon6x,mon6y)
SnapUp()
}
;Move focus between montiors:
!M::FocusMonitor(mon4x,mon4y)
!N::FocusMonitor(mon5x,mon5y)
!,::FocusMonitor(mon1x,mon1y)
#,::FocusMonitor(mon1x-960,mon1y)
!.::FocusMonitor(mon2x,mon2y)
!/::FocusMonitor(mon3x,mon3y)
!\::FocusMonitor(mon6x,mon6y)
#\::FocusMonitor(mon6x+300,mon6y+700)
#HotIf


;Functions:
TileThirds(third){
number := third
Send "#z"
sleep 100
Send "6"
sleep 150
Send number
}
CenterWindow(WinTitle)
{
Send "{LWin up}"
WinGetPos &X, &Y, &W, &H, "A" ; xcoord ycoord width height activewindow
WinRestore "A"
Sleep 20
WinMove X, Y, 512, 512, "A"
Sleep 50
}
Maximize(){
WinRestore "A"
WinMaximize "A"
}
SnapLeft(){
;CenterWindow("A")
;Sleep 70
Send "{Blind}#{Left}"
}
SnapRight(){
;CenterWindow("A")
;Sleep 70
Send "{Blind}#{Right}"
}
SnapUp(){
;CenterWindow("A")
;Send "{Blind}#{Up}"
;Sleep 70
Send "{Blind}#{Up}"
}
SnapDown(){
;SnapUp()
;Sleep 500
;WinGetPos &X, &Y, &W, &H, "A" ; xcoord ycoord width height activewindow
;Y := Y+H
;WinMove X, Y, W, H, "A"
Send "{Blind}#{Down}"
}
SnapDownTest(){
WinGetPos &X, &Y, &W, &H, "A" ; xcoord ycoord width height activewindow
Y := Y+H
WinMove X, Y, W, H, "A"
}
SnapDownLeft(){
SnapLeft()
Sleep 70
Send "{Blind}#{Down}"
}
SnapUpLeft(){
SnapLeft()
Sleep 70
Send "{Blind}#{Up}"
}
SnapDownRight(){
SnapRight()
Sleep 70
Send "{Blind}#{Down}"
}
SnapUpRight(){
SnapRight()
Sleep 70
Send "{Blind}#{Up}"
}
MoveWindowToMonitor(xcoord, ycoord){
WinRestore "A"
WinMove xcoord, ycoord, 512, 512, "A"
DllCall("SetCursorPos", "int", xcoord, "int", ycoord)
Sleep 50
WinMaximize "A"
}
FocusMonitor(xcoord, ycoord){
DllCall("SetCursorPos", "int", xcoord, "int", ycoord)
MouseGetPos(,, &WinUMID)
WinActivate(WinUMID)
}
CenterMouseOnActiveWindow(){
 Sleep 01
 CoordMode "Mouse", "Screen"
 WinGetPos &winTopL_x, &winTopL_y, &width, &height, "A"
 winCenter_x := winTopL_x + width/2
 winCenter_y := winTopL_y + height/2
 DllCall("SetCursorPos", "Int", winCenter_x, "Int", winCenter_y)
}
AltClip(action){
}


;RC Functions
endCall(){
ib := InputBox("Type the numbers 987 to end the call")
if (ib.value = "987" and ib.result = "OK"){
Send("^!+#{f4}")
}
}
rcFocus(){
CoordMode "Mouse", "Window"
WinActivate("ahk_exe softphone.exe")
MouseMove 60, 45
}
rcStatusScreen(){
CoordMode "Mouse", "Window"
WinActivate("ahk_exe softphone.exe")
Click 60, 45
}
!Home::
numpadIns & numpadSub::{
rcStatusScreen()
Sleep 50
Click 60, 280
}
!End::
numpadIns & numpadAdd::{
rcStatusScreen()
Sleep 50
Click 60, 370
}
numpadIns & numpadEnter::{
rcStatusScreen()
Sleep 50
Click 290, 460
}