Source language: Translate to:

Create Folder in Vista

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

Create Folder in Vista

Postby johnpalm » Sat Mar 02, 2013 2:50 pm

I would like to create a folder and write a file to it in Vista but Vista seems to block that from happening. Does any body have any tips. In XP it works fine.
johnpalm
 
Posts: 57
Joined: Thu Dec 09, 2010 5:06 pm

Re: Create Folder in Vista

Postby dec » Sun Mar 03, 2013 4:42 am

Hello,

Probably the problem is with administrative privileges. From Windows Vista we cannot create folders or write files under certain system directories, like Program Files, Windows, etc. You can test if this is the case executing your publication as an administrator user. Right click your publication icon and choose the option "Execute as admin".

If you need to know some special Windows directories in which you can save your publication configuration files, for example, my npInfo plugin can help you: this plugin allow you to know all the Windows special directories, like "User App Data", which is the right place for configuration files under Windows Vista and later. Hope this can help you in some manner. ;)
.
Enhance your NeoBook applications!
.
58 plugins, 1131 actions and 233 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Re: Create Folder in Vista

Postby johnpalm » Sun Mar 03, 2013 6:52 am

Thank you David, I find many of your posts very helpful. I think this is most likely the problem and will try your suggestions.
johnpalm
 
Posts: 57
Joined: Thu Dec 09, 2010 5:06 pm

Re: Create Folder in Vista

Postby dec » Sun Mar 03, 2013 6:58 am

You're welcome! ;)
.
Enhance your NeoBook applications!
.
58 plugins, 1131 actions and 233 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Re: Create Folder in Vista

Postby fkapnist » Thu Dec 04, 2014 8:16 am

johnpalm wrote:I would like to create a folder and write a file to it in Vista but Vista seems to block that from happening. Does any body have any tips. In XP it works fine.


Temporary files should be written to the Windows Temp folder
User-generated output should be written to the My Documents folder
Program configuration settings should be written to the Windows registry

What is the AppData folder? The AppData folder contains app settings, files, and data specific to the apps on your PC. The folder is hidden by default in File Explorer, and has three hidden sub-folders: Local, LocalLow, and Roaming. Programs can choose whether to save to the Local, LocalLow, or Roaming sub-folders. Most desktop apps use the Roaming folder by default, while most Windows Store apps use the Local folder by default. Microsoft doesn't recommend moving, deleting, or making any changes to files or folders in the AppData folder. Doing so could make your apps run poorly or stop working entirely.

If you try to write directly to a Program Files folder (or Program Files x86 folder) where your PubDir might be stored, you may get an "access denied" error (and your program won't work). The Windows Temp folder should be used to write and read temporary files. The example below writes to the Windows Temp folder and then reads back the file. It sets the Windows Temp folder as the current directory and uses DOS to write a file (test.txt) of the directory to the Windows Temp folder.

Code: Select all
SetVar "[CurrentDir]" "[TempDir]"
DOSCommand "dir" "> %~p0test.txt" "Normal"
TextWindow "" "-1" "-1" "450" "500" "%~p0test.txt" "Wordwrap"


Notice the %~p0 before the filename. It is the path to the new file we just wrote.
Windows uses two directories: one that contains the program, and one that contains the file to write or read to.
In fact, you can be in a third directory and call a program from one directory to write or read to another directory.
Of course you will normally use the Neobook [FileWrite] or [ExtractFile] actions. For example:

Code: Select all
FileWrite "[TempDir]test.txt" "All" "Some Text"
TextWindow "" "-1" "-1" "450" "500" "[TempDir]test.txt" "Wordwrap"


:arrow:
.
User avatar
fkapnist
 
Posts: 348
Joined: Mon Nov 17, 2014 4:24 pm
Location: Greece


Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 1 guest

cron