; ; AutoHotkey Version: 1.1.27.07 ; Language: English ; Platform: WinXP/NT ; Author: cects.com ; ; Script Ver 1.03 ; Script Function: ; Download gif, jpg, jpeg, and png files with wget to a folder specified by user ; Appends downloaded file's URL and date to a logfile named photolog.csv ; Reference: https://autohotkey.com/docs/commands/OnClipboardChange.htm ; Remove anything after .jpg, .png, or .gif in filename ; Reference: https://autohotkey.com/board/topic/104702-remove-all-the-text-after-the-specific-character/ ; Enter the Dir Path for the wget (wget.exe or wget64.exe) executable before using ; -------------------------------------------------------------------- #include C:\path\to\wget folder\ ;---------------------------------------------------------------------- ; Optional - uncomment and enter the full path to use an icon for the script ; Must specify directory for icon since working directory is changed below ; --------------------------------------------------------------------- ; menu, tray, icon, C:\full path\to\iconfile.ico, 1 ; --------------------------------------------------------------------- ;Allows the script to start with empty clipboard clipboard = ; Empty the clipboard #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases SendMode Input ; Recommended for new scripts due to its superior speed and reliability InputBox, FolderSave, Enter Folder path to Save Images, Default folder used if not changed., ,500, 120,,,,,%A_WorkingDir% If FolderSave <> SetWorkingDir %FolderSave% ; Ensures a consistent starting directory. Else FolderSave = %A_WorkingDir% TrayTip, Copy Photos to File, Copy URLs to clipboard`nSaving Files to:%FolderSave%`nNon-Graphic Files Ignored menu, tray, tip, Copy URL to clipboard to download png`, jpg`, and gifs `nSaving to:%FolderSave% #Persistent ; the ClipChanged function is not called when the script first starts; only when the content of the Clipboard changes OnClipboardChange("ClipChanged") return ClipChanged(Type) { if A_IsSuspended ; Script is suspended, do nothing when clipboard changes return if A_IsPaused ; Script is paused, do nothing when clipboard changes return IfInString, clipboard, .jpg { clipboard := SubStr(clipboard, 1, InStr(clipboard, ".jpg") + 3) gosub, copyphoto return } IfInString, clipboard, .jpeg { clipboard := SubStr(clipboard, 1, InStr(clipboard, ".jpeg") + 4) gosub, copyphoto return } IfInString, clipboard, .png { clipboard := SubStr(clipboard, 1, InStr(clipboard, ".png") + 3) gosub, copyphoto return } IfInString, clipboard, .gif { clipboard := SubStr(clipboard, 1, InStr(clipboard, ".gif") + 3) gosub, copyphoto return } If clipboard not contains .gif,.png,.jpg,.jpeg { gosub, nothing return } } copyphoto: Run %comspec% /c "wget.exe --max-redirect=0 --no-check-certificate %clipboard%" FileAppend, %clipboard%`,%A_YYYY%-%A_MM%-%A_DD%`n, photolog.csv ;comment out below if desired to suppress post download traytip TrayTip, Clipboard data, %clipboard%`nSaved to: %FolderSave% return nothing: TrayTip, Invalid photo extension, Clipboard Data:`n%clipboard%`nClipboard data doesn't contain jpg`, jpeg`, gif`, or png, , 16 return ; "--max-redirect=0" option - disable HTTP redirects