Re: Applescript, VectorScript & VectorWorks--a solution
Re: Applescript, VectorScript & VectorWorks--a solution
- Subject: Re: Applescript, VectorScript & VectorWorks--a solution
- From: Dan Belfiori <email@hidden>
- Date: Fri, 22 Oct 2004 06:05:07 -0700
I've been struggling for quite a while with the following text problem.
Am I missing something obvious?
I'm using applescript to assemble and run VectorScripts (Scripting
language for VectorWorks)
The following script demonstrates the problem I can't solve.
--Begin applescript--------------------------
set TestList to {"Printer1", "Printer2"}
tell application "Printer Setup Utility" to set PrinterList to the
name of every printer
tell application "Finder" to set AppNames to the name of every
application process
AssembleScript(TestList) --this works
AssembleScript(AppNames) --this fails "VectorWorks got an error: Some
data was the wrong type."
AssembleScript(PrinterList) --this fails "VectorWorks got an error:
Some data was the wrong type."
on AssembleScript(SomeList)
set VWtext to "Procedure Test;" & return & "BEGIN" & return
repeat with anitem in SomeList
set VWtext to VWtext & "AlrtDialog('" & anitem & "');" & return
end repeat
set VWtext to VWtext & "END;" & return & "Run(Test);"
tell application "VectorWorks"
activate
DoScript VWtext
end tell
end AssembleScript
--end applescript-----------------------
When I paste the text of the failed script (captured from the
clipboard in handler AssembleScript above) in an applescript:
tell application "VectorWorks"
activate
doscript "<<pasted text>>"
end tell
the script succeeds!? something in the way the text is formatted in
variables and clipboard is fooling VW
db
I found a work-around. I'm writing the text to a file and reading it
back... that somehow gets rid of the text formatting that's causing VW
to error. I think it has to do with unicode text. The list names are
classified as unicode text strings. And even a manipulation like :
Repeat with Anitem in Somelist
Copy Anitem as text to end of Newlist
...
doesn't stop the error.
db
_______________________________________________
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