First, I wanted to say, “Hello, world.” I came across these forums while working out some applescripts that I am trying to write to supplement a Filemaker database that I have been building. I should state up front that I am a novice coder, with experience limited mostly to Python and a primary school education in BASIC/Pascal. I have perused the tutorials and the Mac Developer Library and I have been unable to work through this problem on my own.
I am trying to write a program that takes a specific text file (specified by the user), calls a Perl script that converts that text into .SVG vector graphics, and then uses an ingenious (in my opinion) quicklook hack that generates a .PNG that I would like to embed in a Filemaker container.
Here’s the code that I’ve written (in short):
set thefile to POSIX path of (choose file)
do shell script "perl /Users/JoelR/Documents/Scripts/ape2svg.pl -i " & thefile as text
set newfile to (thefile as text) & ".svg"
set thefolder to folder of thefile
do shell script "qlmanage -t -s 640 -o " & thefolder & " " & newfile as text
The first three lines execute just fine. I have no problems getting the perl script to generate the .SVG and “newfile” looks like the POSIX path of the .svg that the script generates. I am unable to “strip” the folder pointer from the “thefile” alias. Because of this, I am unsure if the qlmanage call will even work.
The quicklook hack (which I found here) does not work as is. The current directory (specified by a period) symbol does not seem to work in this context. Anyways, I’m trying to tell quicklook to:
generate a thumbnail of my .SVG (option -t)
resize that thumbnail to 640x640 (option -s 640)
output to directory (option -o & thefolder)
all on the file that the user selected (newfile as text)
I understand that this is convoluted and that I could probably get a similar result with ImageMagick, but I want this script to run natively on Lion without any added packages. Does anyone know how to rectify this problem?
Thanks in advance!
Model: Macbook Air
Browser: Safari 537.4
Operating System: Mac OS X (10.7)