AppleScript Help - Please...

This area contains the messages from the old Yahoo gcmac group after the port.
thorstenlemke
Posts: 0
Joined: Fri Dec 30, 2016 12:00 pm

Re: AppleScript Help - Please...

Post by thorstenlemke »

Re: [gcmac] Re: AppleScript Help - Please... Hi, do you use the current 5.9.5? It supports long filenames. Thorsten Von: Greg Keene <greg@gregkeene.com> Antworten an: <gcmac@yahoogroups.com> Datum: Tue, 17 Apr 2007 02:05:29 -0000 An: <gcmac@yahoogroups.com> Betreff: [gcmac] Re: AppleScript Help - Please...       Unfortunately, due to the number of files to process, displaying isn't something that will work, so I'm going to use the convert file function. What I figured out is that if I run GraphicConverter first, open Convert & Modify and assure that my JPEG settings are what I want for the destination, that it'll use those settings in the convert command. The odd thing is that if I don't do that and leave it open, it won't add .jpg to the end of the file name. I'm not expecting an explanation here, but it is something odd that may be worth looking into, if you need more information, please let me know. My question now, is whether the convert file (see below) has a length limit for file names (represented by this_item). What I'm noticing is that longer files get renamed in odd ways with a #3AB233 (or similar) inserted in the middle - note my batch function adds _120 (or another 3-digit number to the end of the file). So, is there a limit, is there a way to overcome it? convert file (this_item as file specification) using batch (":120.batch" as file specification) to folder outpathName ORIGINAL FILE NAME:    9856365_20041299KXJ4443-IMG_6654_01.tif EXPECTED FILE NAME:    9856365_20041299KXJ4443-IMG_6654_01_120.jpg FILENAME OUTPUT BY GC: 9856365_20041299KXJ4#3AB284_120.jpg Any ideas? Thanks! Greg
Greg Keene
Posts: 0
Joined: Sat Apr 14, 2007 7:35 pm

Re: AppleScript Help - Please...

Post by Greg Keene »

I'm running 5.9.5 I386 and got the results below. Any ideas? Greg --- In gcmac@yahoogroups.com, Thorsten Lemke <lemkesoft@...> wrote: > > Hi, > > do you use the current 5.9.5? > It supports long filenames. > > Thorsten > > > > Von: Greg Keene <greg@...> > Antworten an: <gcmac@yahoogroups.com> > Datum: Tue, 17 Apr 2007 02:05:29 -0000 > An: <gcmac@yahoogroups.com> > Betreff: [gcmac] Re: AppleScript Help - Please... > > > > > > Unfortunately, due to the number of files to process, displaying isn't > something that will work, so I'm going to use the convert file function. > > What I figured out is that if I run GraphicConverter first, open > Convert & Modify and assure that my JPEG settings are what I want for > the destination, that it'll use those settings in the convert command. > The odd thing is that if I don't do that and leave it open, it won't > add .jpg to the end of the file name. I'm not expecting an explanation > here, but it is something odd that may be worth looking into, if you > need more information, please let me know. > > My question now, is whether the convert file (see below) has a length > limit for file names (represented by this_item). What I'm noticing is > that longer files get renamed in odd ways with a #3AB233 (or similar) > inserted in the middle - note my batch function adds _120 (or another > 3-digit number to the end of the file). So, is there a limit, is there > a way to overcome it? > > convert file (this_item as file specification) using batch > (":120.batch" as file specification) to folder outpathName > > ORIGINAL FILE NAME: 9856365_20041299KXJ4443-IMG_6654_01.tif > EXPECTED FILE NAME: 9856365_20041299KXJ4443-IMG_6654_01_120.jpg > FILENAME OUTPUT BY GC: 9856365_20041299KXJ4#3AB284_120.jpg > > Any ideas? > > Thanks! > > Greg >
thorstenlemke
Posts: 0
Joined: Fri Dec 30, 2016 12:00 pm

Re: AppleScript Help - Please...

Post by thorstenlemke »

Re: [gcmac] Re: AppleScript Help - Please... Hi, can I get your settings, some sample files and the instriuctions to reproduce the problem? Thorsten ( Von: Greg Keene <greg@gregkeene.com> Antworten an: <gcmac@yahoogroups.com> Datum: Tue, 17 Apr 2007 18:14:43 -0000 An: <gcmac@yahoogroups.com> Betreff: [gcmac] Re: AppleScript Help - Please...       I'm running 5.9.5 I386 and got the results below. Any ideas? Greg --- In gcmac@yahoogroups.com <mailto:gcmac%40yahoogroups.com> , Thorsten Lemke <lemkesoft@...> wrote: > > Hi, > > do you use the current 5.9.5? > It supports long filenames. > > Thorsten > > > > Von: Greg Keene <greg@...> > Antworten an: <gcmac@yahoogroups.com <mailto:gcmac%40yahoogroups.com> > > Datum: Tue, 17 Apr 2007 02:05:29 -0000 > An: <gcmac@yahoogroups.com <mailto:gcmac%40yahoogroups.com> > > Betreff: [gcmac] Re: AppleScript Help - Please... > >   >   >   > > Unfortunately, due to the number of files to process, displaying isn't > something that will work, so I'm going to use the convert file function. > > What I figured out is that if I run GraphicConverter first, open > Convert & Modify and assure that my JPEG settings are what I want for > the destination, that it'll use those settings in the convert command. > The odd thing is that if I don't do that and leave it open, it won't > add .jpg to the end of the file name. I'm not expecting an explanation > here, but it is something odd that may be worth looking into, if you > need more information, please let me know. > > My question now, is whether the convert file (see below) has a length > limit for file names (represented by this_item). What I'm noticing is > that longer files get renamed in odd ways with a #3AB233 (or similar) > inserted in the middle - note my batch function adds _120 (or another > 3-digit number to the end of the file). So, is there a limit, is there > a way to overcome it? > > convert file (this_item as file specification) using batch > (":120.batch" as file specification) to folder outpathName > > ORIGINAL FILE NAME:    9856365_20041299KXJ4443-IMG_6654_01.tif > EXPECTED FILE NAME:    9856365_20041299KXJ4443-IMG_6654_01_120.jpg > FILENAME OUTPUT BY GC: 9856365_20041299KXJ4#3AB284_120.jpg > > Any ideas? > > Thanks! > > Greg >
Greg Keene
Posts: 0
Joined: Sat Apr 14, 2007 7:35 pm

Re: AppleScript Help - Please...

Post by Greg Keene »

I've sent them to you directly. Thank you!Greg --- In gcmac@yahoogroups.com, Thorsten Lemke <lemkesoft@...> wrote:>> Hi,> > can I get your settings, some sample files and the instriuctions to> reproduce the problem?> > Thorsten> > (> > Von: Greg Keene greg@...> Antworten an: gcmac@yahoogroups.com> Datum: Tue, 17 Apr 2007 18:14:43 -0000> An: gcmac@yahoogroups.com> Betreff: [gcmac] Re: AppleScript Help - Please...> > > > > > I'm running 5.9.5 I386 and got the results below. Any ideas?> > Greg> > --- In gcmac@yahoogroups.com <mailto:gcmac%40yahoogroups.com> , Thorsten> Lemke lemkesoft@ wrote:> >> > Hi,> > > > do you use the current 5.9.5?> > It supports long filenames.> > > > Thorsten> > > > > > > > Von: Greg Keene greg@> > Antworten an: gcmac@yahoogroups.com <mailto:gcmac%40yahoogroups.com> >> > Datum: Tue, 17 Apr 2007 02:05:29 -0000> > An: gcmac@yahoogroups.com <mailto:gcmac%40yahoogroups.com> >> > Betreff: [gcmac] Re: AppleScript Help - Please...> > > > > > > > > > > > Unfortunately, due to the number of files to process, displaying isn't> > something that will work, so I'm going to use the convert file function.> > > > What I figured out is that if I run GraphicConverter first, open> > Convert & Modify and assure that my JPEG settings are what I want for> > the destination, that it'll use those settings in the convert command.> > The odd thing is that if I don't do that and leave it open, it won't> > add .jpg to the end of the file name. I'm not expecting an explanation> > here, but it is something odd that may be worth looking into, if you> > need more information, please let me know.> > > > My question now, is whether the convert file (see below) has a length> > limit for file names (represented by this_item). What I'm noticing is> > that longer files get renamed in odd ways with a #3AB233 (or similar)> > inserted in the middle - note my batch function adds _120 (or another> > 3-digit number to the end of the file). So, is there a limit, is there> > a way to overcome it?> > > > convert file (this_item as file specification) using batch> > (":120.batch" as file specification) to folder outpathName> > > > ORIGINAL FILE NAME: 9856365_20041299KXJ4443-IMG_6654_01.tif> > EXPECTED FILE NAME: 9856365_20041299KXJ4443-IMG_6654_01_120.jpg> > FILENAME OUTPUT BY GC: 9856365_20041299KXJ4#3AB284_120.jpg> > > > Any ideas?> > > > Thanks!> > > > Greg> >>
Rowland & Wilma Carson
Posts: 0
Joined: Sun Mar 11, 2007 1:10 am

very basic applescript help, please

Post by Rowland & Wilma Carson »

I want to produce a series of small GIFs, each containing just some text in a particular face (font). It struck me that this is an ideal job for AppleScript. However, I've not used AppleScript in anger for along time so am fairly rusty on it, and I've never tried to script GraphicConverter. It appears that GC is not recordable. I've always found that an excellent way to start brewing AppleScripts in the past, but of course the application must be designed as recordable. I thought I'd start by just trying to create a new empty window, drawing the text in it, and saving it. I can't seem to see how to do step 1 - open a new window. The GC dictionary does not seem to include anything that looks right. So, plan B was to try opening an existing file and working on that. Even that seems to be beyond me! The following script compiles OK: = = = = = = = = = = = = = = = = = = = = = = tell application "GraphicConverter" open file "/Users/Rowland/Development/Scripting/AppleScript/graphicconverter_stuff/test.gif" draw text into text = "test text" -- text to draw justification = 0 -- (0=left, 1=right, 2=center) color = {0, 0, 0} -- text color box = {0, 0, 120, 12} -- bounding box font = "Lucida Handwriting" -- font name size = 14 -- font size save window 1 in "/Users/Rowland/Development/Scripting/AppleScript/graphicconverter_stuff/test.gif" as GIF end tell = = = = = = = = = = = = = = = = = = = = = = But when I run it, I get the AppleScript Error message: GraphicConverter got an error: Can't get file "/Users/Rowland/Development/Scripting/AppleScript/graphicconverter_stuff/test.gif". Access not allowed. I've checked that the test file itself and all the enclosing folders are readable by all and sundry. I got TextWrangler to construct the path string, to avoid any typos in it, and just pasted it into the script. I also pasted in the "draw text into" format from the dictionary to make sure I wasn't getting anything out of order - that's why it't so well-commented. So, 2 questions: (1) How do I Applescript GraphicConverter to create a new window? (2) Am I doing something really stupid that prevents AppleScript accessing the test file? (I'm sure that if I manage to create a new window I'll have a similar problem when I come to save it.) Environment: PowerBook G4 Ti 15" 1GHz, 1GB RAM Mac OS 10.3.9 GraphicConverter V5.9.3 X PowerPC (CFM) Script Editor 2.0 (v43.1) AppleScript 1.9.3 I recognise that this is not an AppleScript forum, but I suspect the knowledge required for an answer relates more to GC than to AS generally. (I'm happy to ask elsewhere if no-one here can help.) regards Rowland -- : Wilma & Rowland Carson http://home.clara.net/rowil/ : <rowil@clara.net> ... that's Rowland with a 'w' ...
thorstenlemke
Posts: 0
Joined: Fri Dec 30, 2016 12:00 pm

Re: very basic applescript help, please

Post by thorstenlemke »

Re: [gcmac] very basic applescript help, please Hello, do you use the UB version? Use as file ref: Disk:Folder:....:Name.jpg”. Thorsten (important note: please always include this complete email in your reply) ----------------------------------------------------------------- Thorsten Lemke Lemke Software GmbH Zum Rohkamp 5e 31228 Peine Germany Phone: +49 5171 72200 Fax:   +49 5171 72201 WWW:   http://www.lemkesoft.com E-Mail:lemke@lemkesoft.com Business details (required by German law): Amtsgericht Hildesheim HRB 101500 Geschäftsführer Dipl.-Ing. Thorsten Lemke USt.IdNr. DE813426251 ----------------------------------------------------------------- Von: Rowland & Wilma Carson <rowil@clara.net> Antworten an: <gcmac@yahoogroups.com> Datum: Mon, 23 Apr 2007 21:06:00 +0100 An: <gcmac@yahoogroups.com> Betreff: [gcmac] very basic applescript help, please       I want to produce a series of small GIFs, each containing just some text in a particular face (font). It struck me that this is an ideal job for AppleScript. However, I've not used AppleScript in anger for along time so am fairly rusty on it, and I've never tried to script GraphicConverter. It appears that GC is not recordable. I've always found that an excellent way to start brewing AppleScripts in the past, but of course the application must be designed as recordable. I thought I'd start by just trying to create a new empty window, drawing the text in it, and saving it. I can't seem to see how to do step 1 - open a new window. The GC dictionary does not seem to include anything that looks right. So, plan B was to try opening an existing file and working on that. Even that seems to be beyond me! The following script compiles OK: = = = = = = = = = = = = = = = = = = = = = = tell application "GraphicConverter" open file "/Users/Rowland/Development/Scripting/AppleScript/graphicconverter_stuff/test.gif" draw text into text = "test text" -- text to draw justification = 0 -- (0=left, 1=right, 2=center) color = {0, 0, 0} -- text color box = {0, 0, 120, 12} -- bounding box font = "Lucida Handwriting" -- font name size = 14 -- font size save window 1 in "/Users/Rowland/Development/Scripting/AppleScript/graphicconverter_stuff/test.gif" as GIF end tell = = = = = = = = = = = = = = = = = = = = = = But when I run it, I get the AppleScript Error message: GraphicConverter got an error: Can't get file "/Users/Rowland/Development/Scripting/AppleScript/graphicconverter_stuff/test.gif". Access not allowed. I've checked that the test file itself and all the enclosing folders are readable by all and sundry. I got TextWrangler to construct the path string, to avoid any typos in it, and just pasted it into the script. I also pasted in the "draw text into" format from the dictionary to make sure I wasn't getting anything out of order - that's why it't so well-commented. So, 2 questions: (1) How do I Applescript GraphicConverter to create a new window? (2) Am I doing something really stupid that prevents AppleScript accessing the test file? (I'm sure that if I manage to create a new window I'll have a similar problem when I come to save it.) Environment: PowerBook G4 Ti 15" 1GHz, 1GB RAM Mac OS 10.3.9 GraphicConverter V5.9.3 X PowerPC (CFM) Script Editor 2.0 (v43.1) AppleScript 1.9.3 I recognise that this is not an AppleScript forum, but I suspect the knowledge required for an answer relates more to GC than to AS generally. (I'm happy to ask elsewhere if no-one here can help.) regards Rowland
Tom Robinson
Posts: 0
Joined: Sun Oct 19, 2003 6:13 am

Re: very basic applescript help, please

Post by Tom Robinson »

On 2007-04-24, at 08:06, Rowland & Wilma Carson wrote: > I can't seem to see how to do step 1 - open a new window. The GC > dictionary does not seem to include anything that looks right. tell application "GraphicConverter" make new window with properties {name:"hello"} end tell 'make' is pretty standard AppleScript. Check under 'window' in GC's dictionary for all the properties you can set--there's stacks of them.
Rowland & Wilma Carson
Posts: 0
Joined: Sun Mar 11, 2007 1:10 am

Re: very basic applescript help, please

Post by Rowland & Wilma Carson »

At 2007-04-24 19:24 +1200 Tom Robinson wrote: >On 2007-04-24, at 08:06, Rowland & Wilma Carson wrote: > >> I can't seem to see how to do step 1 - open a new window. The GC >> dictionary does not seem to include anything that looks right. > >tell application "GraphicConverter" > make new window with properties {name:"hello"} >end tell Tom - thanks for your response. The posting about putting unicode text into a GC window, which crossed in the ether with my own, prodded me in the right direction. I'd been working in several other scripting and programming languages and maybe my brain was full of inappropriate stuff, plus it was too late at night! If anyone cares, here's what works for me: = = = = = = = = = = = = = = = = = = = = = = = set myString to "test text" tell application "GraphicConverter" activate make new window with properties {bounds:{20, 40, 300, 70}, image bit depth:1} draw textline into window 1 text myString justification 0 color {0, 0, 0} point {5, 15} font "Lucida Handwriting" size "14" set myFilename to "PowerBook HD:Users:Rowland:Development:Scripting:AppleScript:graphicconverter_stuff:testsave.gif" save window 1 in myFilename as GIF close window 1 end tell = = = = = = = = = = = = = = = = = = = = = = = I have already set manually the default size of the new GC window to 210x21 to suit the largest text I will generate, and I want all the resulting GIFs to be the same size, so I'm not making any changes such as trim window or change margins within the script. It's actually going to be used from within a FileMker Pro script, with the string and the filename provided through a FMP calulation. regards Rowland -- : Wilma & Rowland Carson http://home.clara.net/rowil/ : <rowil@clara.net> ... that's Rowland with a 'w' ...
Gnarlodious
Posts: 0
Joined: Thu Apr 22, 2004 4:40 pm

Re: very basic applescript help, please

Post by Gnarlodious »

On 4/24/07, Rowland & Wilma Carson wrote: > If anyone cares, here's what works for me: > set myString to "test text" > tell application "GraphicConverter" > activate > make new window with properties {bounds:{20, 40, 300, 70}, > image bit depth:1} > draw textline into window 1 text myString justification 0 > color {0, 0, 0} point {5, 15} font "Lucida Handwriting" size "14" > set myFilename to "PowerBook > HD:Users:Rowland:Development:Scripting:AppleScript:graphicconverter_stuff:testsave.gif" > save window 1 in myFilename as GIF > close window 1 > end tell Cool script, except you should start like this: set myString to "test text" tell application "Finder" to set myFilename to (home as string) & "Development:Scripting:AppleScript:graphicconverter_stuff:testsave.gif" That way the file path is not hardcoded inside the script. -- Gnarlie
Gnarlodious
Posts: 0
Joined: Thu Apr 22, 2004 4:40 pm

Re: very basic applescript help, please

Post by Gnarlodious »

On 4/24/07, Rowland & Wilma Carson wrote: > If anyone cares, here's what works for me: > set myString to "test text" > tell application "GraphicConverter" > activate > make new window with properties {bounds:{20, 40, 300, 70}, > image bit depth:1} > draw textline into window 1 text myString justification 0 > color {0, 0, 0} point {5, 15} font "Lucida Handwriting" size "14" > set myFilename to "PowerBook > HD:Users:Rowland:Development:Scripting:AppleScript:graphicconverter_stuff:testsave.gif" > save window 1 in myFilename as GIF > close window 1 > end tell Cool script, except you should start like this: set myString to "test text" tell application "Finder" to set myFilename to (home as string) & "Development:Scripting:AppleScript:graphicconverter_stuff:testsave.gif" That way the file path is not hardcoded inside the script. -- Gnarlie
Post Reply