Update Preferences

Answered by: Trevor Hendricks Last Updated: 2006-07-06

Description
Here’s another useful macro. This updates the iso file by basically recreating. One major drawback, at least for us, is that due to the method, all auto-generated IDs are reset.

We’ve used this for the obvious, but also to address files from other internal areas and vendors. Sometimes we get font errors when we open the file because a vendor has a funky font installed and it’s embedded into the iso file. Using this cleans that problem up.

Code
Download the .ism file [TAR]

Global FilePath as String Global FileStuff as String Global FileName as String Global FrameWidth as Float Global FrameHeight as Float Global SaveFile as String Global LayerName as String Global i as Integer Global CurrentLayer as Layer Macro Update FileStuff= ActiveDoc.Path FileName = ActiveDoc.Name FrameWidth = ActiveDoc.Window.PageX FrameHeight = ActiveDoc.Window.PageY Unlock Select None select if pen is "No pen" Delete Selection Save FileStuff LayerName = "" New Save "C:\Temp\Temp.iso" ACTIVATE WINDOW FileName i = ActiveDoc.LayerCount CurrentLayer = ActiveDoc.Layers[i] While (i <> 0) CurrentLayer = ActiveDoc.Layers[i] LayerName = CurrentLayer.Name Close Confirm_No Import Layers FileStuff LayerName Open FileStuff i = i-1 End While Close Confirm_No ActiveDoc.Window.PageX = FrameWidth ActiveDoc.Window.PageY = FrameHeight Zoom Page Save FileStuff ActiveDoc.Modified = 0 End Macro
 * 1) Sets file variables.
 * 1) Sets frame variables.
 * 1) Revemoves bounding box.
 * 1) Saves file to source location.
 * 1) Clears variable.
 * 1) Creates new temp file.
 * 1) Activates source window.
 * 1) Loops through each layer closing source file between each loop allowing for import layer function to run.
 * 1) Sets values of variables.
 * 1) Starts loop that goes through all existing layers and adds each layer name to variable.
 * 1) Closes source file.
 * 1) Sets frame.
 * 1) Enlarges frame to full screen.
 * 1) Saves temp file over source file.
 * 1) Changes file to show it has not been modified.