Created
October 14, 2025 11:47
-
-
Save JoeGlines/83930a2b08ebe8f44f3ea92b44d54ed3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Requires AutoHotkey v2.0.2+ | |
| #SingleInstance Force | |
| DetectHiddenWindows true | |
| ; Hotkey: Ctrl+Alt+O to organize desktop files | |
| ^!o:: { | |
| organizDesktopFiles() | |
| } | |
| ; Hotkey: Ctrl+Alt+S to take a screenshot and save with timestamp | |
| ^!s:: { | |
| takeTimestampedScreenshot() | |
| } | |
| ; Function to organize desktop files by extension | |
| organizDesktopFiles() { | |
| desktopPath := A_Desktop | |
| ; Create folders for organization | |
| folders := Map( | |
| "Images", ["jpg", "png", "gif", "bmp"], | |
| "Documents", ["pdf", "docx", "txt", "xlsx"], | |
| "Archives", ["zip", "rar", "7z"] | |
| ) | |
| ; Create folders if they don't exist | |
| for folderName, extensions in folders { | |
| fullPath := desktopPath . "\" . folderName | |
| if !DirExist(fullPath) { | |
| DirCreate(fullPath) | |
| } | |
| } | |
| ; Move files to appropriate folders | |
| Loop Files, desktopPath . "\*.*" { | |
| fileExt := SubStr(A_LoopFileExt, 1) ; Get extension | |
| for folderName, extensions in folders { | |
| for index, ext in extensions { | |
| if (fileExt = ext) { | |
| destPath := desktopPath . "\" . folderName . "\" . A_LoopFileName | |
| try { | |
| FileMove(A_LoopFileFullPath, destPath, 1) | |
| } catch { | |
| ; File might be in use, skip it | |
| } | |
| break | |
| } | |
| } | |
| } | |
| } | |
| MsgBox("Desktop organized!") | |
| } | |
| ; Function to take screenshot with timestamp | |
| takeTimestampedScreenshot() { | |
| ; Create screenshots folder if it doesn't exist | |
| screenshotFolder := A_MyDocuments . "\Screenshots" | |
| if !DirExist(screenshotFolder) { | |
| DirCreate(screenshotFolder) | |
| } | |
| ; Generate timestamp filename | |
| timestamp := FormatTime(, "yyyyMMdd_HHmmss") | |
| fileName := screenshotFolder . "\Screenshot_" . timestamp . ".png" | |
| ; Take screenshot using Windows Snipping Tool | |
| Run("snippingtool /clip") | |
| Sleep(500) | |
| ; Wait for clipboard to contain image | |
| if ClipWait(2, 1) { | |
| ; Save clipboard image | |
| try { | |
| ; Use PowerShell to save clipboard image | |
| psCommand := 'Add-Type -AssemblyName System.Windows.Forms;' | |
| psCommand .= '$img = [Windows.Forms.Clipboard]::GetImage();' | |
| psCommand .= '$img.Save("' . fileName . '", [System.Drawing.Imaging.ImageFormat]::Png)' | |
| RunWait('powershell.exe -Command "' . psCommand . '"', , "Hide") | |
| MsgBox("Screenshot saved: " . fileName) | |
| } catch as err { | |
| MsgBox("Failed to save screenshot: " . err.Message) | |
| } | |
| } else { | |
| MsgBox("No screenshot taken") | |
| } | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment