Is This Content Helpful?
We're glad to know this article was helpful.
This script will change the $HOME variable to the location of the active theme in the view. This will work regardless of the theme type. It will not set the variable to a directory that is not writable.
'-- This script is designed to run from either a script window
'-- or from a button attached to the View GUI.
'-- Get the view and the theme
theView = av.GetActiveDoc
theTheme = theView.GetActiveThemes.Get(0)
'-- Get the file name and strip out the theme name
'-- leaving only the directory path
theSrcName = theTheme.GetSrcName
theFileName = theSrcName.GetFileName
theLocation = theFileName.AsString.Substitute(theSrcName.GetName,"")
'-- Check the directory write permissions.
'-- If not writeable, let the user select one that is writable.
'-- Set the HOME variable.
If (File.IsWritable(theLocation.AsFileName)) then
MsgBox.Warning("The directory is not writable"+nl+
"Please select another directory","Bad Path")
theString = MsgBox.Input("Path to new home variable:",
"New Home Variable",System.GetEnvVar("HOME"))
If ((theString = nil) OR (File.IsWritable(theString.AsFileName).Not)) then
MsgBox.Info("No changes were made.","")
'-- Display the new path for the HOME variable.