VS:PythonExecute: Difference between revisions

From Vectorworks Developer
Jump to navigation Jump to search
m (1 revision)
No edit summary
Line 34: Line 34:


-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
<remark></remark>
<remark>You can use PythonExecute to send a Python script to VW via AppleScript
    tell application "BBEdit"
          set thePyScript to contents of front window
          set theScript to "PythonExecute('" & thePyScript & "');"
    end tell
   
    tell application "Vectorworks 2014"
          activate
          DoScript theScript
    end tell
</remark>


-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------

Revision as of 17:24, 24 September 2013

Description

Execute the given python script.


You can use 'include' in python to run additional code in python files. However, before you execute the script make sure the python file are foundable through the PythonGetSearchPath. Use PythonSetSearchPath to change it.

Scripts executed via this function should not contain User Interactive functions like GetPt for example.

PROCEDURE PythonExecute(
script :DYNARRAY[] of CHAR);
def vs.PythonExecute(script):
    return None

Parameters

script DYNARRAY[] of CHAR The script to be executed.

Remarks

You can use PythonExecute to send a Python script to VW via AppleScript

    tell application "BBEdit"
         set thePyScript to contents of front window
         set theScript to "PythonExecute('" & thePyScript & "');"
    end tell
    
    tell application "Vectorworks 2014"
         activate
         DoScript theScript
    end tell

Version

Availability: from Vectorworks 2014

See Also

VS Functions:

VS:PythonGetSearchPath | VS:PythonSetSearchPath

VS Functions:

[[VS:PythonGetSearchPath]]

| [[VS:PythonSetSearchPath]]