RE: scripting BOMArchiveHelper possible ?
RE: scripting BOMArchiveHelper possible ?
- Subject: RE: scripting BOMArchiveHelper possible ?
- From: "Trudel, Gaetan" <email@hidden>
- Date: Wed, 11 Oct 2006 15:20:14 -0400
Thank you for the shell script idea,
I was also able to write an apple script template (below) that needs both
path names of the core services app and the file or folder to compress. I
keep the below script as a template and I change the comp variable depending
of the result of other parts of my script that take care of the target file
of folder to compress. I change the first part of the last line of the
script after testing if the the path name is a document file or a folder.
(When I say change, I mean programatically, of course)
tell application "Finder"
-- activate
set bom to
"WLAMTrudelG:System:Library:CoreServices:BOMArchiveHelper.app"
set comp to "WLAMTrudelG:Users:trudelg:Desktop:Temporaire"
open folder comp using application file bom
end tell
I was kind of happy to discover that dragging an already compressed file
(.cpgz) on the BOM app would decompress it, and that doing the same of an
uncompressed file or folder would compress it.
I don't mind to have a "strange" extension like .cpgz to end with because it
tells me that this was probably made from "my" application, I could change
it to .zip anyway but I like it as it is.
The tricky part was to follow up on the completion of the archive before to
send it by ftp. The UI for the app that I'm building is made with Revolution
(www.revolution.rev), I do as much as possible with this RAD (Rapid
Application Development Tool) and use apple script only for the parts that I
feel is a real shortcut to what I want to achieve. In this case, I was
struggling with the resource forks and BOM beautifully handles that !
Thanks again,
Gaetan Trudel
(514) 279-4571
Prepress Technical Adviser
Transcontinental Litho Acme
85 de Castelnau St. W.
Montreal, QC Canada
H2R 2W3
-----Original Message-----
From:
applescript-users-bounces+gaetan.trudel=email@hidden
[mailto:applescript-users-bounces+gaetan.trudel=email@hidden
ple.com] On Behalf Of Axel Luttgens
Sent: 11 octobre 2006 08:50
To: AppleScript Users
Subject: Re: scripting BOMArchiveHelper possible ?
On 5/10/06 22:51, Trudel, Gaetan wrote:
> Hello,
>
> I would like to know if BOMArchiveHelper on Mac OS 10.4.8 is scriptable.
>
> I think I could script the UI to zip or unzip files or folders but i
> would prefer to control the app directly.
>
> The app seems to be hidden in the OS and I can't see or add it into
> the Library list in Script Editor.
The app is located into:
/System/Library/CoreServices
But it doesn't seem have a dictionary (nor to be scriptable), so no wonder
if you can't add it to the Library list...
Now, it seems its executable may be invoked from a shell script, allowing
some kind of limited scriptability from within AppleScript (through a "do
shell script" command).
Some experiments from within Terminal.app, such as:
# cd to the executable's directory
cd /System/Library/CoreServices/BOMArchiveHelper.app/Contents/MacOS
# compress file "testfile" on my Desktop
# this creates file "testfile.cpgz" on my Desktop
./BOMArchiveHelper ~/Desktop/testfile
# uncompress the just created file
# this creates file "testfile 2" on my Desktop
./BOMArchiveHelper ~/Desktop/testfile.cpgz
tend to show that:
- compressed or uncompressed file is created in the same directory
as the orginal file
- the executable takes care for possible name conflicts
- the decision to compress or decompress a file seems to rely on an
inspection of the file's contents (very likely with the help of
the "file" command), not just on the file's extension
- various formats for compressed files seem to be handled
But I couldn't manage to force a compression format other than "cpgz".
(someone? ;-) )
> An OSAX or script addition ?
There are so many options already available through commands (and thus
through "do shell script") that an addition might just prove redundant.
For example, you could have a look at the man pages for "ditto", "gzip"
and "tar" and pick up the one best suited for your needs.
Moreover, under 10.4+, those commands handle (almost perfectly, unless your
files have ACLs) the metadata associated to files and folders, such as
Finder comments or labels.
HTH,
Axel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
nscontinental.ca
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden