developer:scriptsamples:supersaver


Saving File Summary Information

Developer: RhinoScript
Summary: Demonstrates how to display the File Properties dialog when saving Rhino files.

Question

When you right-click on a file, using Windows Explorer, and pick “Properties…”, to bring up the File Properties dialog, you can add summary information to a file by clicking on the Summary tab and entering the appropriate information. For example:

rssupersaver.jpg

Is there a way to bring up this dialog when saving Rhino files?

Answer

Rhino does not have this capability. But, it is possible to create a script, using RhinoScript that will do this.

The following sample script will save the Rhino file by scripting Rhino's Save command. If the command was successful in saving the file, script will then display the File Properties dialog and display the summary information for that file.

RhinoScript

 Sub SuperSaver()
   Rhino.Command "_Save"
   If (0 = Rhino.LastCommandResult()) Then
     Dim objShell, objFolder, objFolderItem, objInfo
     Set objShell = CreateObject("Shell.Application")
     Set objFolder = objShell.NameSpace(Rhino.DocumentPath)
     If (Not objFolder Is Nothing) Then
       Set objFolderItem = objFolder.ParseName(Rhino.DocumentName)
       If (Not objFolderItem Is Nothing) Then
         Call objFolderItem.InvokeVerbEx("properties", "summary")
       End If
       Set objFolderItem = Nothing
     End If
     Set objFolder = Nothing
     Set objShell = Nothing
   End If
 End Sub

Rhino Toolbar Button Macro

   -NoEcho -RunScript (
   Rhino.Command "_Save"
   If (0 = Rhino.LastCommandResult()) Then
   Set objShell = CreateObject("Shell.Application")
   Set objFolder = objShell.NameSpace(Rhino.DocumentPath)
   If (Not objFolder Is Nothing) Then
   Set objFolderItem = objFolder.ParseName(Rhino.DocumentName)
   If (Not objFolderItem Is Nothing) Then
   Call objFolderItem.InvokeVerbEx("properties", "summary")
   End If
   Set objFolderItem = Nothing
   End If
   Set objFolder = Nothing
   Set objShell = Nothing
   End If
   )


developer/scriptsamples/supersaver.txt · Last modified: 2010/03/11 23:17 by dale Driven by DokuWiki Recent changes RSS feed

 © 1997-2012 

McNeel North America Europe Latin AmericaAsia