Loading ...
Sorry, an error occurred while loading the content.

Re: New to WPMac, Old WPDOS user

Expand Messages
  • John Rethorst
    ... valid ... I don t know about a nice one, but try this. Save as an applet, not showing startup screen: to run display dialog Drop a file on me to set its
    Message 1 of 10 , Feb 17, 2005
    • 0 Attachment
      --- In wordperfectmac@yahoogroups.com, Smokey Ardisson
      <alqahira@m...> wrote:

      > one
      > thing I have noticed is that WP-Mac requires documents to have
      valid
      > Macintosh type codes (.WP6 or WPPC for WP6 docs), and depending on
      > how the WP-DOS files are arriving on your Mac, the type codes might
      > not be getting set. John R. can probably whip up a nice
      > AppleScript…

      I don't know about a nice one, but try this. Save as an applet, not
      showing startup screen:

      to run
      display dialog "Drop a file on me to set its creator " & ¬
      "to "WPC2" and its type to "WPPC"." buttons ¬
      {"OK"} default button 1 with icon note
      end run

      to open {theDrop}
      set dropInfo to info for theDrop

      if folder of dropInfo then
      display dialog "Please drop a file on me, not" & ¬
      "a folder." buttons {"OK"} default button 1 ¬
      with icon stop
      return
      end if

      tell application "Finder"
      try
      set creator type of theDrop to "WPC2"
      set file type of theDrop to "WPPC"
      on error m number n
      display dialog "Error " & (n as string) & ":" & ¬
      return & return & m buttons {"OK"} ¬
      default button 1 with icon caution
      end try
      end tell
      end open
    • Smokey Ardisson
      ... FYI, I had Script Editor complain about the quotes around WPC2 and WPPC in the above on run block; I changed them to single quotes and the script compiled.
      Message 2 of 10 , Feb 18, 2005
      • 0 Attachment
        --- In wordperfectmac@yahoogroups.com, "John Rethorst" <jrethorst@p...> wrote:
        >
        > --- In wordperfectmac@yahoogroups.com, Smokey Ardisson wrote:
        >
        > > one
        > > thing I have noticed is that WP-Mac requires documents to have
        > > Macintosh type codes (.WP6 or WPPC for WP6 docs), and depending on
        > > how the WP-DOS files are arriving on your Mac, the type codes might
        > > not be getting set. John R. can probably whip up a nice
        > > AppleScript…
        >
        > I don't know about a nice one, but try this. Save as an applet, not
        > showing startup screen:
        >
        > to run
        > display dialog "Drop a file on me to set its creator " & ¬
        > "to "WPC2" and its type to "WPPC"." buttons ¬
        > {"OK"} default button 1 with icon note
        > end run

        FYI, I had Script Editor complain about the quotes around WPC2 and WPPC in the above on run block; I changed them to single quotes and the script compiled.

        John, is yours supposed to handle multiple items in a single drop?

        I also discovered the stupid error that was keeping the script I was working on from working, so I present my solution below. John R's script is a lot more sophisticated (it has all the error reporting and "don't double-click me or give me folders" stuff), and there are probably other ways in which it is better than mine (I'm very much an amatuer still). However, I have one check he doesn't include :-) which might help if one has WP files stuck among other assorted files (but not if the DOS WP docs don't have extensions!). If your DOS WP files have different extensions, just add or modify the list--omitting the period! :-)

        As with John R's, save as an applet without showing startup screen. (The savvy AppleScripter can incorporate the extension-checking scheme into John R's for complete coverage!)

        Smokey

        --set type/creator on PC WP files so WP-Mac can open them properly
        --only act on files with extensions indicating likely Win/DOS WP file

        property extensionList : {"wpd", "wp", "wp5", "wp6"} ¬
        --needs to exclude the period!

        on open fileList
        repeat with theFile in fileList
        tell application "Finder"
        if the name extension of theFile is in the ¬
        extensionList then
        set file type of theFile to "WPPC"
        set creator type of theFile to "WPC2"
        end if
        end tell
        end repeat
        end open
      • John Rethorst
        ... I used smart quotes in the editor; the net changed them to plain quotes and I didn t notice. Sorry. It s also possible to use plain quotes in a script by
        Message 3 of 10 , Feb 18, 2005
        • 0 Attachment
          --- In wordperfectmac@yahoogroups.com, "Smokey Ardisson"
          <alqahira@m...> wrote:

          > FYI, I had Script Editor complain about the quotes around WPC2 and
          > WPPC in the above on run block; I changed them to single quotes
          > and the script compiled.

          I used smart quotes in the editor; the net changed them to plain
          quotes and I didn't notice. Sorry. It's also possible to use plain
          quotes in a script by using the escape character, e.g.
          "the code \"WPPC\" represents file type."

          > John, is yours supposed to handle multiple items in a single drop?

          No, although it could be made to do so, and to walk folders too. I
          worry a little about scripts that are too-powerful, where a user
          could select all files in a folder and drop them on this script.
          Their creators and types are all changed, including the two files
          from another app the user mistakenly put in that folder. Without a
          third file of that type as a reference, the user doesn't know what to
          change them back to and so can't open them.

          > (The savvy AppleScripter can incorporate the extension-checking
          >scheme into John R's for complete coverage!)

          That would be a good addition.

          John R.
        Your message has been successfully submitted and would be delivered to recipients shortly.