davidfromsomerville

Q: How can I tell the type of an Appleworks file without opening it?

At my school we used Appleworks a lot. We have a lot of files built up in the format.

 

I want to develop the simplest workflow I can for migration.

 

I think that means knowing what files I can open with Pages (DR), what with Numbers (SS) and what with EazyDraw (DR).

 

It's easy enough to make a smartfolder that will hold all my appleworks folders, but how can I sort the types of Appleworks files without opening each one in Appleworks and manually sorting?

Mac OS X (10.6)

Posted on Dec 15, 2011 1:30 PM

Close

Q: How can I tell the type of an Appleworks file without opening it?

  • All replies
  • Helpful answers

  • by Roger Wilmut1,

    Roger Wilmut1 Roger Wilmut1 Dec 15, 2011 2:37 PM in response to davidfromsomerville
    Level 9 (78,576 points)
    iTunes
    Dec 15, 2011 2:37 PM in response to davidfromsomerville

    You can't. The only method I can think of is to use AppleScript to open each file in a folder in turn, and then use the 'document kind' attribute to move it to a different folder. This is a roughout of how it might work - it's a starting point, not a finished script:

     

    tell application "Appleworks 6"

    if the document kind of document 1 contains "database" then

    set nm to the name of document 1

    close document 1

    end tell

     

    tell application "Finder"

    move file nm of folder (.... path) to folder "databases" of folder "Desktop" of folder......

    end tell

     

    If you used a repeat function to move through the list of files and open each one in turn this would pull the databases out: you could do the same with the other types, or do multiple ifs for the various types; you might get difficulties with the number of files if you are moving some out. This is something which is going to take quite a lot of work to perfect, so depending on the number of files you have it might well be quicker to do it manually.

  • by fruhulda,

    fruhulda fruhulda Dec 15, 2011 9:52 PM in response to davidfromsomerville
    Level 6 (15,126 points)
    Dec 15, 2011 9:52 PM in response to davidfromsomerville

    Got to Yvan's page https://public.me.com/koenigyvan and go Scripts_for_Appleworks > which_kind_of_AWdoc.zip

    It will tell you which type of AW document you have.

  • by Roger Wilmut1,

    Roger Wilmut1 Roger Wilmut1 Dec 15, 2011 11:48 PM in response to fruhulda
    Level 9 (78,576 points)
    iTunes
    Dec 15, 2011 11:48 PM in response to fruhulda

    I did wonder whether Yvan had something up his sleeve, though as you have to drag one file at a time to the script it's actually no faster than just opening the file and closing it again - useful if you can't run Appleworks, though.

  • by davidfromsomerville,

    davidfromsomerville davidfromsomerville Dec 16, 2011 10:09 AM in response to Roger Wilmut1
    Level 1 (0 points)
    Dec 16, 2011 10:09 AM in response to Roger Wilmut1

    thanks much - that looks like a very helpful start, especially the idea that once the file is open it's possible to read an attribute called "document kind" (if I'm reading you correctly)

     

    I'm not versed in applescript, but I have a colleague who can probably help me to move forward. Since I have 1078 files, I'm definitely looking for a way to automate the process.

     

    If you'll pardon the script newb questions:

    • Am I reading this right? your approach takes each file, determines its kind, then moves it into a folder for that type. (Next step would be to process all files in each folder with the appropriate application)
    • Ideally I'd like to make all the conversions in situ to preserve the organization of the existing file structure. would the following approach be feasible?
      • use your approach to add some externally readable marker, say, a tag, instead of movng the file;
      • then open each tagged file in [pages,eazydraw,numbers] as per tag;
      • instruct [pages,eazydraw.numbers] to save to the folder for the current .cwk file
  • by Roger Wilmut1,

    Roger Wilmut1 Roger Wilmut1 Dec 16, 2011 10:19 AM in response to davidfromsomerville
    Level 9 (78,576 points)
    iTunes
    Dec 16, 2011 10:19 AM in response to davidfromsomerville

    The first stage would be to use the 'repeat' function to carry out the process on each of the files in any one folder. The script would open each file and determine its type.

     

    Trying to move the file would mess up the 'repeat', so it's probably best to append (DB), (SS), (WP) etc to the filename - probably the best way to do this is to save each file with this amended name in another folder.

     

    When the process is complete you could then use AppleScript to move files into further folders depending on the filename containing (DB) etc.

     

    All this wouldn't be any faster than doing it manually, but you could leave it to get on with it while you had a cup of coffee.

     

    Whether you can subsequently instruct Pages or EazyDraw to open and save as a new version in yet another folder depends on what command are available in AppleScript to each  program. EazyDraw appears not to be scriptable.