DonationCoder.com Software > Finished Programs
DONE: One Click File Extension Changer
pulphero:
In my work, I often change file extensions from one to the other, and then back again, and then back again, and so on.
I'd love to have a little AHK script that would do this:
If I select a file with an .epub extension in Explorer and press Ctrl+`, the file extension will change to .zip.
If I select a file with a .zip extension in Explorer and press Ctrl+`, the file extension will change to .epub.
I put in epub/zip and the hotkey Ctrl+` as examples. I figure a user would be able to adjust those things as needed.
Thanks!
skwire:
Here's one way to do it via AutoHotkey. It should be pretty easy to follow so modify it as necessary.
--- Code: Autohotkey ---^`::{ ; Get the highlighted selection onto the clipboard and crack its path. Send, ^c myFile := Clipboard SplitPath, myFile, OutFileName, OutDir, OutExtension, OutNameNoExt, OutDrive ; Determine current and new extensions. If ( OutExtension = "epub" ) { myExtension := "zip" } Else If ( OutExtension = "zip" ) { myExtension := "epub" } ; Check that the destination file doesn't already exist. If ! FileExist( OutDir . "\" . OutNameNoExt . "." . myExtension ) { ; Destination file does not exist so rename existing file with new extension. FileMove, % myFile, % OutDir . "\" . OutNameNoExt . "." . myExtension } Else { ; Destination file exists. Warn user and do nothing. MsgBox, Destination file already exists. Aborting... }}Return
pulphero:
Thanks, but no joy. I saved the code as "ExtSwitch.ahk", double-clicked that file, selected an .epub file, and pressed Ctrl + ` (the hotkey). Nothing happened; no error message, either.
skwire:
Thanks, but no joy. I saved the code as "ExtSwitch.ahk", double-clicked that file, selected an .epub file, and pressed Ctrl + ` (the hotkey). Nothing happened; no error message, either.-pulphero (September 13, 2016, 07:05 PM)
--- End quote ---
I think I looked at your hotkey wrong and substituted an apostrophe for the backtick you had. Please recopy the code above and try it again.
Ath:
Just tried it and it seems to work just fine.
It might take your Explorer a few seconds to refresh the list of files though, maybe a Ctrl-R/F5 press (refresh) might fix that?
Navigation
[0] Message Index
[#] Next page
Go to full version