Request for a script


My name is Hans, I’m a technical translator for Dutch, new to this forum and to Applescript.

I’d appreciate it if somebody could write a script for me that:

  1. Renames a package on the Desktop with the extension .sdlppx to .zip (or directly open it as a zip folder, if that is possible with Applescript).

  2. Extracts the contents of the folder nl-NL in that package to the Desktop.

What would be the easiest way to make it possible to execute this script on a .sdlppx placed on the Desktop, either by a keyboard shortcut, by double-clicking it or via the context menu?

Thanks very much!


SDL files are just zip archives indeed and you can send them directly to unzip like xlsx files.

set theFile to posix path of (choose file) --file to exctract
set theFolder to posix path of (choose folder) --choose a folder to extract
do shell script "cd " & quoted form of theFolder & " && unzip " & quoted form of theFile 

Thanks for that. I’ve opened it in the Script Editor and saved it as an Application on the Desktop. When I double-click it and open the SDLPPX package, I get the message:

warning: /users/hans/desktop/abcd_nl_doc.sdlppx appears to use backslashes as path separators.

How can I avoid that message?

Is it also possible to extract only the nl-NL (target language) folder?

About the use of the little application: place it in the Apps folder and associate SDLPPX to it, to have the nl-NL folder automatically unpacked?

Yes, unzip it to an temporary folder then move the nl_NL part to the desktop and at last remove the temporary items. To suppress the warning redirect the error message to /dev/null

do shell script "cd " & quoted form of theFolder & " && unzip " & quoted form of theFile  & " 2>/dev/null"

According to my understanding, and assuming that folder “nl_NL” is a top-level object in the archive, it should be possible to extract the folder and its contents directly to the desktop like this:

set archivePath to POSIX path of (choose file default location (path to desktop)) -- file from which to extract
do shell script ("unzip " & quoted form of archivePath & " 'nl_NL/*' -d " & quoted form of POSIX path of (path to desktop))