Jump to content

Using AppleScript to trigger Python scripts in VW


Myke

Recommended Posts

Hello,

 

I was wondering if there was a good way to trigger a Python script in VW using AppleScript? There are some scripts that can be "installed"? if im not mistaken. Is it possible to have VW run that command when the AppleScript ask it too? I got a bit interested in this kind of workflow when Pat Standford mentioned it. 

 

If the answer is yes, then my follow up question would be: do I need to use an installation script ie. install.py to add the functionality?

Thanks

Edited by Myke
Link to comment
  • Myke changed the title to Using AppleScript to trigger Python scripts in VW

For anyone who is interested in similar functionality I have a base template as a starting point

on run {input, parameters}
	
	repeat 
	
	tell application "System Events"
		tell process "Vectorworks 2022"
			name of every menu of menu bar 1
			click menu item "menuItem" of menu "menuBarItem" of menu bar 1
		end tell
	end tell
	
	end repeat
	
	return input
end run

Cheers!

  • Like 1
Link to comment

Nice work!

 

Are you using this to run menu commands in Vectorworks from apple script?

 

Reminds me of this gem from 7 years ago 🙄

 

The über clever @James Russell figured out how to animate a car on a turntable with a script and so we figured out how to run a vector script inside an apple script to animate a door opening.

 

I keep meaning to try this from my stream deck to see if I can run scripts and skip going to the workspace editor and making them into menu commands.

 

 

 

Link to comment

Yes! This does run menu commands, apple script is surprisingly competent. I will need to make something similar in Windows, probably using PowerShell or similar. I'll add a similar template when that's good and ready.

 And for anyone who tries this out, I would first recommend removing the repeat syntax. The idea of this script is to have some automation of VW commands outside of the program, but it needs to constantly be checking if the app is open.

 

@michaelk That was the same post that pushed me to automating my python scripts
 

  • Laugh 1
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...