Python or Rhino Script Experience needed

I have an old Python Script that could be used to bulk edit a folder of 3dm files. It purpose was to zoom, shade, position, turn off grid and coordinate symbol. I had it written for me many years ago and there seems to be some errors that I am very unfamiliar with. I’m trying to find someone who could either correct the errors in the Python script or rewrite it as a rhino script so that I could use it on some models. Please let me know if you are interested I am more than happy to pay for the work and I can share with you the original script that was written for me which I believe would have all the necessary commands and such.

If you don’t mind sharing with the community, post the script here and I’m sure it will be fixed up in a matter of minutes.

This sounds oddly familiar - let me dig around…

-Pascal

Of course I believe in Sharing big time!! This is the script written with a text editor.

import rhinoscriptsyntax as rs
import System
import Rhino as R
import sys
import os
import scriptcontext

targetfolder = rs.BrowseForFolder()
print "Selecting all 3dm files in ", targetfolder

for i in os.listdir(targetfolder):
    if i.endswith(".3dm"):
        print "-------- processing ",i
        fullpath=os.path.join(targetfolder,i).lower()
        print "-------------- opening"
        rs.Command("_-Open "+chr(34)+fullpath+chr(34)+" _Enter _Enter", False)
        print "-------------- zooming extents"
        rs.Command("_-Zoom _All _Extents", False)
        print "-------------- setting active view to perspective"
        rs.Command("_-SetActiveViewport Perspective", False)
        print "-------------- setting viewmode to 1"
        rs.Command("_-SetDisplayMode Mode=Rendered", False)
        print "-------------- hiding grid"
        rs.ShowGrid(show=False)
        print "-------------- hiding gridaxes"
        rs.ShowGridAxes(show=False)
        print "-------------- getting layer"
        layer = scriptcontext.doc.Layers.CurrentLayer
        print "-------------- setting layer color"
        layer.Color = scriptcontext.doc.Layers.CurrentLayer.Color.Turquoise
        modifySuccess = scriptcontext.doc.Layers.Modify(layer, layer.LayerIndex, False)
        if( modifySuccess ): scriptcontext.doc.Views.Redraw()
        print "-------------- saving"
        rs.Command("_-Save "+chr(34)+fullpath+chr(34), False)
print "*******DONE*******"

Hi Bill - I do not know if this is Discourse formatting or what you have in the original but the double-quotes are incorrect:
image

(bottom, corrected in the editor)

I think this works:

import rhinoscriptsyntax as rs
import System
import Rhino as R
import sys
import os
import scriptcontext

targetfolder = rs.BrowseForFolder()
print "Selecting all 3dm files in ", targetfolder

for i in os.listdir(targetfolder):
    if i.endswith(".3dm"):
            print "-------- processing ",i
    fullpath=os.path.join(targetfolder,i).lower()
    print "-------------- opening"
    rs.Command("_-Open "+chr(34)+fullpath+chr(34)+" Enter Enter", False)
    print "-------------- zooming extents"
    rs.Command("-Zoom All Extents", False)
    print "-------------- setting active view to perspective"
    rs.Command("-SetActiveViewport Perspective", False)
    print "-------------- setting viewmode to 1"
    rs.Command("-SetDisplayMode Mode=Rendered", False)
    print "-------------- hiding grid"
    rs.ShowGrid(show=False)
    print "-------------- hiding gridaxes"
    rs.ShowGridAxes(show=False)
    print "-------------- getting layer"
    layer = scriptcontext.doc.Layers.CurrentLayer
    print "-------------- setting layer color"
    layer.Color = scriptcontext.doc.Layers.CurrentLayer.Color.Turquoise
    modifySuccess = scriptcontext.doc.Layers.Modify(layer, layer.LayerIndex, False)
    if( modifySuccess ): scriptcontext.doc.Views.Redraw()
    print "-------------- saving"
    rs.Command("-Save "+chr(34)+fullpath+chr(34), False)
print "DONE"

-Pascal

Pascal
Thank you so much I will give it a try.