Possible to change ImportPointFile.htm ?

Next
 From:  jpvikholm
4486.1 
Hi,

I would like to change ImportPointFile.htm command so that it would always import same pointfile contents with one button click. Main idea is basically to update this file in external applications (AutoCAD, Excel etc) and then import it to Moi3D without selecting file. I use Windows 7 Ultimate and selecting file take long time. Is this possible? Unfortunately my knowledge about Moi3D's programming is very limited... any help is appreciated.


- J-P

EDITED: 5 Sep 2011 by JPVIKHOLM

  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
4486.2 In reply to 4486.1 
Hi J-P you mean you want to have it import a hard-coded specific file name instead of asking you for the filename?

It should be possible to do that by modifying the script. To do that open up the file ImportPointFile.js in notepad and look for the section that has this:

code:
function ImportPointFile()
{
	var filename = moi.filesystem.getOpenFileName( 'Choose a point file', 'Point files (<...>) );
        <....>


That line that says var filename = .... is the one that is triggering the file dialog to ask you to select a name.

If you change that line to put a specific path in there then it should work like you want.

The way you would do that is to make that line say something like this:

var filename = 'c:\\some folder\\myfile.txt';

So a couple of things to note there - put quote characters ' ' around the whole name, and for every backslash you actually need to put in 2 backslashes. That's because a backslash is an "escape" character for strings where certain combinations are used for special characters like \r means put in a carriage return character into the string. So to make a single backslash character you need to do \\ .

Let me know if you still aren't able to make it work like you need.

- 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:  Michael Gibson
4486.3 In reply to 4486.1 
Also note that there are 2 files that make up the ImportPointFile command - ImportPointFile.htm and ImportPointFile.js - the part that controls picking the filename is in the .js file part.
  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:  jpvikholm
4486.4 In reply to 4486.3 
Thank You Michael!

- J-P
  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