A Flash Developer Resource Site

Results 1 to 20 of 22

Thread: Open PDF and Files with AS3 from projector

Threaded View

  1. #14
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,764
    As far as I know there's no way to compile an AppleScript from a PC, you'll need a Mac to do that.

    If you know where the file is going to be on the CD and you can set the CD name then you can use a simple script like this one.

    Code:
    tell application "Finder"
       activate
       select file "file.doc" of folder "fscommand" of disk "CDNAME"
       open selection
    end tell
    If you can't control any of that, then you have to resort to something a little more complicated that locates the file you want to open from a location relative to your application. I've posted this before, but I'll save you the trouble of hunting it down.

    Code:
    --set the name of the file to open 
    
    property fileName : "homepage.html"
    
    --get the path to the containing folder 
    
    set myPath to (path to me as string)
    set AppleScript's text item delimiters to ":"
    
    set the parentFolder to ¬
    	((text items 1 thru -2 of myPath) & "") as string
    
    set AppleScript's text item delimiters to ""
    
    -- find the flash file 
    
    try
    	set targetFile to alias (the parentFolder & fileName)
    on error
    	--ie if there's no  file here by this name, it will quit. 
    	return quit
    end try
    
    -- open the file 
    
    tell application "Finder"
    	open file targetFile
    end tell
    If you're using CS3 (or newer) you need to know that the FSCommand folder is now INSIDE your .app file and not an external folder as it was in versions before that. This makes targeting files from AppleScript a little trickier because every reference you make is relative to the fscommand folder, where the AppliScript has to be so you can EXEC it.
    Last edited by Northcode; 07-03-2012 at 03:42 AM.
    When your swf2exe tool just HAS to work
    there's only one choice... SWF Studio

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