Skip to main content
Inspiring
October 7, 2015
Answered

Unzip files

  • October 7, 2015
  • 1 reply
  • 1477 views

Is this possible to unzip the file using indesign script

This topic has been closed for replies.
Correct answer Ronald63

Hello,

If you are on MacOS you can use a terminal command :

JS Snippet :

function zip(file){

    var mScript = "/~/Desktop/zip.scpt";

    var mResult = app.doScript(mScript,ScriptLanguage.applescriptLanguage,file);

    return mResult

}

zip.scpt

set myFile to item 1 of arguments

try

    set mZip to do shell script "zip -r archive_name.zip " & quoted form of POSIX path of myFile

on error errStr number errorNumber

    set mZip to 0

end try

return mZip

see : https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/zip.1.html

1 reply

Inspiring
October 7, 2015

I can't find anything in the DOM so my guess is no.

However, you can do it with conventional JavaScript, example here:

javascript - Unzipping files - Stack Overflow

Otherwise you could make a batch file to unzip and run the InDesign JavaScript to do whatever else you had planned.

Brett

Inspiring
October 7, 2015

Thanks Brett

Ronald63Correct answer
Legend
October 7, 2015

Hello,

If you are on MacOS you can use a terminal command :

JS Snippet :

function zip(file){

    var mScript = "/~/Desktop/zip.scpt";

    var mResult = app.doScript(mScript,ScriptLanguage.applescriptLanguage,file);

    return mResult

}

zip.scpt

set myFile to item 1 of arguments

try

    set mZip to do shell script "zip -r archive_name.zip " & quoted form of POSIX path of myFile

on error errStr number errorNumber

    set mZip to 0

end try

return mZip

see : https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/zip.1.html