Update Preferences

From AdeptersWiki

Jump to: navigation, search

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 here [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

#Sets file variables.
	FileStuff= ActiveDoc.Path
	FileName = ActiveDoc.Name

#Sets frame variables.
	FrameWidth = ActiveDoc.Window.PageX
	FrameHeight = ActiveDoc.Window.PageY

#Revemoves bounding box.
	Unlock
	Select None
	select if pen is "No pen"
	Delete Selection	

#Saves file to source location.
	Save FileStuff

#Clears variable.
	LayerName = ""
	
#Creates new temp file.
	New
	Save "C:\Temp\Temp.iso"

#Activates source window.
	ACTIVATE WINDOW FileName

#Loops through each layer closing source file between each loop allowing for import layer function to run.

#Sets values of variables.
	i = ActiveDoc.LayerCount
	CurrentLayer = ActiveDoc.Layers[i]

#Starts loop that goes through all existing layers and adds each layer name to variable.
	While (i <> 0)
		
		CurrentLayer = ActiveDoc.Layers[i]
		
		LayerName = CurrentLayer.Name

		Close Confirm_No

		Import Layers FileStuff LayerName

		Open FileStuff
		i = i-1

	End While

#Closes source file.
	Close Confirm_No	

#Sets frame.	
	ActiveDoc.Window.PageX = FrameWidth
	ActiveDoc.Window.PageY = FrameHeight

#Enlarges frame to full screen.
	Zoom Page

#Saves temp file over source file.
	Save FileStuff

#Changes file to show it has not been modified.
	ActiveDoc.Modified = 0

End Macro
Personal tools