The macosxhints Forums

The macosxhints Forums (http://hintsforums.macworld.com/index.php)
-   The Coat Room (http://hintsforums.macworld.com/forumdisplay.php?f=8)
-   -   Have Applescript, will travel... (http://hintsforums.macworld.com/showthread.php?t=76158)

cwtnospam 08-07-2007 12:54 PM

Zalister, have you written a script for fazstp's compressed archive? I'm curious to see if my solution is different from others. :)

mark hunte 08-07-2007 01:28 PM

Sorry no disrespect to NovaScotian who has taught me a lot ;)

But his script in post #37 did not work, that is why I posted a corrected one

The reason the script did not work was:
Code:

set Fldr to choose folder
should have been
Code:

set F to choose folder
The as alias list was not needed, and was not broken down in to items later on, which is what the script wants,( it maybe a bug, in how this is handled???).
But with or without the alias list in place, if you use the line:
Code:

tell application "GraphicConverter" to set file iptc of (onePic as alias) to {Cmt} -- set it with GC
(note the as alias)
it works. In my script I did it slightly different but it has the same result

The other part that will give bad results or not write the IPTC (even though it looks like it has in the event log) is the class of the text.
Code:

set Cmt to («class ktxt» of ((comment of onePic as string) as record)) -- get the comment from the Finder
For it to work the class has to be «class ktxt» and then a record. I will not even pretend to understand why and it was Jacques who showed me this class trick over on bbs.applescript.net But it's the only way I have found to get the expected results.

NovaScotian 08-07-2007 02:15 PM

So several things are clear:

1) Schneb thanked the wrong person: Mark's version was the winner and clearly the one that Schneb must have used. Credit where it is due. :)

2) My script should have read (now thoroughly tested): :rolleyes:

Code:

set Fldr to choose folder
tell application "Finder"
        set Pics to files of entire contents of Fldr -- digs down through enclosed folders
        set tKinds to {"GIF document", "GIF Image", "JPEG document", "JPEG Image", "PNG document", "TIFF document", "TIFF Image", "Adobe Photoshop JPEG file"} -- should include your photos
        repeat with onePic in Pics -- iterate through the pics
                if kind of onePic is in tKinds then
                        set Cmt to comment of onePic -- get the comment from the Finder
                        tell application "GraphicConverter" to set file iptc of (onePic as alias) to {comment:Cmt} -- set it with GC
                end if
        end repeat
end tell

which worked perfectly for me without Mark's "kext" approach.

3) To check the results:

Code:

set Fldr to choose folder
set com to {}
tell application "Finder"
        set Pics to files of entire contents of Fldr -- digs down through enclosed folders
        set tKinds to {"GIF document", "GIF Image", "JPEG document", "JPEG Image", "PNG document", "TIFF document", "TIFF Image", "Adobe Photoshop JPEG file"} -- should include your photos
        repeat with onePic in Pics -- iterate through the pics
                if kind of onePic is in tKinds then
                        tell application "GraphicConverter" to set end of com to item 1 of (get file iptc of (onePic as alias))
                end if
        end repeat
end tell
com


Jay Carr 08-09-2007 03:46 PM

Pardon to all. I neglected to mention that I was heading out of town for a week and would not even get a chance to start to script until I get back. People keep telling me I need to be more forthright about my scheduling... One of these days I'll learn. Sorry again.

That said, I've been looking into learning some of the UNIX commands to get this done, and I'm working with droplets in AppleScript Studio to try and get it done. It will probably take a few days, but the wife is still out of town and I have nothing to do on Friday night so...maybe I'll be done quickly. Who knows.

Again, apologies, but I'm back and I'm going to start working on it.

fazstp 08-13-2007 08:33 AM

I uploaded a dmg backup script.

DMG Backup

Thanks to cwtnospam for the hdiutil scripting.

Sorry Zalister, I had to do some Applescripting for another project and once I got the hdiutil method from cwtnospam it was a short leap to the backup script I originally asked you for.

schneb 08-13-2007 01:38 PM

Quote:

Originally Posted by NovaScotian (Post 399269)
Schneb thanked the wrong person: Mark's version was the winner and clearly the one that Schneb must have used. Credit where it is due.

To avoid thread hijacking, I started another. There I gave credit to those that deserved it. Thanks to both of you, I have now successfully annotated all of my 14,000 photos with IPTC comments. It even searches in iPhoto '08! Another advantage to that great script, is that it choked if there was no Spotlight Comment, which forced me to make sure all photos had a comment. It also choked if I had inadvertently saved a JPEG file as a PSD file (hence acting as if it were a corrupt file). I had about 20 of these, and the script compelled me to fix these renegades.

Again, a big THANK YOU to both Mark Hunte and NovaScotian!

Jay Carr 08-13-2007 06:56 PM

fazstp -- Don't worry about it. I'm beginning to think I should just figure out a useful script myself and execute on it. These forums don't work at the same glacial pace that I do :).

fazstp 08-13-2007 10:13 PM

Quote:

Originally Posted by Zalister (Post 400816)
These forums don't work at the same glacial pace that I do :).

Have you found yourself working any faster as a result of global warming?

(Sorry :o glacier joke)

Jay Carr 08-14-2007 02:08 AM

No, but every now and then I feel my will to work on scripts evaporating into thin air.

(Two can play at that game ;).)


All times are GMT -5. The time now is 01:06 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.