Code: Select all
[size=85]Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus
OriginalFolder = D:\ebookscanner\17-7-21\teckthought\experiment\original
ShortcutFolder = D:\ebookscanner\17-7-21\teckthought\experiment\shortcutsoriginal
Return
; End of the autoexecute section.
#IfWinActive, shortcutsoriginal ahk_exe Explorer.exe
^0:: ; Press Ctrl + 0 to open the original picture.
FirstBackSlashPos := 0
SEND, ^c ; Copy the picture's filepath.
StringGetPos, FirstBackSlashPos, Clipboard, \, R ; Get the position of the first right side backslash.
StringRight, FileName, Clipboard, % StrLen(Clipboard) - FirstBackSlashPos ; Get the characters on the right side of this backslash (including the backslash).
Run, % OriginalFolder . FileName ; Open the Original file.
Return
; ‘Original’ in this WinTitle seems to be casesensitive.
#IfWinActive, original ahk_exe Explorer.exe
$Delete::
FirstBackSlashPos := 0
SEND, ^c ; Copy the selected file.
StringGetPos, FirstBackSlashPos, Clipboard, \, R ; Get the position of the first right side backslash.
StringRight, FileName, Clipboard, % StrLen(Clipboard) - FirstBackSlashPos ; Get the characters on the right side of this backslash (including the backslash).
MsgBox, 4, Delete shortcut?, Do you want to delete the shortcut (%ShortcutFolder%%FileName%) and the original file?
IfMsgBox, Yes
{
FileDelete, % ShortcutFolder . FileName ; Delete the shortcut file.
SEND, {Delete} ; Command Windows to delete the selected file.
WinWaitActive, ahk_class #32770 ahk_exe explorer.exe, , 2
If ErrorLevel
Return
SEND, {Enter} ; Dismiss the MsgBox from Windows by pressing Yes: Delete selected file.
} Else {
SEND, {Delete} ; Command to delete the selected file.
}
Return
#IfWinActive[/size]