Can the inputfolder command return Short Path Names
Can the inputfolder command return Short Path Names
Is there a way to make the inputfolder command return the Short Path Names of a selected folder instead of the full path name.
-
- Site Admin
- Posts: 60598
- Joined: 22 May 2004 16:48
- Location: Win8.1 @100%, Win10 @100%
- Contact:
Re: Can the inputfolder command return Short Path Names
No, and I'd rather give you an extra function to convert long to short names. But only if you tell my for what you need it.Lare2 wrote:Is there a way to make the inputfolder command return the Short Path Names of a selected folder instead of the full path name.
FAQ | XY News RSS | XY Twitter
Re: Can the inputfolder command return Short Path Names
I probably don't need it so please take a look at the code below. (which TheQwerty helped me put together)
I want to change the following part
with something like the following
When i tried the above, WGET (cmd program) truncates the path. If I select Desktop from the dialog box then WGET truncates the path to C:\Documents instead of C:\Documents and Settings\user\Desktop\
My complete lack of knowledge about scripting tells me that there should be a way to do this without my request.
Code: Select all
/*------------------------------------------------------------------------------
This script is the default entry point.
------------------------------------------------------------------------------*/
"Main"
Sub("_setPaths"); //Declare and set the global vars.
Load("*", "_clipboard;_curItem"); //Load the desired menu, which can now use the global vars.
/*------------------------------------------------------------------------------
This script sets the global variables to be used by other WGET SCRIPTS.
------------------------------------------------------------------------------*/
"_setPaths"
Global $wget, $target;
$wget = <xypath>\wget\wget; // WGET EXE PATH
$target = C:\DOCUME~1\Carlos\Desktop\Downloads; // TARGET DOWNLOAD FOLDER
/*------------------------------------------------------------------------------
01 D O W N L O A D F R O M C L I P B O A R D
This script will download the URL on the clipboard
WGET ARGUMENTS = run """cmd"" /k ""[WGET PATH]"" --directory-prefix=[TARGET PATH] [URL]"
------------------------------------------------------------------------------*/
"Download File On Clipboard : _clipboard"
Global $wget, $target;
msg Would you like to download the following <br><br> <clipboard>, 1; // CONFIRM URL TO DOWNLOAD WITH MESSAGE BOX
run """cmd"" /k ""$wget"" -c --directory-prefix=$target <clipboard>"; // WGET COMMAND ARGUMENTS
/*------------------------------------------------------------------------------
02 D O W N L O A D F R O M F I L E
This script will attempt to download a series of links from a TXT file.
------------------------------------------------------------------------------*/
"Download From Links On Selected File : _curItem"
Global $wget, $target;
$linktxt = readfile(<curitem>);
msg The following files will be downloaded <br><br>$linktxt, 1;
run """cmd"" /k ""$wget"" -c --directory-prefix=$target --input-file=<curitem>";
Code: Select all
$target = C:\DOCUME~1\Carlos\Desktop\Downloads; // TARGET DOWNLOAD FOLDER
Code: Select all
inputfolder $target, c:\ , Select the target folder;
My complete lack of knowledge about scripting tells me that there should be a way to do this without my request.
-
- Site Admin
- Posts: 60598
- Joined: 22 May 2004 16:48
- Location: Win8.1 @100%, Win10 @100%
- Contact:
Re: Can the inputfolder command return Short Path Names
Try to quote your $target in the run command...
Generally: Are quotes very expensive where you come from? Your code really could need some more...
Generally: Are quotes very expensive where you come from? Your code really could need some more...
FAQ | XY News RSS | XY Twitter
Re: Can the inputfolder command return Short Path Names
It's not so much that you need the short name as you need to quote the path since it contains spaces.Lare2 wrote:When i tried the above, WGET (cmd program) truncates the path. If I select Desktop from the dialog box then WGET truncates the path to C:\Documents instead of C:\Documents and Settings\user\Desktop\
Try this:
Code: Select all
/*------------------------------------------------------------------------------
This script is the default entry point.
------------------------------------------------------------------------------*/
"Main"
Sub("_setPaths"); //Declare and set the global vars.
Load("*", "_clipboard;_curItem"); //Load the desired menu, which can now use the global vars.
/*------------------------------------------------------------------------------
This script sets the global variables to be used by other WGET SCRIPTS.
------------------------------------------------------------------------------*/
"_setPaths"
Global $wget, $target;
$wget = "<xypath>\wget\wget"; // WGET EXE PATH
$target = "C:\DOCUME~1\Carlos\Desktop\Downloads"; // TARGET DOWNLOAD FOLDER
/*------------------------------------------------------------------------------
01 D O W N L O A D F R O M C L I P B O A R D
This script will download the URL on the clipboard
WGET ARGUMENTS = run """cmd"" /k ""[WGET PATH]"" --directory-prefix=[TARGET PATH] [URL]"
------------------------------------------------------------------------------*/
"Download File On Clipboard : _clipboard"
Global $wget, $target;
msg "Would you like to download the following <br><br> <clipboard>", 1; // CONFIRM URL TO DOWNLOAD WITH MESSAGE BOX
run """cmd"" /k ""$wget"" -c --directory-prefix=""$target"" ""<clipboard>"""; // WGET COMMAND ARGUMENTS
/*------------------------------------------------------------------------------
02 D O W N L O A D F R O M F I L E
This script will attempt to download a series of links from a TXT file.
------------------------------------------------------------------------------*/
"Download From Links On Selected File : _curItem"
Global $wget, $target;
$linktxt = readfile("<curitem>");
msg "The following files will be downloaded <br><br>$linktxt", 1;
run """cmd"" /k ""$wget"" -c --directory-prefix=""$target"" --input-file=""<curitem>""";
-
- Site Admin
- Posts: 60598
- Joined: 22 May 2004 16:48
- Location: Win8.1 @100%, Win10 @100%
- Contact:
Re: Can the inputfolder command return Short Path Names
I'd simply do this:admin wrote:Try to quote your $target in the run command...
Generally: Are quotes very expensive where you come from? Your code really could need some more...
Code: Select all
inputfolder $target, "c:\" , "Select the target folder";
//put the quotes into the var
$target = quote($target);
FAQ | XY News RSS | XY Twitter
Re: Can the inputfolder command return Short Path Names
Amazing what someone can learn by asking.
As a person that learns mainly by example, I really apreciate you for taking the time to respond.
Thank you again guys for the help.
As a person that learns mainly by example, I really apreciate you for taking the time to respond.
Thank you again guys for the help.