PDA

View Full Version : projector button link to .pdf file (macintosh)


schadeberg
10-10-2001, 04:38 AM
Hello again,

I'm doing well so far in making up a Flash projector intro for a CD.
This intro will have an animation which self loads and then allows the user to press a button which is to open up a pdf file. So far I have everything working well for the pc version....however regarding the macintosh version I'm battling with the function where the user is able to select a pdf file which is available on the same CD. At this stage Im using the 'getURL' FS Command, but it attempts to open up explorer and then opens up the Acrobat file. This is not ideal because the user has to close Explorer ..there must be a way to open up the Acrobat file without IE opening up as well.

I'd appreciate any advice here?

Frank

zoomfreddy
10-10-2001, 09:02 AM
You have to make a "applescript" that open the .pdf (call the applescript, not the .pdf, search in the forums for the applescript, i made one some time but don't remember if i posted it.....

Jesse
10-10-2001, 09:57 AM
I made a new tute about this (but it's for Windows systems only): http://www.actionscripts.org/tutorials/beginner/exec_docs/index.shtml

schadeberg
10-10-2001, 10:28 AM
STILL STUMPED,

Thanks for replying Jesse & Zoomfreddy....

Seems the answer is to have an AppleScript, which will then open the pdf file.

Does anyone know where I can find such a script for...which will make this all work on a Macintosh??

Thanks - Frank

zoomfreddy
10-11-2001, 02:20 AM
ok here is the script:
copy and paste in to the Applescript editor


tell application "Finder"
activate
select file "yourfile.pdf" of disk "YourDisk"
open selection
end tell


(just change the name of file and disk and leave the " ")

and save as:"your prefered name"

for it to work you need to make a disk image, name it and drop your files inside.

the code in flash:

on (release) {
fscommand ("exec", "nameOfyourAppleScript");
}

the AppleScript and files have to be in the same folder as your swf's.


:) :)

Jesse
10-11-2001, 02:33 AM
Thanks for posting it, we haven't seen a working one before.

Keywords: applescript apple script launch file

schadeberg
10-11-2001, 04:14 AM
thanks again Zoomfreddy & Jesse...urban legends,

I'll let you know how I go.

Frank

schadeberg
10-12-2001, 07:44 AM
Hi Zoomfreddy.....

Thanks for your help so far....

I'm battling with the last step, not sure what to do with one aspect.....QUOTE "for it to work you need to make a disk image, name it and drop your files inside. "


Not sure how to make a disk image..etc

Any help would be appreciated

Frank

schadeberg
10-12-2001, 09:58 AM
Got everything working....

Got the Disk Image thing happening...

and the AppleScript works like a charm....

thanks Zoomfreddy...as I said you're amongst the urban legends

Frank

zoomfreddy
10-15-2001, 07:08 PM
I am glad to know that my post help you, is just my two cents for all the good stuff i learn here :)

If you have something helpful, share it!!!:)

the cat
10-31-2001, 09:25 AM
Hi

I've tried to follow your codes but the pdf file doesn't launch. I'm not sure if it has anything to do with creating a disk image. I'm assuming that creating a disk image is creating a new folder and putting all the files (applescript, pdf files, flash files and swf files) in there.

Please could you help me out coz I'm reallt stuck.

Thanks

The Car
:confused:

zoomfreddy
10-31-2001, 05:08 PM
use some program like "shirink warp" or "toast" to make a image disk, then copy all your files in to that image, and finally write in the apple script the name of your image disk.

the image disk simulates a Mac disk Volume before burning it, in this way is like you already have the CD like you want.

the cat
11-01-2001, 08:50 AM
Hi.

Thanx for your prompt reply. Where would I be able to obtain "Shrink warp" or "Toast"? I am very new to all of this so you'll have to bear with me. Also, I know I may sound silly but if I want to have a flash programme on a CD Rom it needs to be launches via flash projector, right? I haven't really heard of that. I am a complete beginner to flash so please excuse the ignorant questions!

The Cat:confused:

the cat
11-01-2001, 09:05 AM
Hi Again

Another question I have is once I've got either Shrink Warp or toast, how do I use it to make a disk image? I've been doing a little hunting on Toast and I've found that it is an application used for burning CD's.

I'm really confused.

Please help!!

The Cat

zoomfreddy
11-01-2001, 07:08 PM
1- Make your flash stuff...

2- Make a projector of your main movie (search the tutorials)you need the projector to run your flash stuff as standalone app

3- Make the disk image( to burn a CD for Mac, you need a image disk, this helps to keep the arrenge of files the way you want) The toast app let you make a image disk before burning a CD, in the image disk copy all your files.
(the image disk is like a CD or HD, everybody will see the folders and windows as you do).(read the help in Toast App).

4 - you need to test your files inside the image disk.
5 be happy.

dbedient
11-26-2001, 08:53 PM
I know if I can launch a .pdf I should be able to launch an application. My problem is I can't even get the .pdf example werkin'.

Got the disk image thing goin on (ShrinkWrap). Flash button pointing to the Applescript. All in a nice tiddy package but nadda. I know the script is fine because I can run it before I save the Run-Only and it works fine. My disk image is pretty straight up.

Any help????

zoomfreddy
11-26-2001, 09:17 PM
Make shure that the name of your Image disk is the same in the applescript.

and again...the explanation:

1 - put togheter all your files in the image disk.
2 - make the applescript referencing the file inside the image disk.
3 - test the applescript.
4 - call the applescript from the flash inside the image disk.
5 - burn CD.

Maybe this stuff needs a detailed tutorial, i wish i could have the time to do it!!!

:cool:

dbedient
11-26-2001, 09:32 PM
Yes, I saw all that in your previous post, that's what was driving me nuts. It seemed so simple. Since then (15 minutes ago) I tried pointing to an application and "Viola!" it worked. So... for some reason it doesn't like my Applescript much in the way it doesn't know what to do with the .pdf if I point to that directly.

I'll mess with it some more. Thanks for the reply. Keep 'em coming.

Happy Holidays!

zoomfreddy
11-26-2001, 09:41 PM
save your script as a aplication, not as compiled script...in the save options you can change this...

:cool:

dbedient
11-26-2001, 09:53 PM
That was it. They actually refer to it as an Applet. I had tried this and it worked but it kept asking me if I want to run the script instead of just doing it . There is a checkbox "Never show startup screen". That's all it took.

Thanks again -

Flash and CF Rule

zoomfreddy
11-26-2001, 09:59 PM
Cheers!!!:cool:

ljones
03-21-2002, 12:52 PM
For testing purposes do you have to burn a CD. I wrote the script and ran it, works great, but if I make a projector keeping everything in the same location, I get nothing. One more question: what if you have multiple pdf's? Do you have to write a script for each pdf and if so how can you do that if the script and the image disk names are suppose to be the same? If my image disk is named iDisk and my script is also named iDisk which opens mypdf01.pdf, how would I open mypdf02.pdf? Does this make sense, please excuse my ignorance...

Best regards...
Lance

zoomfreddy
03-22-2002, 06:05 AM
you just need to mount the image disk you made to do the tests (and run proyector inside disk image.... you can use "disk copy" to make the image disk as write/read, so all changes are made fast).

...update, you can use paths to folders as..


fscommand ("exec", ":folder:the AppleScipt");

...this works well...

and...you will have to do a applescript for each file you want to open (because you can't change the applescript when is burned on cd)

but you can make the path be dynamic...in flash...

hope this helps.





:cool:

ljones
03-22-2002, 10:41 AM
zoomfreddy,

Thank you so much for your reply! So, if I understand you correctly, if I had ten pdf's each of those scripts would be in the same image disk but in they're own folders. Is that correct? If so, you, my friend, are a life saver!

Best regards...
Lance

ljones
03-22-2002, 04:45 PM
zoomfreddy,

Everything worked out great doing it the way you suggested, a thousand thanks. I was first trying this method using MX and much to my disappointment it didn't work. I tried all sorts of various combinations, but nothing. So I tried in F5 and tadda, worked exactly as anticipated. I was wondering if you or anyone else had tried it in MX and whether that was successful. Another thing I noticed in MX, when I made it fullscreen my freakin movie clips were not visible, they were visible in the swf however, bizarre. This is all on the MAC side, so if anyone has experienced this, I'd be interested in hearing about it and if there were solutions to these issues.

Best regards...
Lance

zoomfreddy
03-23-2002, 01:52 AM
:) good that it worked for you!!!

In the flash MX player the "exec" command is blocked for security reasons...we will need to use flash5 to keep doing this stuff...:(

and haven't made a full test on flash MX, is having troubles with fonts...crap...

:cool:

Naybobian
03-25-2002, 06:41 PM
Hi all,

Just curious if anybody found a way to launch PDF's via the Flash MX player on Mac? I've learned alot about it in this thread and found it is easy to accomplish in Flash 5 uing applescript, however i don't see why macromedia wouldn;t simplyfy the process in Flash MX. It just dosen't make sence or does it? Thanks

Kraken
03-25-2002, 09:30 PM
http://www.were-here.com/forums/showthread.php?threadid=126667&highlight=fscommand

answered by Macromedia employee Mike Chambers:

from:

http://www.macromedia.com/support/f...x_errata03.html

fscommand
Revised usage for fscommand exec command:

The exec command can contain only the characters A-Z, a-z, 0-9, period ()., and underscore (_). The exec command runs in the subdirectory fscommand only. In other words, if you use the fscommand exec command to call an application, the application must reside in a subdirectory named fscommand.

it is always a good idea to check out:

http://www.macromedia.com/support/flash/

when something doesn't work as expected.


mike chambers

[email protected]

So, you can still do fscommands, they just have to be located in a folder called "fscommand" in the same directory as your flash projec tor. Should work a treat.

Are there any more resources for creating applescripts? I mean, what sort of info can you get about the computer which it's running on? OS? Screen res? is it a G3? Write to a text file?

mactrix
04-15-2002, 04:57 PM
I was wondering, if anybody here can help me to use global variables with flash. The thing is that I'm using a variable name "Wheretogo" and I want to use it all over my flash project but it doesn't seem to work. any help?

P.S. I dont want to use textfields as variable ( I know they are) besides they make my flash movie look ugly.


Thanks in advance

zoomfreddy
04-15-2002, 05:02 PM
i guess you can use "_global" to make all your variables available,if this don't work, use "shared ojects" all this works if you are in Flash MX...

Kraken
04-16-2002, 12:32 AM
so, any more info on Macs and applescripting with Flash? Anyone found any more resources?

subman
04-16-2002, 09:08 AM
I haven't done any applescript where and what should i pu in if i want zip files to be downloaded?

Kraken
04-16-2002, 01:24 PM
huh?

Are you zipping up applescripts for download? I don't understand?

subman
04-16-2002, 01:48 PM
I'm trying to create an applescript that makes download buttons in flash possible, i have the applescript, but i want to send a variable to the applescript..

Kraken
04-16-2002, 02:04 PM
wait a minute. You want to make .zip files available for download...correct? Are you doing this online? Well, then, just use getURL:

on (release) {
getURL ("http:://www.richpaul.com/learning/popMe2.zip");
}

If you do that from the standalone mac player, it will pop open the default browser and download the appropriate file. Is that what you're talking about?

As far as passing variables to applescript, I don't know if you can. I've tried several methods, but nothing has worked, and I can't find any good resources for this anywhere on the Web...

mcdanyel
04-16-2002, 05:43 PM
Thanks Zoomfreddy!

I have been looking for a way to side step a browser on the mac when firing off external files!

zoomfreddy
04-16-2002, 05:43 PM
The applescript (compiled as an app) can't be changed, only knows what you previously told it to do (hardcoded), so i think it can't get variables from flash, but maybe a Java applet can do the job...just an idea.

:cool:

Kraken
04-16-2002, 05:56 PM
hmm...a java applet, huh? That just might work. I'm sure compatibilty with older machines would be a bugger, though...

Previous Mac versions of the java runtime were pretty crappy, if I remember right...

hmm...

Goodash
05-06-2002, 08:33 PM
This is regarding the short code for opening pdf files from a presentation on a windows machine. You comment that it won't work online. Could you expand on that? Or show me how to make it work online?

Thanks.

Kraken
05-06-2002, 11:15 PM
On the web, you could link directly to the .pdf file and if the user has the PDF Viewer installed, they will see the PDF directly in the browser. If they don't I believe the browser will just download a copy of the PDF and the user will still have to download and install the viewer...

You cannot open any applications from the Web. That's a safety feature of browsers in general.

dreamzMe
09-17-2002, 05:43 AM
I have tried everything in the previous posts. I guess I am stuck at the Disk Image part. While using Toast to creat a disk image, it gives me an error when I try to drag/select files to create the disk image and hence does not let me mount it.

I tried redaing the Help and stuff ... any suggestions anyone?

Help would be greatly appreciated.

zoomfreddy
09-17-2002, 06:58 AM
use "create temproary partition" under "utilities menu", then you specify name and disk size, it will appear mounted on your desktop, then copy your files.


:cool:

ginintonix
09-20-2002, 02:58 AM
OK I realize this topic has been beaten to death BUT...

My FScommand line won't trigger my applescript. My applescript works fine from my mounted image but my test .sfw file (a simple button to exec "applescript") just doesn't fire.

any help, missed variable? stupid mistake? unchecked box etc.

Thanks in advance
best,
Gin

Kraken
09-20-2002, 03:50 AM
If you're using Flash MX to create your projector, you must have your applescripts inside a folder called "fscommand" that must be located in the same place as your .exe.

I cite this article:
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&safe=off&threadm=abdrrj%247gv%241%40forums.macromedia.com&rnum=2&prev=/groups%3Fq%3Dfscommand%2Bflash%2BMX%26ie%3DUTF-8%26oe%3DUTF-8%26hl%3Den

zoomfreddy
09-20-2002, 06:12 PM
a long time ago i posted this thread about flash MX fscommand "exec":

follow me (http://www.actionscript.org/forums/showthread.php3?s=&threadid=10928&highlight=flash+MX)

:cool:

bshweta
05-31-2003, 07:59 AM
I need to open a Pdf file on click of button in Flash MX in Mac. I followed the following steps:
1. Created AppleScript (openPdf) to open Pdf file
2. On click of button i called this openPdf in fscommand.

When i run it nothing happens.

mizanor
06-09-2003, 08:01 AM
Hi,

I have a question about the applescript in this thread. Can it be used to launch a word document in Mac? Or is the code specific for a .pdf file?

I really appreciate any help on this problem. Thanks.

zoomfreddy
06-10-2003, 06:25 AM
it works ok with all files, just change the name of the file you want to open, follow my link two posts earlier to see instructions on how to make it work over flash MX, also search around, somewhere here, DIDI posted a link to a very good page with a lot better explanations about this subject.

bshweta
09-26-2003, 07:38 AM
Thanks for this piece of code it helped me a lot.

I followed the following steps as mentioned but i made mistakes in 2/3 places which i have highlighted below:

1. Made all my Flash files and projector.
2. Kept the Pdf files in fscommand folder.
3. Made apple script. It is in Applications folder in Macintosh HD.
4. I named the apple script file as Lesson1 which contained following script:

tell application "Finder"
select file "Lesson1.pdf" of disk "openPdf"
open selection
end tell

Please note this script has to be saved in fscommand folder.
It should be saved as Application and not compiled script else it doesnot work.
5. In my Flash file i called applescript as
fscommand("exec","Lesson1");
6. Create image disk:
This is creating temperory disk.
For this go to Utilities in Macintosh HD in that Disk Copy.
From File-->New->From folders
choose the folder u have ur work saved.
7. Save it in read/write mode.
8. Once u have image disk mount it by double clicking on it.
9. This will make temperory drive in ur computer.
10. Now run the projector file.

I need help as to how to burn CD in Mac. Meaning to say that instead of DiskCopy if I give name to my Drive while burning CD will it work. Or should i make disk image and mount it on CD.
How should i give AutoRun command in that case.

zoomfreddy
09-27-2003, 12:51 AM
Making the disk image and mounting it helps to test the script...you can skip the mounting, but have to be sure about paths and names :)
to make the Autorun, im afraid you need to use "Toast" app(haven't tried to acomplish this with diskCopy, i guess this app can't make Autoruns) somewhere there is the option to select the file you want to use(you will need the disk image image mounted for this to work ).

btw. thanks to some old Mac virus that runs when a cd with an Autorun file is inserted on your machine, some users turn off the Autorun option...QuickTime App does this job...so...just evaluate if you need madly this option, if not, just place a txt file explaining how to execute the projector.
Good luck

leChienNelson
10-03-2003, 03:02 PM
Hey there!

I am working on Mac OS X. the apple script offered by zoomfreddy works well if ran directly from the disc image with the script editor but if I link to it with a projector with fscommand (still on the disc image) it starts OS 9 !!! anyone knows why? Do I have to check from the OS in Flash and find the appropriate scripts? Can I check the OS version in Flash?
Thanks for your help!

zoomfreddy
10-04-2003, 12:05 AM
to leChienNelson:
You have to make 1 script applet on Os 9(to run it over Os 9) and 1 for Os X(to run it over Os X), the applescript applets aren't multi Os...so...you can't use the same instruction to open some archive, but can give the user 2 options, 1 for each Os version...

getVersion();
this code give you some info about the plugin used--platform and version-- but nothing else, i don't think you can get Os version info with this....
good luck:cool:

leChienNelson
10-05-2003, 10:03 PM
Thanks Zoomfreddy!
I found out that you can find the user platform with "System.capabilities.version" it returns a string with Platform (WIN, MAC or UNIX) and the player version..
to find out about the OS, we need to use the "System.capabilities.os" which returns what version of Windows the user is using or what mac OS... ain't that neat?
now I only have to find appleScripts for OS 9 and OS X...

zoomfreddy
10-06-2003, 03:36 AM
ahhh, yes...hehe, long time without using flash to extreme here, ok, this works:

os=System.capabilities.os;
trace(os);
//add some substr to get the numbers only

and for the applescripts, use the same script code, just make one(compiled) on Os X, and one on Os 9, then make the AS select the apropiated one:cool:

jimtebbs
11-05-2003, 08:30 AM
Does all this disk image and applescript apply to opening word docs in website on both Mac and Windows platforms?



:confused:

zoomfreddy
11-07-2003, 02:42 AM
hi there jimtebbs, no, this stuff is just for Mac cd's, to open a file on a website you can use:

getUrl("theNameOfTheFile");


check the sintax, not sure it is ok:)

Most of the time the file will open with the apropiated app once download is finished(deppends on the machine configuration).

:cool:

spinicus
12-15-2003, 08:13 PM
Hello,
Just thought I'd reply here instead of starting a new thread. I'm wondering if when the file is referenced in the AppleScript, do I need to put a relative path (to the script) or an absolute path? If I need an absolute path, can someone give me an example of the right syntax for this?

leChienNelson
12-15-2003, 08:19 PM
Hi spinicus,

I have used the scripts in a CD-Rom and this is how it looked:

tell application "Finder"
activate
select file "yourFile.doc" of disk "YourDiskName"
open selection
end tell

Hope this helps!

zoomfreddy
12-16-2003, 05:12 PM
the file path on the Applescript is relative to the disk (cd rom on this case), so, as example, if you have a file you want to open inside a folder named "openable files folder", the script should be:

tell application "Finder"
activate
select file "openMe.pdf" in folder "openable files folder" of disk "yourDiskNemeHere"
open selection
end tell

i tried this on Os X, don't know if it will work ok on Os 9

zoomfreddy
12-16-2003, 05:25 PM
another example:

tell application "Finder"
activate
select file "otherFileToOpen.pdf" in folder "filesFolder" of folder " allOpenableFilesFolder" of folder "resourcesFolder" of disk "yourDiskNAme"
open selection
end tell

enjoy.

btw, if you select "open dictionary" on "file" menu in the AppleScript editor, and then open some app(on Os X you get a window with scriptable apps list), you will see all the commands that you can use with the app you opened.
... here comes really handy some applescript book (that i don't have :( ) to learn the syntax, but as you can see, it is a lot like english language.

luoifong
02-20-2004, 03:48 PM
I feel bad posting b/c this discussion seems to be so thorough...but I've now been struggling with this for a couple of days. I think I've followed the instructions correctly and still when I click on the button, nothing happens.

Here is the process I went through...btw, I'm on OS X, using Flash MX 2004 and Flash Player 7.

1. In Utilities, opened the Disk Utility and clicked on "New Image" to create a new Disk Image.
2. I called the Disk Image, "botr" and gave it "read/write disk image" format.
3. The disk image was automatically mounted, so I dragged the following files/folders into the mounted disk image:
i) "botr Projector" file
ii) "fscommand" folder, which holds the following 2 scripts: wvtm_intro_syllabuspdf_script (same name, one saved as a "script" and one as an "application"). btw, when I saved the script as an application, I unchecked the boxes, "Run Only," "Startup Screen," and "Stay Open."
iii) "pdf" folder which holds a pdf file called, wvtm_intro_syllabus.pdf.

In the Flash file (the projector), the button has the following actionscript attached:

on (release) {
fscommand ("exec", "wvtm_intro_syllabuspdf_script");
}

When I click on the button, there is no response or indication that anything has gone wrong. When I run the applescript application directly, it runs correctly and opens the pdf.

Any ideas where I might be going wrong?

Thanks!

zoomfreddy
02-21-2004, 04:13 AM
Hi there, it seems like you made all the steps ok, just 1 doubt... leave checked the option "run only" when compiling the applescript (and you just need the applescript as app version, not as script).

Hope this help you.

luoifong
02-22-2004, 01:35 PM
I tried leaving the "run only" box checked, but that didn't work. I saved the script as an "Application" but that didn't work. I also tried saving the script as an "Application bundle." That didn't work either.
I know the script works b/c when I open it directly it opens up the PDF without any problems.

It seems to be a communication problem from the Flash movie (projector file) to actually call the script. When I click on the button in flash there is absolutely no response or message given that anything has gone wrong. I even tried putting the wrong pdf file name in the script to see if I could get an error when the script runs...but I don't get any error message which leads me to believe the script isn't even being called/run.

I have a button in flash and attached the following actionscript to it:

on (release) {
fscommand("exec","wvtm_intro_syllabuspdf_script");
}

I'm pretty baffled. I've never worked with applescripts until now, so maybe i'm missing someting in the process of creating the applescript.

Any other ideas?

leChienNelson
02-23-2004, 01:29 PM
Did you put all your apple scripts in an "fscommand" folder? Otherwise it won't work. Hope this helps.

luoifong
02-23-2004, 05:32 PM
I figured out what the problem was...the filename of the applescript was too long.

The file name was "wvtm_intro_syllabuspdf_script" and didn't work. I then decreased the length of the filename by one character and it then worked. So I guess as long as the filename is 27 characters or less it will work.

fsnonsense
04-01-2004, 04:17 PM
..sorry to add to this monster of a thread but...

the applescript, as listed previously, works fine if i double click it. However from a button in a flash projector it fails silently.

The applescript is called 'ppt' and saved as an 'application' with 'Run Only' checked (although have tried all combinations) and is in the fscommand folder.

[as] on the button is:

on (release) {
fscommand("exec", "ppt");
}


All good, so why does the applescript work but not from in flash?!


please tell me there is something blantantly obvious i have overlooked.

fsnonsense
04-06-2004, 08:08 AM
worked out the problem... not sure how you got it working on OSX the way it's shown as there was a vital ingredient missing. THE FILE EXTENSION. by adding as below the call from flash not longer fails silently.


//for MAC OSX
on (release) {
fscommand("exec", "ppt.app");//note applescript file extension
}


//for MAC OS9
on (release) {
fscommand("exec", "ppt");//note NO applescript file extension
}

wyclef
05-04-2004, 05:14 PM
what's wrong with how i'm setting up the paths in this applescript code (_pdfs is in fscommand folder)


tell application "Finder"
activate
select file "_pdfs/BRANDMSG.PDF" of disk "CD Name"
open selection
end tell


Also, I have found that the .app extension doesn't make a difference for me, OS X, OS 9. Has this been tested on multiple macs?

wyclef
05-04-2004, 05:48 PM
fixed it...


tell application "Finder"
activate
select file "BRANDMSG.PDF" of folder "_pdfs" of folder "fscommand" of disk "CD Name"
open selection
end tell


now how could I tell it to close any open folders (_pdfs, fscommand) after it launches the file?

wyclef
05-04-2004, 05:57 PM
i tried this but it doesn't work...


tell application "Finder"
activate
select file "BRANDMSG.PDF" of folder "_pdfs" of folder "fscommand" of disk "CD Name"
open selection
end tell

tell application "Finder"
close folder "_pdfs" of folder "fscommand" of disk "CD Name"
end tell

zoomfreddy
05-04-2004, 06:33 PM
everybody learn better by trying things... you almost find the answer, I assume that you want to close all the windows on finder, so use this:


tell application "Finder"
close windows
end tell


remember, when a folder is opened it becomes a window :)

wyclef
05-04-2004, 07:01 PM
Thank You!

greeda
05-25-2004, 04:25 PM
i found the applescript could be shortened like follows:

tell application "Finder"
open file "test.pdf" in folder "fscommand" of disk "test"
end tell

zoomfreddy
05-26-2004, 10:59 AM
Hi greeda, you are right, but with the select action you can do more things with the file, not just open it :cool:

wyclef
06-06-2004, 09:43 PM
Hey,

I've got an emergency question in response to fnsonsenses post a few posts back about...

"
//for MAC OSX
on (release) {
fscommand("exec", "ppt.app");//note applescript file extension
}


//for MAC OS9
on (release) {
fscommand("exec", "ppt");//note NO applescript file extension
}
"

I was running Mac OS 10.2.8 and got this to work in both 9 and X without adding the .app extension but now have upgraded to 10.3.4 and am noticing that this is not working anymore and that the .app extension is necessary. This is seriously messed up because I need to have 1 projector file that works for both 9 and X like the last one I made pronto....by like tomorrow at 11am. It's 11pm now and i've just discovered this problem trying to burn the master cd and don't have any time to downgrade back to 10.2.8. Does anyone have any insight into how to get around this? Please help. Thanks.

tluukkonen33
06-08-2004, 01:10 PM
excellent post
[email protected]

amateur6
09-24-2004, 04:26 PM
"
//for MAC OSX
on (release) {
fscommand("exec", "ppt.app");//note applescript file extension
}

//for MAC OS9
on (release) {
fscommand("exec", "ppt");//note NO applescript file extension
}
"

I was running Mac OS 10.2.8 and got this to work in both 9 and X without adding the .app extension but now have upgraded to 10.3.4 and am noticing that this is not working anymore...

Does anyone have any insight into how to get around this?

I myself ran into this last night... So, I assume there is no answer to this other than provide clear system requirements - one way or the other?

zoomfreddy
09-25-2004, 05:20 AM
Hi there amateur6, as I don't have Os 9 around any more to do tests, this is just a guess, try it and let us all know if this works, I bet it will:

Select the applescript app and do a "apple+1" keystroke, under"general:"
below all the file info, there is a checkbox with the text:

"Open with classic"

(not sure about the text as I have the Os with Spanish languaje)

Just turn it on for the applescript that will run on Os 9
and voila! the finder will try to open the script on Os 9

There is another thing to try, when you save as aplication the script there are 2 choices to select from:

1.Aplication
--My guess is that this one is a carbon app(Os 9 and Os X compatible), compile the Os 9 script like this.

2.Aplication package
--My guess is that this one is a cocoa app(just Os X compatible), compile the Os X script like this.

Good luck and let us all know how it worked.

:cool:

Gecko
09-27-2004, 02:28 PM
I appologise for replying and not posting a new Thread. I did try posting but have not had a reply which can help me.

I am trying to launch various .pdf files from a projector file. I have been reading through all the very helpful advice (especially Zoomfreddy's) but I am now completely stuck. My apple script works fine (opens my .pdf and acrobat) but when I play the projector, click my button the pdf does not open. I am using Flash MX.

I have moved my projector file up to the root of the disk image. I have left the applescript named: firstscript in a sub folder called fscommand along with the pdf called: U62_1.pdf.

My applescript reads :
tell application "Finder"
open file "U62_1.pdf" of folder "fscommand" of disk "Big_Test"
end tell . I have saved my applescript as an application and have ticked the box run only.

My fscommand in Flash MX reads as follows:
on (press) {
fscommand("firstscript.app")
}

I hope somebody can help me as I have now been stuck on this for at least a week!

Another thing, if I ever get this to work on a Mac will I have to do a similar thing using a PC or will this work for PC too. I am new too all this!

:confused:

amateur6
09-27-2004, 07:20 PM
Gecko, you're missing the "exec" part of the fscommand, which is what gets you out of flash into the script:

on (press) {
fscommand("exec", "firstscript.app");
}

should work, considering your other troubleshooting is correct.

Zoomfreddy, thanks - I wasn't so worried about getting it to run, but getting ONE solution for both OSes, and I don't think that will happen. This is getting really complicated, and I'm beginning to see why all those PC folks hate us Mac folks... :D

Gecko
09-27-2004, 08:38 PM
Hi

Thanks so much for replying.

I have put in the "exec" and it still isn't working. I am a bit confused about the way my applescript is saved though. I have saved it as an application and have ticked the "run only" box. Is this correct? I am questioning it because I can't then open it again to read it. Therefore, I always have to keep an original which I can edit. This does not seem right - or is it?

Applescript reads"
tell application "Finder"
open file "U62_1.pdf" of folder "fscommand" of disk "Big_Test"
end

fscommand reads:
on (press) {
fscommand("exec", "firstscript.app");
}

I feel I have come so far to beaten at the last hurdle! I am using Flash MX - could this be the problem? I just don't know enough to see my mistakes! Hope you can help. :confused:

hey_suburbia
09-28-2004, 12:57 AM
I am using this code:

tell application "Finder"
activate
select file "logo.pdf"
open selection
end tell


- I am running this file off the HD, so no CD is being used.
- It's compiled as an application.

I get this error when I launch the applescript application:

Can't get file "logo.pdf" of application "Finder".

I've been stuck for a while on this.....

Gecko
09-28-2004, 11:23 AM
I have managed to fix the problem with my projector file. I had saved the applescript as an application but on doing this, I noticed I could not edit it so I also saved it as a "script" so that I could edit it if need be. I had saved both the script and application in the same fscommand folder! I moved the script file out of the fscommand folder just to see, ran my my projector file and it worked perfectly!

Thank you to everyone who got me this far - I could never have done it without you guys! :) :) :) :)

hey_suburbia
09-29-2004, 07:01 PM
Are you able to run it locally (not off a cd)?

polysmartass
10-11-2004, 04:39 PM
First let me tell everyone that this thread has helped me out immensely. Before reading everything I had no clue as to what I was doing. With that said, I have one last question. The script that I am using is the same that was mentioned in thread #69 and it works great.

tell application "Finder"
activate
select file "BRANDMSG.PDF" of folder "_pdfs" of folder "fscommand" of disk "CD Name"
open selection
end tell

My question is this. The script opens every folder and leaves it open on its way to opening the final file. In the end leaving a bunch of open folders on the users desktop. Is there any way to have the script open only the final document? And if that is not possible, what would I add to the original script to have it close all of the folders when it is done. I appreciate any help, and sorry for keeping this never ending thread going.

-p

zoomfreddy
01-14-2005, 05:46 AM
Are you able to run it locally (not off a cd)?

Yes, you nedd to write the full path to the file, like:

tell application "Finder"
--the
open file "test.pdf" in folder "theFolder" of disk "LocalHD"
end tell

snicka
02-21-2005, 05:12 PM
Hey guys,

Thanks for all of the great info in this thread. Sorry to resurrect it, but I have a question regarding ZIP files.

I have tried to use the same method as described in this thread on ZIP files, but obviously the file cannot be uncompressed to the CD.

Is there any way to specify where the file gets uncompressed or will this just not work with ZIP files.

Thanks for any help.

zoomfreddy
02-22-2005, 04:06 AM
Hi snicka, there are some things to think about what you are trying to do.
- Wich app will we use to expand the zip file(wich one its easier, or wich one every mac will have)... Os X own utility, stuffit expander, the unix compression utilities(via the terminal)?.

Do we know if the script will have permission to access or create some folders?


To make thing easy, you can copy the zip file to a folder on hd, expand the file and then delete the zip

Use a folder you know every Mac will have, like library or applications.

check out the applescript dictionary from stuffit expander:
-----------------
expand alias -- List of documents/folders/disks to Expand
[delete originals boolean] -- Delete files after expansion
[into alias] -- Alternate destination for the files
Result: integer -- Returns the number of files that were successfully expanded.
---------
Read the dictionary for the standard aditions scripting addition(some entries to manipulate disks, folders and files there).

You can search for dictionaries in script editor/File/open dictionary...nowdays almost all Os X apps can be applescripted at some degree, but some stil can't (flash projector for example).

This may not help you a lot, but will put you on the right path to acomplish what you want, if you do a lot of work that might use applescript, do yourself a favor and buy an aplescript book, AppleScript in a Nutshell, will do. :)

Richlh
03-06-2005, 05:05 PM
Hi folks,

I'm wondering if anyone knows of a way to send a varible in the startup of the applescript to view PDFs.
i.e. applescriptfile?filename=name.pdf

We have 650 pdf's and writing 650 different applescripts seems rather wasteful.

Any thoughts?

Thanks.
Rich

maak
04-04-2005, 08:49 AM
Well I used to be able to do this [applescript opening a file from a projector made with MX Pro 2004] but it just refuses to work :mad: .

The project comprises a Flash Projector that opens a .swf that streams some .flv's and syncs text to the video...and of course opens some pdf's/ppt's [or not]

action script is:

on(release) {
fscommand("exec", "vfendppt.app");

}

When it used to work a year or so ago it did NOT have the ".app" at the end.
I have tried with and without.

applescript is:

tell application "Finder"
activate
select file "vfend.ppt" of folder "fscommand" of disk "vfend_mac"
open selection
end tell

The script itself works when run from the script editor before saving it...it opens the correct file on the CD rom labeled "vfend_mac"!

SAVED AS a run only application and named "vfendppt"

I tried saving it as "vfendppt.app" too...but that didnt work either...which way is right?

the applescript was made on both the G3 and on the G5 and coppied to my PC . A hybrid Mac/pc DISK image made with Mac Image.
The .iso was burnt with Nero...all as I had done a year ago :confused:

Now all you mac heads will say "...copying applescript to PC stuffed it" :rolleyes: .

This USED to work fine :) .
I think updates to OS x must have prevented it from working from flash projector

th CD was tried on a G5 running osx 10.3.8 and G3 running osx 10.2.8 and a G4 osx 10.3.8.

Are there any errors in what I have done?

ANSWERS WOULD BE APPRECIATED

Maak

maak
04-04-2005, 11:13 AM
well i just tried again burning on the same mac as made the applescript with both version of my actionscript fscommand .... [with .app and without at the end of the applescript name]


BUT still NO joy :mad:

im beginning to think that a readme telling the mac user where the files are kept is the best option

ljones
04-04-2005, 02:44 PM
Hey maak,

I have had the same issue. I resolved it by detecting the OS, execute the applescript created on an OS X and when an OS < 10 is detected execute an applescript created on an OS 9. Hope that helps.

Lance

maak
04-04-2005, 11:32 PM
I cant get it to work in either Mac os anymore!!!

If you can see an error in what I did ...do tell

Maak

ljones
04-05-2005, 04:10 AM
maak,

I have the applescipt files that I used on a project, but I'm on a PC right now and can't open either to post the code. But I would suggest one thing that I've been using quite a bit lately, flashPaper 2. It has alleviated much of the guess work when it comes to cross platform opening of pdf's and ppt's. $80 for a single user license has been money well spent. It took a small amount of time to get the hang of it, but once you do I think you'll see the value in it. You may want to at least do the trial.... just offering options.....

http://www.macromedia.com/software/flashpaper/

Good luck,
Lance

maak
04-05-2005, 04:39 AM
nice idea but naa...weve got flashpaper...i need to launch ppt's too..and install acrobat if needed.

AND IT ALL WORKED A YEAR AGO!

ljones
04-05-2005, 05:17 AM
We convert the ppt's to the swf format and load them with FlashPaper, is that an option for you? Of course if FP is an option then no need to install Acrobat obviously. If you have to use the pdf's in their native format then I guess you will have to go through this madness. Trust me I know your agony. How are you opening your pdf's on the PC side? I've used the free utilities provided by Northcode which work very well, no browsers opening or dos windows, http://www.northcode.com/misc/proxy.zip

Lance

maak
04-05-2005, 05:28 AM
The PC side is a breeze...everything works swwet..im using Flash Jesters "j-Tools"...but then Im mainly on a PC...we have people who work with us that allow me to use their Macs for this stuff.

I all of a sudden have Many issues with the mac projector

1. a .sfw opend in the projector will not go full screen. even with fscomand

2. saved applescript doesn't seem to work from the projector [it used to]

3. fscommand quit does'nt work from the projector on Mac

ljones
04-05-2005, 02:11 PM
and your external scripts are inside an "fscommand" dir?

maak
04-05-2005, 02:29 PM
ja...and the files to open are in there too.


but hey...its working now :) :) :) :) [sripting from different Mac]...and i added applescript below to close the nasty finder windows:

tell application "Finder"
close windows
end tell


The "Quit" problem was related to the applescript not working... or not able to execute the file....so Beware...if the script doesnt work for any reason...the CD is stuck in the drive till reboot



ALSO it seems I have to burn on mac but that was not my previous problem...it still didnt work before when burnt on Mac.

...I used to be able to burn from "Mac Image" file if the file was copied to the PC directory from a Mac as it puts the resorurce fork with it...but no go now. Applescript files coppied back to the mac still work but not burnt ones....something for the Mac Image people to work on I guess.Burning on Mac is not so elegant a solution as Macimage would provide with a truly hybrid CD...but it works...except for one particular bit of audio that doesnt play in the first Clip on the Mac...seems the CD ROm cant cope [dual G5 superdrive]...the PC plays instantly tho and in sync.

Thanks all for the Help.

Maak

gozza
10-10-2005, 02:43 PM
Hi all,

I am making an interactive cd-rom which links to pdfs, I have everything sorted on PC but am struggling on mac. I have been reading a lot about it on these forums (infinately useful!!) and have found what I need below


ok here is the script:
copy and paste in to the Applescript editor


tell application "Finder"
activate
select file "yourfile.pdf" of disk "YourDisk"
open selection
end tell



Basically my question is how do I create applescript on a pc

Any help much appreciated!

wyclef
10-10-2005, 02:58 PM
i believe .bat files are what you'll want to look into...


@echo off
start _PDFS/YOURPDF.PDF
exit

zoomfreddy
10-10-2005, 03:56 PM
If you question is can I make the Mac applescript (to use it on the Mac side) on a Pc?, the answer is... no.

You need to compile the applescript to make it work as standalone(app); and the file itself as script (.scpt) is not just a txt file, if you open the working example script on a text editor you get a bunch of weird strings, I can't even post it here the strings get croped :)

So, you will need a Mac for the job.

maak
10-10-2005, 09:43 PM
no that wasnt the question. I write and compile on the mac...after all this time i did actually sort it out...but dont know why it didnt werk...different version of os X t i think.

I did though used to be able to save the compiled script on a pc, then take it back to the mac at a later stage and it would still work...doesnt seem to anymore

cojuringo
10-19-2005, 05:32 PM
Hey guys hav you tried this in the app? it closes those windows before opening your file.

tell application "Finder"
close windows
activate
select file "DIMETCOTE.pdf" of disk "testdisc2"
open selection
end tell

flxeken
10-24-2005, 05:25 PM
Is there still no one who have figured out a way to send variables to the applescript?
That would be endlessly beautiful.

Thanks for all the great advise in this thread!

neuhaus3000
10-27-2005, 11:05 PM
Hello everyone,

I am able to link a PDF file from a Flash projector (PC).
Here's how I do it.

I have the required fscommand directory on the root of my CD.
(Source : Macromedia tech note (http://www.macromedia.com/cfusion/knowledgebase/index.cfm?id=tn_14280))
In the fscommand directory I have my test.pdf file.
In the fscommand directory I have a openpdf.bat file.

The code in the openpdf.bat file :

@echo off
start test.pdf
exit

When executed, the code opens the PDF with acrobat. Make sure you add a link to download Acrobat Reader in your project.

In my Flash movie, on the pdf link, i have this code:

on (release) {
fscommand ("exec", "openpdf.bat");
}

You don't need the fscommand/ in the path. Flash already knows that it has to look in a folder called fscommand.

I hope it can help someone... Feel free if you have notes to add.


Now... How the heck can we link a PDF from a Mac? With the same FLA file... ???
For a hybrid CD... I have Flash 8 by the way.

Thanks!

neuhaus3000 :)

zoomfreddy
10-28-2005, 03:39 PM
Hi neuhaus3000, right now I can't find it for you, somewhere in this thread is the answer, and also do a search for:

System.capabilities.os

then,


if(os==Mac){//or whatever System.capabilities.os gives as result
fscommand ("exec", "openpdfMacScript");
}else{
//win part
fscommand ("exec", "openpdf.bat");
}


isn't that difficult when you read all the thread and look at the flash help:)

mscoder68
11-09-2005, 07:13 AM
This is a great thread, very educational. I have a question about AppleScript. I know to use the following code to open a file on Mac from CD-ROM. But how you save a file instead of opening it from CD-ROM to local machine on Mac? Use "save selection"? I really hope you AppleScript gurus can help me on this. Thanks.

tell application "Finder"
activate
select file "yourFile.doc" of disk "YourDiskName"
open selection
end tell

zoomfreddy
11-09-2005, 03:57 PM
Hi mscoder68! on the applescript editor go to Archive/open dictionary, then select "Finder", you will see a new window with all the options to script. Example(that will work for you):

duplicate v : Duplicate one or more object(s)
duplicate reference : the object(s) to duplicate
[to location reference] : the new location for the object(s)
[replacing boolean] : Specifies whether or not to replace items in the destination that have the same name as items being duplicated
[routing suppressed boolean] : Specifies whether or not to autoroute items (default is false). Only applies when copying to the system folder.
→ reference : to the duplicated object(s)

goodarts
11-17-2005, 03:31 PM
I am having issues on the PC side with launching a PDF from my Flash.exe. I'm using the Batch code Neuhaus3000 provided. The catch is; the PDF opens on two of the four PC's I'm tesing on. On the two that is does NOT open, it tries to open the PDF in a browser window and ends with "Page Not Found".
Any suggestions? Is this a typical problem? I know very little about Batch File coding. I think a solution would be to designate that the file must be opened with Acrobat.

goodarts
11-17-2005, 05:02 PM
I found this old thread and modified:
http://www.actionscript.org/forums/showthread.php3?s=&threadid=28560

1. Download the attached files (originally from post #4 "pdfname" from BNCK on 05-27-2003, 05:30AM)
2. Rename the folder 'fscommand'
3. Paste the PDF you want to open into the 'fscommand' folder
4. On a PC, open the .INI file and change the second line of code to reflect your PDF name (Application=yourName.pdf)
5. Rename the .EXE and .INI files in the 'fscommand' folder to reflect the name of your PDF (i.e. - yourName.PDF, yourname.INI, yourName.EXE)
6. In the Flash file, set your link to be: on (release) {fscommand ("exec", "yourName.exe");}
7. Publish as a Windows projector.

This works on 100% of the Windows machines at my office.

inhan
01-02-2006, 01:10 AM
Guys I have found a solution to the non-functioning applescript of mine. It worked out great when executed through selection but did not work at all in the projector file.

Quite ambiguously I changed the name of the script form CVlaunch to cv_launch and guess what?..

Now I'm trying to figure out what to add to the script in order the open window (triggered by the script) to close and the other one to return back to the previous directory (it eventually became to the folder "fscommand" - one level down).

Any ideas?

Here's a second question: Can we create bat file(s) in mac? If so can any of you give some software names? Otherwise I'll be pleased to learn the most basic program on pc to create it.

Great thread, btw :)

inhan
01-04-2006, 05:59 AM
Here's a second question: Can we create bat file(s) in mac? If so can any of you give some software names? Otherwise I'll be pleased to learn the most basic program on pc to create it.
Alright. I found out that any word processor -including the simple text editors- can do it. Write the code and save your file. Then change the extension of the file to "bat".

Cheers.

teh_flash_ninja
06-07-2006, 12:08 AM
Thanks for this piece of code it helped me a lot.

I followed the following steps as mentioned but i made mistakes in 2/3 places which i have highlighted below:

1. Made all my Flash files and projector.
2. Kept the Pdf files in fscommand folder.
3. Made apple script. It is in Applications folder in Macintosh HD.
4. I named the apple script file as Lesson1 which contained following script:

tell application "Finder"
select file "Lesson1.pdf" of disk "openPdf"
open selection
end tell

Please note this script has to be saved in fscommand folder.
It should be saved as Application and not compiled script else it doesnot work.
5. In my Flash file i called applescript as
fscommand("exec","Lesson1");
6. Create image disk:
This is creating temperory disk.
For this go to Utilities in Macintosh HD in that Disk Copy.
From File-->New->From folders
choose the folder u have ur work saved.
7. Save it in read/write mode.
8. Once u have image disk mount it by double clicking on it.
9. This will make temperory drive in ur computer.
10. Now run the projector file.

I need help as to how to burn CD in Mac. Meaning to say that instead of DiskCopy if I give name to my Drive while burning CD will it work. Or should i make disk image and mount it on CD.
How should i give AutoRun command in that case.

What if i don't have access to making the external file a .pdf? I am trying to do the same thing that guy is doing, except i want the button to link to a .doc file.

RubyDo
12-30-2006, 01:48 PM
Thought to tell you about the last thing I used…

http://www.adobe.com/products/flashpaper/

The flash paper appears as plugin in acrobat & word so that it transforms the pdf/doc into swf searchable & working perfectly.

Using the action script code described below it can be loaded into a movie clip & yes it work properly & valid on windows & macintosh
http://www.adobe.com/devnet/flashpaper/articles/import_flpaper2_02.html (http://www.adobe.com/devnet/flashpaper/articles/import_flpaper2_02.html)

RubyDo

Deadweight
01-04-2007, 07:53 PM
First of all, thanks to everyone for all your help! This forum has been awesome!

I'm now editing my post. For some reason the script below was launching Preview as apposed to Acrobat, but now it's working fine. Hmmmmmm. I'll leave this code up anyway for those who may find it useful. Anyone who has any questions regarding the preparation of a hybrid CD otherwise, I'll check back when I can and would be happy to try and answer questions. I just spent a good part of today figuring it out.

tell application "Finder"
activate
select file "AgencyBook.pdf" of folder "pdf" of disk "CD"
open selection
end tell

tell application "Finder"
close windows
end tell

Good Luck!

Deadweight
01-17-2007, 03:31 PM
So, everything seemed fine and dandy until I tested my hybrid CD on other Macs. Now I realized it occurs on mine as well, but not all the time. I'm getting a bug that only occurs the first time when I click on a link to an external Mac Projector from within my main Projector. It opens the finder window where my linked Projector resides, and pulls up the applescript icon on my dock, like it's reading my script and getting ready to launch the application, but it does nothing. My windows close out as I specify in the applescript:

tell application "Finder"
activate
select file "Mac_projector" of folder "project_folder" of disk "CD"
open selection
end tell

tell application "Finder"
close windows
end tell

But the application doesn't launch. After that first click (of a projector link), ALL external Projectors work fine when chosen to launch, even when I close out the main Projector and retry from the start. The only way I can repeat the bug is if I eject and reinsert my hyrid CD.

Has anyone else experienced this? I thought perhaps my close window script was occuring too quickly and not allowing my activate script to take hold, but when I added a delay inbetween actions, my finder windows just stayed up a little longer, then closed out, and the projector still didn't launch.

Iturraldec
09-13-2008, 02:27 PM
Hey Guys i found an even easier way to do this! you don't need to create a disc image in Toast or anything, all you have to do is copy and paste the code, change the name to whatever you need, save your applescript in the fscommand folder together with your PDF and that's it:

--set the name of the file to open
property fileName : "your_file.pdf"

--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
tell application "Finder"
open file targetFile
end tell


The ActionScript instruction is the same as in the other method posted:

fscommand ("exec", "your_applescript.app");

Enjoy!!!

Marissa
12-07-2009, 10:23 PM
Hi everyone,

I have a silly question (newbie here)
I'm using this code Zoomfreddy posted earlier:

tell application "Finder"
activate
select file "openMe.pdf" in folder "openable files folder" of disk "yourDiskNameHere"
open selection
end tell

But does this change my path in flash?, because:
on (release){
fscommand("exec","myscript");
is no longer working, I guess I should specify the "openable files folder"
I tried:
fscommand("exec","openable files folder:myscript");
but doesn't work =(