Script request
All  1-5  6-12

Previous
Next
 From:  shayno
11746.6 In reply to 11746.4 
Hi Michal
is it possible at the end of the script to have it copy the 3dm filename into the clipboard also ?
cheers
shayne
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
11746.7 In reply to 11746.6 
Hi shayne,

re:
> is it possible at the end of the script to have it copy the 3dm filename into the clipboard also ?

Yes, try this one:

script: var folder = 'c:\\scripts\\'; var filename = moi.geometryDatabase.currentFileName; if ( filename ) { var index = filename.lastIndexOf( '.' ); if ( index != -1 ) { filename = filename.substr( 0, index ) + '.stl'; filename = folder + moi.filesystem.getFileNameFromPath( filename ); moi.geometryDatabase.saveAs( filename, 'NoUI=true;Angle=3' ); } moi.copyTextToClipboard( filename ); }

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  shayno
11746.8 
Hi Michael
It copied the full path c:\to print\filename.stl

I just need the filename only if that is possible without any .stl or .3dm
Thanks
shayne
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
11746.9 In reply to 11746.8 
Hi shayne, try this one:

script: var folder = 'c:\\scripts\\'; var filename = moi.geometryDatabase.currentFileName; if ( filename ) { var index = filename.lastIndexOf( '.' ); if ( index != -1 ) { var basename = filename.substr( 0, index ); filename = basename + '.stl'; filename = folder + moi.filesystem.getFileNameFromPath( filename ); moi.geometryDatabase.saveAs( filename, 'NoUI=true;Angle=3' ); moi.copyTextToClipboard( moi.filesystem.getFileNameFromPath(basename) ); } }

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  shayno
11746.10 In reply to 11746.9 
Thanks Michael

it errors

ReferenceError: Can't find variable: basename

line 1

1: >> var folder = 'D:\\To Print Morris and Watson\\'; var filename = moi.geometryDatabase.currentFileName; if ( filename ) { var index = filename.lastIndexOf( '.' ); if ( index != -1 ) { filename = filename.substr( 0, index ) + '.stl'; filename = folder + moi.filesystem.getFileNameFromPath( filename ); moi.geometryDatabase.saveAs( filename, 'NoUI=true;Angle=3' ); moi.copyTextToClipboard( moi.filesystem.getFileNameFromPath(basename) ); } }

If its too hard to do don't spend any time on it
cheers
shayne
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
11746.11 In reply to 11746.10 
Hi shayne,

re:
> it errors
>
> ReferenceError: Can't find variable: basename

It looks like you only copied the last piece of the above script?

You are missing this part in the new version above:

script: var folder = 'c:\\scripts\\'; var filename = moi.geometryDatabase.currentFileName; if ( filename ) { var index = filename.lastIndexOf( '.' ); if ( index != -1 ) { var basename = filename.substr( 0, index ); filename = basename + '.stl'; filename = folder + moi.filesystem.getFileNameFromPath( filename ); moi.geometryDatabase.saveAs( filename, 'NoUI=true;Angle=3' ); moi.copyTextToClipboard( moi.filesystem.getFileNameFromPath(basename) ); } }

Try copying the entire script from above not just the ending part.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  shayno
11746.12 
Works perfect thanks shayne
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All

 

 
 
Show messages: All  1-5  6-12