Windows scripts

This commit is contained in:
OctoSpacc 2023-11-10 13:01:09 +01:00
parent 8773ae26e2
commit ca74402253
9 changed files with 133 additions and 0 deletions

View File

@ -0,0 +1,43 @@
; <https://www.autohotkey.com/boards/viewtopic.php?t=62751>
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#SingleInstance force
TaskbarMove(A_Args[1])
TaskbarMove(p_pos) {
label:="TaskbarMove_" p_pos
WinExist("ahk_class Shell_TrayWnd")
SysGet, s, Monitor
if (IsLabel(label)) {
Goto, %label%
}
return
TaskbarMove_Top:
TaskbarMove_Bottom:
WinMove(sLeft, s%p_pos%, sRight, 0)
return
TaskbarMove_Left:
TaskbarMove_Right:
WinMove(s%p_pos%, sTop, 0, sBottom)
return
}
WinMove(p_x, p_y, p_w="", p_h="", p_hwnd="") {
WM_ENTERSIZEMOVE:=0x0231
WM_EXITSIZEMOVE :=0x0232
if (p_hwnd!="") {
WinExist("ahk_id " p_hwnd)
}
SendMessage, WM_ENTERSIZEMOVE
;//Tooltip WinMove(%p_x%`, %p_y%`, %p_w%`, %p_h%)
WinMove, , , p_x, p_y, p_w, p_h
SendMessage, WM_EXITSIZEMOVE
}

View File

@ -0,0 +1,16 @@
#NoEnv
SetBatchLines -1
ListLines Off
#NoTrayIcon
TabletModeController_SetMode(TabletModeController, _TABLETMODESTATE, _TMCTRIGGER := 4) {
return DllCall(NumGet(NumGet(TabletModeController+0),4*A_PtrSize), "Ptr", TabletModeController, "UInt", _TABLETMODESTATE, "UInt", _TMCTRIGGER)
}
ImmersiveShell := ComObjCreate("{C2F03A33-21F5-47FA-B4BB-156362A2F239}", "{00000000-0000-0000-C000-000000000046}")
TabletModeController := ComObjQuery(ImmersiveShell, "{4fda780a-acd2-41f7-b4f2-ebe674c9bf2a}", "{4fda780a-acd2-41f7-b4f2-ebe674c9bf2a}")
TabletModeController_SetMode(TabletModeController, A_Args[1])
ObjRelease(TabletModeController), TabletModeController := 0
ObjRelease(ImmersiveShell), ImmersiveShell := 0

View File

@ -0,0 +1 @@
"C:\Program Files (x86)\EarnApp\net_updater32.exe" --start-service win_earnapp.com

View File

@ -0,0 +1,2 @@
#Requires AutoHotkey v2.0
#0:: Send "{Click Right}"

View File

@ -0,0 +1,28 @@
#Requires AutoHotkey v2.0
Persistent
; <https://www.autohotkey.com/boards/viewtopic.php?t=38761>
HotKey("LButton", LeftClickActions)
LeftClickActions(key)
{
Send "{Click Right}"
InfoTooltip(false)
HotKey("LButton", "Off")
}
HotKey("LButton", "Off")
OnMessage(0x404, AHK_NOTIFYICON)
AHK_NOTIFYICON(wParam, lParam, uMsg, hWnd)
{
if (lParam = 0x201) ; WM_LBUTTONDOWN
{
HotKey("LButton", "On")
InfoTooltip(true)
}
}
InfoTooltip(status)
{
ToolTip (status ? "Right click action is temporarily active." : "Right cick action is now disabled.")
SetTimer () => ToolTip(), -1000
}

View File

@ -0,0 +1,11 @@
$Positions = New-Object 'system.collections.generic.dictionary[int,int]'
$Positions[0] = 3 # Left to Bottom
$Positions[3] = 0 # Bottom to Left
$Path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects3"
$Name = "Settings"
$Settings = (Get-ItemProperty -Path $Path -Name $Name).Settings
$Settings[12] = $Positions[$Settings[12]]
Set-ItemProperty -Path $Path -Name $Name -Value $Settings
Stop-Process -Name "explorer" # Restart explorer

View File

@ -0,0 +1,5 @@
#Requires AutoHotkey v2.0
ScreenWidth := SysGet(78)
IsCompactDevice := (ScreenWidth < 640)
Run(A_ScriptDir . "\ArgSetTabletMode.ahk " . IsCompactDevice)
Run(A_ScriptDir . "\ArgMoveTaskbar.ahk " . (IsCompactDevice ? "Left" : "Bottom"))

View File

@ -0,0 +1,3 @@
#Requires AutoHotkey v2.0
<^>!'::`
<^>!ì::~

View File

@ -0,0 +1,24 @@
; <https://stackoverflow.com/a/44498124>
#NoEnv
SetBatchLines -1
ListLines Off
#NoTrayIcon
TABLETMODESTATE_DESKTOPMODE := 0x0
TABLETMODESTATE_TABLETMODE := 0x1
TabletModeController_GetMode(TabletModeController, ByRef mode) {
return DllCall(NumGet(NumGet(TabletModeController+0),3*A_PtrSize), "Ptr", TabletModeController, "UInt*", mode)
}
TabletModeController_SetMode(TabletModeController, _TABLETMODESTATE, _TMCTRIGGER := 4) {
return DllCall(NumGet(NumGet(TabletModeController+0),4*A_PtrSize), "Ptr", TabletModeController, "UInt", _TABLETMODESTATE, "UInt", _TMCTRIGGER)
}
ImmersiveShell := ComObjCreate("{C2F03A33-21F5-47FA-B4BB-156362A2F239}", "{00000000-0000-0000-C000-000000000046}")
TabletModeController := ComObjQuery(ImmersiveShell, "{4fda780a-acd2-41f7-b4f2-ebe674c9bf2a}", "{4fda780a-acd2-41f7-b4f2-ebe674c9bf2a}")
if (TabletModeController_GetMode(TabletModeController, mode) == 0)
TabletModeController_SetMode(TabletModeController, mode == TABLETMODESTATE_DESKTOPMODE ? TABLETMODESTATE_TABLETMODE : TABLETMODESTATE_DESKTOPMODE)
ObjRelease(TabletModeController), TabletModeController := 0
ObjRelease(ImmersiveShell), ImmersiveShell := 0 ; Can be freed after TabletModeController is created, instead