topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Friday March 29, 2024, 7:49 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: IDEA: extract archive and change file extension  (Read 8043 times)

nudone

  • Cody's Creator
  • Columnist
  • Joined in 2005
  • ***
  • Posts: 4,119
    • View Profile
    • Donate to Member
IDEA: extract archive and change file extension
« on: August 07, 2005, 03:37 PM »
i'm hoping to find time to try and figure this one out myself using AutoHotKey but i would be delighted if skrommel beat me to it (hint hint).

the idea is rather personal and perhaps wouldn't be of much use to many people without a little modification to the way the script works. here's the description...

i download (from www.absolutvision.com) royalty free images that are archived into a zip file before they are sent.

the files inside the zip archive are contained inside a folder called 'gallery' and are of the jpeg2000 format with the extension .jpf

i understand that autohotkey can accept files being dropped onto an autohotkey script .ahk file - whatever is dropped is passed on as arguments.

this makes me hope that a script could be wrote that would automatically extract the contents of one of these zip archives that contain the jpeg2000 files and then change their extension to .jpc instead of .jpf

the procedure would be that you drop the archive onto the autohotkey script icon and everything would automatically continue from there. the result being a 'gallery' folder containing .jpc files.

i appreciate that this a a specialised task but i believe that it would be handy for other uses if the script could be modified slightly. maybe a template mechanism could be achieved if you had a few scripts that changed file extensions in various ways. all you would need to do to quickly change the files would be to drop them onto the relevant autohotkey script icon. i imagine this could probably be done for changing the names of files also, maybe by numbering them or whatever.

i hope all that made some kind of sense.

(sorry about this, i thought there had been an error with the posting process so i've accidently posted this message twice - maybe mouser can delete one of them.)
« Last Edit: August 07, 2005, 04:04 PM by nudone »

skrommel

  • Fastest code in the west
  • Developer
  • Joined in 2005
  • ***
  • Posts: 933
    • View Profile
    • 1 Hour Software by skrommel
    • Donate to Member
Re: IDEA: extract archive and change file extension
« Reply #1 on: August 07, 2005, 04:33 PM »
 :) ZipOut - Extracts a dropped zip-file and renames the files' extensions.

Installation:
1: Download and install AutoHotKey from www.autohotkey.com.
2: Create a folder called ZipOut in your programs folder
3: Download www.freebyte.com/download/fbzpack.exe and extract the file FBZip.exe to the ZipOut folder.
4: Save the script below as ZipOut.ahk in the ZipOut folder.
5: Edit the settings at the top of the ZipOut.ahk-file.
6: Rightclick on the ZipOut.ahk and choose Compile script to make ZipOut.exe.
7: Create a shortcut to ZipOut.exe on your desktop.

To create other shortcuts with other folders and extensions, repeat steps 3-6.

Usage:
Drag and drop a zip-file onto the shortcut to extract it and rename the files.
Or just start the script or exe-file to have it ask for a zip-file.
 
Skrommel


;ZipOut.ahk
; Extracts a dropped zip-file and renames the files' extensions
;Skrommel @2005

;Settings
path=C:\Images
from=jpf
to=jpc
command=Explorer /e,%path%

;Script
SELECT:
If 1=
{
  FileSelectFile,zipfile,3,,Select the ZIP-file, ZIP-files (*.zip)
  If zipfile=
  {
    MsgBox,1,DriveZip,No file selected. Quit?
    IfMsgBox,OK
      ExitApp
    Goto,SELECT
  }
}
Else
  zipfile=%1%

RunWait,fbzip -e -p "%zipfile%" "%path%"

Loop,%path%\*.%from%,,1
{
  SplitPath,A_LoopFileFullPath,name,dir,ext,name_no_ext,drive
  FileMove,%A_LoopFileFullPath%,%dir%.%to%
}
If command<>
  Run,%command%
« Last Edit: August 07, 2005, 04:35 PM by skrommel »

nudone

  • Cody's Creator
  • Columnist
  • Joined in 2005
  • ***
  • Posts: 4,119
    • View Profile
    • Donate to Member
Re: IDEA: extract archive and change file extension
« Reply #2 on: August 08, 2005, 11:55 AM »
absolutely fantastic, skrommel, you are a star.

many many thanks.