Oh man you are a gem, the script works great (both variants). I really appreciate it, thanks a lot
Now let me see if I correctly understand how the code works, to get a better grasp on scripting that I just started looking at yesterday...
@var $dir = GetSourcePath();
// assign source path to the dir variable
@var $sel = GetSourceSelectedFileNames();
// assign selected filenames to the sel variable. since sel is not explicitly declared as an array, does this mean a variable automatically becomes an array by assigning to it multiple values (ie filenames)?
@var $sel = StrLines2Array( GetClipboardText() );
// assign filenames on the clipboard to the sel variable. internal function StrLines2Array converts mutiple lines of string into an array
@var $c = arrayCount( $sel );
// assign the number of elements in the array sel to the c variable
@var $n;
@var $f;
// declare variables, n for the following loop counter, f for filenames
for( $n = 0; $n < $c; $n++ )
// setting up the loop to go through all the elements in the array. start with n at zero, execute the loop and increase n by 1 for as long as n is smaller than c, ie the number of elements in the array
{
$f = $dir ^ "\\" ^ PathGetNamePart( $sel[ $n ], 1 );
//this gets the filename part from the current array element and assigns it to the variable f, but I'm confused about the syntax. Specifically the "$dir ^ "\\" ^ " part. I'm pretty sure I would have made the mistake here of simply writing "$f = PathGetNamePart( $sel[ $n ], 1 );" Ah wait (sorry for writing as I think
), we need the full length path name for the file we are about to create, not just its filename, so the part I'm asking about is prepending the filename with the full path, correct? Ok, just found ^ in the documentation so I think I was right there. But looking at the documentation example, why wouldn't "$f = $dir ^ PathGetNamePart( $sel[ $n ], 1 );" work? Or would it?
if( FileExists( $f ) == 0 )
//check if a file already exists so that we don't overwrite it with the file we're about to create.
{
SaveStringToFile( $f, "" );
//finally create the file with the filename we stored in variable f
}
}
Again let me thank you for your help, hope you don't mind me commenting the code