I have an old timer (not old-timer) script that I use to keep track of the hours that I spend on projects. The script writes a text file to the hard drive, and adds lines of text to it whenever I click on the appropriate button. That worked fine for WinXP, but now that I'm using Win7, there seems to be more security and as far as I can tell, I can't write a text file anywhere consistent on users' machines. So I have two questions: Is there a better kind of file that I can create, instead of a text file, that would give me more freedom (let me save somewhere consistent, etc)? And, if not, is there a place where I can write a text file in Win7 without security issues?

Views: 186

Attachments:

Replies to This Discussion

There is nothing wrong with writing text files. But you might have to rethink your location, as Windows 7 does have more folder permissions than XP. Personally, I'd do something like this:

Set objShell = CreateObject("WScript.Shell")
strFolder = objShell.SpecialFolders("MyDocuments")

which will return your "documents" folder.

-- Dale

thanks - I'll try that!

Do you think people would rather have my script create a folder in that directory, or just plop a text file right in there?

 

If a folder makes more sense, I have to figure out how to check if the folder already exists, and if it does not, how to create it. Maybe you have an example? Sorry - I'm not good at scripting, just do it b/c I need the tools!

I am not sure I am the right one to ask. But if you need to ensure that a folder exists before writing to it, then see the attached sample script.

 -- Dale

Attachments:

RSS

Translate

© 2014   Created by McNeel Admin.

Badges  |  Report an Issue  |  Terms of Service