Jump to content
Developer Wiki and Function Reference Links Read more... ×
Ben Wingrove

Script to automate publishing

Recommended Posts

We have a powerful machine in our office we would like to use for doing our publishing so we can free up resources on our personal machines.

 

We are using a piece of software that looks for new files in a folder and then runs a script on discovery.

Our ideal workflow would be to send a vwx file to this watch folder over the network and then when it is discovered it opens in vwx, vwx then does a publish to a set folder and then closes the vwx file.

 

Is this even possible any tips would be appreciated.

 

Thanks

 

Ben

Share this post


Link to post

Check out this thread.  Mac in Applescript (I have done this), ActiveX in Windows (I have no idea about this). Should be doable.

 

 

Share this post


Link to post

If I use an AppleScript to detect the new file and then get the file name as a variable can I then pass that to a vector script?

Share this post


Link to post

Kind of, the actual workflow is to store the script as part of the applescript and have it send the script to run to VW.

Share this post


Link to post

Something like this Applescript.  Note that the entire procedure Delay (a Vectorscript) is embedded in the applescript. You could use Applescript to modify what you send to the run Vectorscript command to do whatever you would like.  Later in the script is a simpler one line script to run a menu command in Vectorworks.

 

This script has been recompiled to work with VW2019, but has not been run since VW2010, so no guarantees. 

 

Posted here as a learning reference.

 

 

 

(* 	VW Batch DWG Rev 2.scpt
	Batch DWG Export from Vectorworks
	Patrick Stanford
	Coviana, Inc.
	pat@coviana.com
	October 23, 2009
	
This script is a demonstration of how to use Applescript
combined with VectorScript to open a series of VW2010 files one
at a time, perform some action on each file and then export
each one to DXF/DWG using the default settings. It
Automatically overwrites any previous export file in the
same location. If there is not export file it creates one.
It also saves the changes made to the original file by simulating a command-S.

Depending on the speed of the computer running the script and the size of the files, it may be necessary to extend some of the delays or to add delays at certain steps. The script was tested on a 2.53GHz MacBook Pro with three very small VW files.

The VectorScript code can be put into the Applescript in place of the Delay procedure either as raw text, or as a DoMenuTextByName call to a command installed in the current workspace.

I recommend an export be done manually to ensure that the proper settings and directlries are selected prior to running the script in automatic.  *)

tell application "Finder"
	set theFolder to (choose folder)
	set theFiles to files of theFolder whose file type is "DO15"
end tell


repeat with onefile in theFiles
	
	tell application "Vectorworks 2019"
		activate
		open onefile
		delay
		run VectorScript "
	
Procedure Delay;

Var N1:Integer;

Begin
For N1:=1 to 2 do
Begin
Message(Date(2,2),'  Delay:',N1);
Wait(1);			
End;
CreateText(Date(2,2));
End;

Run(Delay);"
		
		delay 2
		ignoring application responses
			
			run VectorScript "DoMenuTextByName('Export DXFDWG',0);"
		end ignoring
		
	end tell
	
	delay 2
	
	tell application "System Events"
		tell application process "Vectorworks 2010"
			key code 36 -- return to accept Export params
			delay 2 -- wait for next dialog box
			key code 36 -- return to accept file name and location
			delay 3 -- wait and see if we get replace yes/no dialog
			if title of window 1 as text = "" then
				keystroke "o" using {command down}
			end if
			
			delay 2 -- wait for dialog to be dismisses
			key code 1 using {command down} -- s key Save file
			
		end tell
	end tell
	
	delay 3
	tell application "Vectorworks 2019"
		close document 1 saving no
	end tell
	
end repeat

 

  • Like 2

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×