code

J

Joel Allen

Hello,

I am not very familiar with java script, so I'm seeking a little help
please.

I want to create code that will make a folder on my compter.

e.g. Make this folder ---> C:\2006\a field value\

Thank you so much,
Joel
 
S

S.Y.M. Wong-A-Ton

Retrieve the value of your field with something like:

var fieldVal = XDocument.selectSingleNode("XPath_to_your_field").text;

Then create the folder using

var fs;
fs = new ActiveXObject("Scripting.FileSystemObject");
fs.CreateFolder("c:\\2006\\" + fieldVal);
 
J

Joel Allen

Thank you! That worked. Can I please ask 2 more questions?

1- Why do you need \\ and not \ in the field path?, and
2- I'm trying to create code to go to the folder after I create it. This is
what I have. It's not working, can you help?

var objWeb

objWeb = CreateObject("InternetExplorer.Application");
objWeb.Navigate("C:\\test");
objWeb.Visible = True;

Thanks,
Joel
 
S

S.Y.M. Wong-A-Ton

\ is a special character in JScript and other languages like JScript, so you
have to escape it with another \ to let JScript know that you really mean "\"
as a string and not the special character.

Regarding your IE question, perhaps you may want to post it in the IE
newsgroup, because the problem is not really related to InfoPath, unless it's
a security issue you're having. You could also do a search on the Internet on
"automating internet explorer".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top