JoelS Posted November 8, 2005 Share Posted November 8, 2005 I am attempting to use SubEthaEdit and AppleScript to send VS for execution in VW. My AppleScript is: tell application "SubEthaEdit" activate set theScript to the text of document 1 as string tell application "VectorWorks" activate DoScript theScript end tell end tell theScript variable is of class string and contains the command in the SubEthaEdit window as a string but VW returns an error that the data is of the wrong type. The "as string" is coercing from Unicode. If I simply change the tell for the application from "SubEthaEdit" to "Tex-Edit Plus" with the same data, it works fine and the command is executed. In both cases, the AppleScript editor shows the correct, identical string being passed to DoScript. What could be happening here and what is the AppleScript editor not showing me that could make the script fail? TIA, Joel. Quote Link to comment
JoelS Posted November 24, 2005 Author Share Posted November 24, 2005 With some help from the good folks at Vectorscript-L, I wrote the following AppleScript that will take a VectorScript from the front window of SubEthaEdit and execute it in VW, ignoring the usual AppleScript timeout if you are debugging: code: -- getplaintext subroutine called from within the Tell using 'of me' on getplaintext(fromUnicodeString) set styledText to fromUnicodeString as string set styledRecord to styledText as record return ?class ktxt? of styledRecord -- Ensure Western (Mac OS Roman) encoding end getplaintext tell application "SubEthaEdit" activate -- Get the script text out of SEE as a string. set theScript to the text of document 1 as string -- Convert from Unicode set theScript to getplaintext(theScript) of me tell application "VectorWorks" activate -- Execute the script in VW ignoring application responses DoScript theScript end ignoring end tell end tell[/code] The pascal syntax highlighting in SubEthaEdit does a good job and I like this editor better than BBEdit. Joel. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.