• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Script won't run consistently
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Script won't run consistently


  • Subject: Re: Script won't run consistently
  • From: "koenig.yvan" <email@hidden>
  • Date: Thu, 10 Jul 2014 21:58:50 +0200

Le 09/07/2014 à 20:40, S. J. Cunningham <email@hidden> a écrit :

I believe Applescript might be the hard way to do this. Just use the finder to search for all files with the chosen extension and then select all the found items and option-command-drag to the alias folder.  Done.

Steve Cunningham

On Jul 9, 2014, at 11:38 AM, Rob Lewis wrote:

My wife’s old iBook is strewn with AppleWorks files all over her user account and I want to collect them by creating a folder of aliases to them.

The script is pretty straightforward:
—Prompt the user for a folder to put the aliases in, and a starting folder to search
—Recursively search the folder and its subfolders (using recursive calls in the code)
—If a file has a “cwk” extension and is not an alias, create an alias to it in the chosen folder

The problem is, I can’t get consistent results on successive runs. One time, it quit with a “Finder can’t get…” error (so I wrapped that in a try block). The last run ended with “Apple Event timeout”.

Currently the target folder for the aliases is on a FireWire-connected external drive. If it went to sleep, could that cause the timeout? Should I wrap the whole thing in a ridiculously long “with timeout of…” block?

Also this is my first attempt to use AppleScript’s “log” command. It appears to only work if the Event Log tab is selected when you start the script. Is that how it’s supposed to work? I’ve been a little wary of doing that (choosing the Result tab instead), worried that with thousands of files a huge log might cause other problems. Is this a concern?

Also, would it be better to search for creator type “BOBO” rather than file extension “cwk”?

Any thoughts appreciated.


Hello

(1) I never got the original question posted by Rob Lewis.

(2) Here is a signature helping to identify ClarisWorks/AppleWorks files.
The bytes at offset 00, 01, 02, 03 are describing the version number and they aren’t useful here.
Bytes at offset 04, 05, 06, 07 are the letters BOBO ($42, $4F, $42, $4F)
Sot it's sufficient to read these four bytes with the good old read command available in Standard Additions.

set aFile to "path:to:the:file:to:identify"
if (read file aFile from 5 for 4) is "BOBO" then
display dialog "The file “" & aFile & "” is a ClarisWorks/AppleWorks one."
else
display dialog "The file “" & aFile & "” is not a ClarisWorks/AppleWorks one."
end if

Yvan KOENIG (VALLAURIS, France) jeudi 10 juillet 2014 21:57:54



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Script won't run consistently (From: Rob Lewis <email@hidden>)
 >Re: Script won't run consistently (From: "S. J. Cunningham" <email@hidden>)

  • Prev by Date: Re: Script won't run consistently
  • Next by Date: Re: Script won't run consistently
  • Previous by thread: Re: Script won't run consistently
  • Next by thread: Re: Script won't run consistently
  • Index(es):
    • Date
    • Thread