Jump to content
Developer Wiki and Function Reference Links ×

Using SubEthaEdit with VW11.5.1


JoelS

Recommended Posts

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.

Link to comment
  • 3 weeks later...

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.

Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...