Skip to content

Instantly share code, notes, and snippets.

@JoeGlines
Last active July 23, 2024 03:54
Show Gist options
  • Save JoeGlines/f8f82c0c9377570edadfad6e67f96118 to your computer and use it in GitHub Desktop.
Save JoeGlines/f8f82c0c9377570edadfad6e67f96118 to your computer and use it in GitHub Desktop.
;*******************************************************
; Want a clear path for learning AutoHotkey; Take a look at our AutoHotkey Udemy courses. They're structured in a way to make learning AHK EASY
; Right now you can get a coupon code here: https://the-Automator.com/Learn
;*******************************************************
;~ ;******Wrap Right align*************.
^!w:: ; Wraps selected text in right align
Store:=Clipboard_Backup_Copy_Selected_Text()
ClipBoard:=StrReplace(Clipboard,"`n","`n<p style='text-align:right'>") ;prepend
Clipboard:=StrReplace(Clipboard,"`r","</p>`r") ;postpend
Clipboard := "<p style='text-align:right'>" Clipboard "</p>" ; wrap with comments tag
Send, ^v
Sleep, 150
Clipboard := Store
Return
;******for clipboard manipulation and restoring original clipboard*********************************
Clipboard_Backup_Copy_Selected_Text(){
ClipBack := Clipboard ;Store full version of Clipboard
clipboard = ; Empty the clipboard
SendInput, ^c
ClipWait, 1
If ErrorLevel { ;Added errorLevel checking
Clipboard:=ClipBack ;Restore Clipboard
MsgBox, No text was sent to clipboard
Return
}
Return ClipBack
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment