Re: Wierdness converting path to file spec...
Re: Wierdness converting path to file spec...
- Subject: Re: Wierdness converting path to file spec...
- From: Paul Berkowitz <email@hidden>
- Date: Sun, 09 Oct 2005 01:01:26 -0700
- Thread-topic: Wierdness converting path to file spec...
Try
tell application "Illustrator CS"
activate
try
set varFile to (tmpFilePath as file specification) --
-- etc.
The nature of 'file specification' type is that you need to coerce a string
path to it. You'll note that the result - even outside tell blocks (and even
running
file specification "Macintosh HD:private:tmp:ccp_cd_print_datasorc.xml"
there, as you did) is
--> file "Macintosh HD:private:tmp:ccp_cd_print_datasorc.xml"
NOT
file specification "Macintosh HD:private:tmp:ccp_cd_print_datasorc.xml"
Yet if you then try running
set varFile to file "Macintosh HD:private:tmp:ccp_cd_print_datasorc.xml"
it errors.
--
Paul Berkowitz
> From: Cliff Pruitt <email@hidden>
> Date: Sat, 8 Oct 2005 21:22:07 -0400
> To: <email@hidden>
> Subject: Wierdness converting path to file spec...
>
> Hey all...
> Do any of you see a reason for this goofiness? I normally use
> aliases for everything but Adobe Illustrator requires a file
> specification when telling it which XML file to import for data
> driven graphics. So I specify my tmp file as a property (other parts
> of the script take care of building the XML file):
>
> property tmpFilePath : "Macintosh
> HD:private:tmp:ccp_cd_print_datasorc.xml"
>
> and then later I use it to load into Illustrator. However here's the
> weird part. The following code will fail:
>
> tell application "Illustrator CS"
> activate
> try
> set varFile to (file specification (tmpFilePath)) --
> PROBLEM LINE
> set activeDoc to document "CCPascoCDTemplate.ai"
> import variables activeDoc from varFile
> delay 1
> display dataset "ccp_message_cd_print_data" of activeDoc
> on error theErrInfo
> display dialog theErrInfo as text
> end try
> end tell
>
>
>
> I get the error:
>
> Illustrator CS got an error: Cant get file specification "Macintosh
> HD:private:tmp:ccp_cd_print_datasorc.xml"
>
> But if I move it out of the illustrator tell block like so:
>
> try
> set varFile to (file specification (tmpFilePath))
> on error errInf
> display dialog errInf
> end try
>
>
> tell application "Illustrator CS"
> activate
> try
> set activeDoc to document "CCPascoCDTemplate.ai"
> import variables activeDoc from varFile
> delay 1
> display dataset "ccp_message_cd_print_data" of activeDoc
> on error theErrInfo
> display dialog theErrInfo as text
> end try
> end tell
>
>
>
>
> it all works fine. Its working, so its not a huge issue, but anyone
> have a rational reason for the difference? It also fails if I put
> the line in any other tell block (for example system events).
>
> More curiosity than anything.
>
> Cliff
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Applescript-users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden