A Flash Developer Resource Site

Results 1 to 13 of 13

Thread: .app on Applescripts?

  1. #1
    Senior Member
    Join Date
    May 2003
    Location
    Vienna, VA USA
    Posts
    116

    .app on Applescripts?

    Hi, I've been reading a bunch of threads on here and saw the following statement:

    Originally posted by SJT
    Third, if you're in Mac OS X, you need to append .app to the end of the script as that's it's full name as an application, so myscript.app
    This means that Applescripts need the .app extension?

    I'm working on a cross-platform CD where I'm using the following function to execute differently on Macs and PCs.

    Code:
    function SmartExec(target)
    {
       platform = $version.slice(0,3);
       if (platform == "WIN") {
          fscommand("exec", target + ".exe");
       } else {
          fscommand("exec", target + "_script");
       }
    }
    Then I'm saving the applescripts with the extension _script. Do they need to have the extension .app instead? The above works on the Mac I've been renting to test this with (but that Mac is only OS 8.6). Should I rename the scripts with .app to make it work on OSX? (And if I did, would it be backwards-compatible with older OS versions?)

    Thanks for your help,
    Phyllis

    P.S. It was always my understanding that Macs didn't need or care about extensions (though it helps to have one in the function above). That post about using .app has me worried though!
    Last edited by pjutter; 03-25-2004 at 11:42 AM.

  2. #2
    Senior Member
    Join Date
    May 2003
    Location
    Vienna, VA USA
    Posts
    116
    Oh I think I understand now...

    Mac assigns an invisible extension if you write an applescript on OS X? Is that right? So you need the extension just because your file is going to have it automatically?

    I thought Windows was the only one that would do stuff like that....

  3. #3
    Senior Member SJT's Avatar
    Join Date
    Mar 2000
    Location
    London, UK
    Posts
    2,563
    Originally posted by pjutter
    Oh I think I understand now...

    Mac assigns an invisible extension if you write an applescript on OS X? Is that right? So you need the extension just because your file is going to have it automatically?

    I thought Windows was the only one that would do stuff like that....
    Yep, that's it exactly.
    Sam



  4. #4
    Senior Member
    Join Date
    May 2003
    Location
    Vienna, VA USA
    Posts
    116
    Can I change that invisible extension? i.e. Can I change .app to _script? I wrote most of my applescripts on an older Mac and used the _script extension. Now I've got a newer Mac I can borrow....

    If not, I can have 2 functions. Is there a way I can see this invisible extension? So I'm sure exactly what my files are called before I reference them?

    I NEED A MAC!

    Phyllis
    Last edited by pjutter; 04-05-2004 at 01:54 PM.

  5. #5
    Senior Member SJT's Avatar
    Join Date
    Mar 2000
    Location
    London, UK
    Posts
    2,563
    the extension is just part of the file's name, so you can change it.
    But, you wouldn't want to change it from .app to _script because then it wouldn't be recognised as an application in OS X.
    Sam



  6. #6
    Senior Member
    Join Date
    May 2003
    Location
    Vienna, VA USA
    Posts
    116
    Okay I won't change it. How is that the OS X recognizes the older scripts then? Those appear to be working, but they don't end in .app (at least the person testing it for me says they work).

    Is OS X a total revamp?

    Phyllis

  7. #7
    Senior Member SJT's Avatar
    Join Date
    Mar 2000
    Location
    London, UK
    Posts
    2,563
    Yeah total revamp.

    If they work, then all well and good. but i'd be wary of changing file extensions for no good reason.
    Sam



  8. #8
    Senior Member
    Join Date
    May 2003
    Location
    Vienna, VA USA
    Posts
    116
    If they work, then all well and good. but i'd be wary of changing file extensions for no good reason. [/B]
    In the older version of Script Editor, it didn't assign an extension at all. I just picked one because I needed one to work with Northcode's function. Wish I'd picked .app! Now I need 2 functions....

    (sigh)

    I gotta start a buy-a-Mac fund here.

  9. #9
    Senior Member
    Join Date
    May 2003
    Location
    Vienna, VA USA
    Posts
    116
    Okay I thought of one more question on this subject (and then I'll try to shut up):

    Do Macs that are OS 8 or 9 recognize applescripts that are written on OS X? I know the reverse is true (I wrote some applescripts on an OS 8 that were recognized by OS X). So I'm wondering if I shouldn't use the OLD Mac to write all the applescripts and only the new one for testing. My goal is to make my CD work on as many computers as possible. I'm betting some of my clients will have older systems.

    Thanks for all the help! These forums are great!


    Phyllis

  10. #10
    Senior Member SJT's Avatar
    Join Date
    Mar 2000
    Location
    London, UK
    Posts
    2,563
    That sort of depends on whether you've saved them as standalone applications or not.

    If you do, then they won't work as applicaitons on OS 8 or 9.0, anything (9.1 etc.) higher and they will.

    This is just because OS X is so completely different to OS 9 and previous that making backwards compatible things has some stumbling blocks...
    Sam



  11. #11
    Senior Member
    Join Date
    May 2003
    Location
    Vienna, VA USA
    Posts
    116
    Okay thanks. I might just use the old one for now, at least until I figure out what my clients have. Maybe the ones with Macs have OS X by now anyway (I think it's been out a while).

    Thanks, Phyllis

  12. #12
    Member
    Join Date
    Apr 2004
    Posts
    31

    hope someone reads this

    Was wondering...

    you add _script to the end of an applscript in OS9 and below

    but you need .app for OSX

    can you tweak that SmartExec code to look for OS9 or OSX like it looks for windows?

    That way, if its windows, it runs the EXE file, if its OSX it runs the .app file, and if its OS9 it runs the _script file?

  13. #13
    Senior Member
    Join Date
    May 2003
    Location
    Vienna, VA USA
    Posts
    116
    Originally posted by SJT
    That sort of depends on whether you've saved them as standalone applications or not.

    If you do, then they won't work as applicaitons on OS 8 or 9.0, anything (9.1 etc.) higher and they will.

    This is just because OS X is so completely different to OS 9 and previous that making backwards compatible things has some stumbling blocks...
    On my most recent CD, I wrote all the scripts on an OS X and saved them as standalone applications. They actually did work on OS 8.5 -- however, there were only 2 scripts (the one for opening a PDF and one for opening webpages) so I guess those were simple enough that even the older OS could understand.

    Just thought I'd mention.
    Phyllis

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center