Skip to content

Instantly share code, notes, and snippets.

@ap1969
Created January 17, 2024 22:11
Show Gist options
  • Save ap1969/0f7090ed7f6e2d61cfbd67c7676df5e6 to your computer and use it in GitHub Desktop.
Save ap1969/0f7090ed7f6e2d61cfbd67c7676df5e6 to your computer and use it in GitHub Desktop.
AutoIt script for a tray utility to edit clipboard entry backslashes to forwardslashes
#include <MsgBoxConstants.au3>
#include <TrayConstants.au3>
#include <misc.au3>
Opt("TrayMenuMode", 3)
Opt("TrayOnEventMode", 1)
HotKeySet ( "+!v" , "HitIt") ; SHIFT + ALT + V
BackgroundProcess()
Func BackgroundProcess()
TraySetToolTip("Clipboard Slashes")
TraySetIcon("shell32.dll", 243)
TrayCreateItem("Exit")
TrayItemSetOnEvent(-1, "ExitScript")
TraySetOnEvent($TRAY_EVENT_PRIMARYDOUBLE, "TrayEvent")
TraySetState($TRAY_ICONSTATE_SHOW)
While 1
Sleep(10)
WEnd
EndFunc
Func TrayEvent()
Switch @TRAY_ID
Case $TRAY_EVENT_PRIMARYDOUBLE
HitIt()
EndSwitch
EndFunc ;==>TrayEvent
Func ExitScript()
Exit
EndFunc ;==>ExitScript
Func HitIt()
; Get the clipboard contents
Local $sData = ClipGet()
; Turn \ to /
$output = StringRegExpReplace($sData, "\\", "/")
; Add new data to the clipboard.
ClipPut($output)
EndFunc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment