Script to use pdf2swf from SWFTOOLS... and more

Hi there, newbie here…

I am trying to learn AppleScript and at the same time write a script to convert PDF files to SWF files while renaming them.

I search a lot but couldn’t find much info about that.

Any help or links would be very appreciated.

There is a lot more I want to do but this is only the first steps of a project (not mine) that I want to convert from Windows (batch files) to Mac. The goal is to convert PDF file to Flipping Books (MZ3) on my Mac.

A scrip I found so far is a script to create folders from a text file where I will write the converted SWF files.

Btw, I do not want to just convert the .bat files to Applescript but really want to learn how to do it. And as I use my Mac most of the time now, I don’t feel using my PC anymore :wink:

Thanks a lot…


Model: iMac
Browser: Opera/9.80 (Macintosh; Intel Mac OS X; U; fr) Presto/2.6.30 Version/10.61
Operating System: Mac OS X (10.6)

I don’t know how to convert pdf to SWF. However, if you want to learn applescript I can help. Here’s a list of tutorials you can do on this website to learn it. This is how I learned applescript. I did the ones titled “AppleScript Tutorial for Beginners”.

Well… Indeed, it’s part of what I began browsing, and I just realized that it’s not the lack of info that makes it harder, on the contrary, there is so much info that it is just harder to find something because of that.

The other problem is some info is not true any more, causing errors in programs.

Yesterday, I was able to execute the pdf2swf but I had to give the complete path. I am now working on the best way to find and attribute the path to a string. etc…



That’s why I told you to focus on “AppleScript Tutorial for Beginners”.

If under the “Window” menu in AppleScript editor you choose Library, then double-click on “Standard Additions”, you will open up the dictionary for it. It has all the standard applescript commands that don’t require telling an application to do something. Search for “path to”. In its definition you’ll see this… path to application support/applications folder/desktop etc. It lists lots of folders you can specify with that command. As such the “path to” command allows you to get the path to most of the standard folders on your hard drive. This makes it easy to write paths. For example if you have a file called “pdf2swf” in your documents folder you could easily write its path like this…

set pdf2swfPath to (path to documents folder as text) & "pdf2swf"

Notice I had to first coerce the path (which you get in the form of an alias using the path to command) to a string so that I could add the filename string to it. Now you have the full path to your file as a string. Applescript uses hfs-style paths which are colon delimited. If you want to pass a path to the shell, unix uses posix paths which are slash delimited so you’d need to convert that before using it with the shell like this…

do shell script quoted form of POSIX path of pdf2swfPath

Paths confused me at first too. It just takes practice… do the tutorials! :stuck_out_tongue:

Thanks you got me started. I didn’t know about the Library. And it helped me a lot.

Still have problems, but I’m reading…