Jump to content

Batch Converting - Open, Change and Close Files with python


Recommended Posts

Hello,

I'm working on a script which changes the units off all VWX files in a folder.

The Problem is that the file opens to late when the script is already finished. I also tried it with the sleep () command.

Is there a way to open a file and make it active within a function?


def main ():    

   # Get File
   succes, path = vs.GetFileN('', None, None)

   # Open File

   if get_OS_Code() == OS_WIN:
       # Windows command
       os.system('start' + path )
   else:
       # Mac command
       os.system('open  ' + path ) 

   # Set Units 
   Millimeters =     7
   Centimeters =   8
   Meters = 9
   Kilometers = 10

   vs.Units (Centimeters)

   # Save the File
   vs.DoMenuTextByName("Save", 0)

   # Close the File
   vs.DoMenuTextByName("Close", 0)

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...