PDA

View Full Version : Am I being dumb?



dulux1309
02-17-2004, 12:53 PM
Hi all,

I am trying to perform a very simple action, and I have performed this before in an earlier version but it appears to have changed or perhaps i have just forgotten how I did it. I would like to click a button and have a file copied to the %systemroot%, be it WINNT, WINDOWS or whatever the client machine is running. My code is below, but I am getting an error.

I have searched the help files as it appears I am having a problem with the syntax of the %systemroot% end of the statement, but I cannot find anything in the help files.

code follows...
-----------------------------------------
File.Copy("secdata\\drivers\\Crop Software\\SC Direct Sources", "%systemroot%", , , , , nil)
-----------------------------------------

Your time is appreciated.

Corey
02-17-2004, 01:08 PM
Hi. The ticket might be _SystemFolder as seen here:

http://www.indigorose.com/webhelp/ams50/Program_Reference/Variables/Global_Variables.htm

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)

dulux1309
02-17-2004, 01:16 PM
Thanks for that - it turns out I was after _WindowsFolder, but the pointer to the info was what I actually needed.

Sharp work, as always.

Thanks

dulux1309
02-17-2004, 02:07 PM
Hi again,

I have amended the code for the following and nothing is getting created in the Windows folder, despite no error message being produced on compile.

code follows
------------------------------
Folder.Create("_WindowsFolder\\SC Direct Sources");
------------------------------

Is anything drastically wrong with this?

On another note - I can copy files, but can I copy entire folders?

Thanks

Colin
02-17-2004, 02:19 PM
Try this:
Folder.Create(_WindowsFolder.."\\SC Direct Sources");

Or better yet, to understand what is happening when you want to mix "variables" and "literals", try doing it this way:


-- Assign a variable the value of another variable
folderpath = _WindowsFolder;

-- Append a text string to a variable
folderpath = folderpath .. "\\SC Direct Sources";

-- Pass a variable to an action as an argument
Folder.Create(folderpath);
It's a bit longer, but easier to understand.

rhosk
02-17-2004, 02:21 PM
delux1309, what exactly are you trying to do? If you're trying to copy folders recursively, ol' Worm here at the forum has an excellent dll that does just that.

http://www.indigorose.com/forums/showthread.php?s=&threadid=6402

Your syntax for creating a folder should be -

Folder.Create("_WindowsFolder.." \\SC Direct Sources");

HTH.

Edit - ooops, Colin beat me to it.

dulux1309
02-17-2004, 02:24 PM
Sorry guys, I have since learned to read the manual and solved my own issue. For anyone else struggling with this, the syntax is as follows -

Folder.Create(_WindowsFolder.."\\foldername");

Thanks anyway.

Corey
02-17-2004, 03:10 PM
Yep, double dot concatenates values, (with string values in quotes) glad to hear you got it going, kewl! :)

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)