Jump to content
Developer Wiki and Function Reference Links ×

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

Link to comment

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
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...