two (probably simple) questions: pict files

So, if you don’t count me spending all day researching it, I’m brand new to Applescript. I was hoping that someone here would have some answers to a couple of basic questions.

  1. I’ve seen that you can create pict files from jpg, gif, png files but have no idea where to begin coding that. Could someone point me in the right direction?

  2. How would you read from a txt or xml file?

What I want to do is have a txt file that has something like:

Then the app could read that path and know where to look for the jpg that needs to turn into a pict

thank’s for any and all help. It’s hugely appreciated

For reading text files:

set valtext to (read alias “path:to:file.txt”) as string

However if this is like your property file it might be better to just put

property [your variable name] : [default value]

at the top, the variable will be the default value after compiles but retain its set value between runs.

Look at this:

property valtimes : 0

set valtimes to valtimes+1
display dialog valtimes

And this:

property valtext : "Default text"

set valtext to text returned of (display dialog "The property:" default answer valtext)

Hi Shane

You have a few options with converting image formats, but you will need to decide which program to convert them in, an obvious choice would be Photoshop but understandably not everyone has this.
The next would be image events (free and already on your mac) which is a small inter-faceless app which can be scripted to manipulate images.
and finally i reckon you could go the command line route (Not too sure on this one!) but imagine it can be done.
There probably is other third party image apps which are scriptable as well.
The majority of these will be able to deal with the formats your wanting to convert to and from.

As for reading Text i guess you could use the read or write commands which live in your standard additions dictionary
to access plain text, or say for example your text was in “textedit” then script that app directly.
For the Xml then i’m not sure.

So on this site you should be searching for Photoshop,Image events etc. even the extension jpg,PICT,png.
For the text search for “open for access”,read, write text files, textedit etc.

I hope this is of some help.