A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Copying files from CD-ROM to mac desktop through Flash Projector

  1. #1
    Junior Member
    Join Date
    Apr 2007
    Posts
    2

    Copying files from CD-ROM to mac desktop through Flash Projector

    Hi,

    This is my first post and it's a bit of a biggie. I have created a Flash based menu system which allows the user to view thumbnails of .eps files and download the individual files to their desktop for editing. I have this working flawlessly on the PC using Northcodes utilities but the MAC side is giving me a bit of a headache.

    So far I have used the fscommand exec in flash to execute a applescript to do the job. My applescript knowledge was non existant until 2 days ago. I found this script and have implemented it,

    Code:
    tell application "Finder"
            activate
            with timeout of 1200 seconds
                    copy folder "CDTITLE:test.eps" to desktop
                    tell application "Finder"
                            close the front window
                    end tell
            end timeout
    end tell
    I have created seperate applescripts for the individual .eps files.

    The applescript works fine for the first file that is clicked to download but when the user clicks on another file the applescript errors and says

    "Can't get window 1 of application "Finder" "

    Any ideas what is causing this and is there a workaround or maybe a different script to do the same job?

    Thanks,
    d31irious

  2. #2
    Senior Member SJT's Avatar
    Join Date
    Mar 2000
    Location
    London, UK
    Posts
    2,563
    It's caused by the 'close the front window' statement, if there is no window open then the finder cannot close the frontmost window.

    I don't think you'd even need that statement actually, you could just use the 'copy folder' line.
    Sam



  3. #3
    Junior Member
    Join Date
    Apr 2007
    Posts
    2
    Thanks for the reply.

    I have tried eliminating that line, but when the user clicks on a file to download, finder places all open folders infront of the projector window. However the error does disappear.

    Do you know to a line of script which would bring the focus back to the projector window?

  4. #4
    Senior Member SJT's Avatar
    Join Date
    Mar 2000
    Location
    London, UK
    Posts
    2,563
    You can put a line in that says something like:
    tell application "MyProjector"
    activate
    end tell

    Where MyProjector is the name of your application as it appears in the top left corner menu.
    Sam



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