Development :
K-Meleon Web Browser Forum
K-Meleon development related discussions.
VBscript help
Posted by:
CaptnBlack
Date: September 04, 2006 05:40AM
Hi
I'm working on a macros that I want to use a VBscript to create a dated subfolder.
The path should look like this once the subfolder is created:
"d:\My Temp\mm-dd-yyyy"
Here's what I have so far:
Option Explicit
Dim objFSO, objFolder, objShell, strDirectory, sDateDir
sDateDir = "0" & Month(Now) & "-" & Right("0" & Day(Now), 2) & "-" & Right("0" & Year(Now), 4)
strDirectory = "d:\My Temp\" & sDateDir
' Create the File System Object
Set objFSO = CreateObject("Scripting.FileSystemObject")
' Note If..Exists. Then, Else ... End If construction
If objFSO.FolderExists(strDirectory) Then
Set objFolder = objFSO.GetFolder(strDirectory)
Else
Set objFolder = objFSO.CreateFolder(strDirectory)
End If
WScript.Quit
My problem is that "d:\My Temp\" can be a variable, so how do I add arguments to the script so I can execute the VBscript with a command line that includes the path to create the dated subfolder in ?
Hoping someone here might know, I'm exausted from searching google, and msdn, and still no clear answers on how to do it.
TIA
Re: VBscript help
Posted by:
alain aupeix chez wanadoo fr
Date: September 04, 2006 08:30AM
Re: VBscript help
Posted by:
rmn
Date: September 04, 2006 08:41AM
From
Google's first reply:
Quote
WScript.Arguments.Item(0)
Hope it works.
Re: VBscript help
Posted by:
rmn
Date: September 04, 2006 08:45AM
Apparently WScript.Arguments(0) also works, as shown in [wiki]Create+Shortcut[/wiki].
Re: VBscript help
Posted by:
CaptnBlack
Date: September 04, 2006 11:52AM
Thanks for all the replies.
I finally got it working... after a little sleep... lol
Guess I was too "foggy minded" to see how simple it actually is.
Here's what I came up with:
Option Explicit
Dim objFSO, objFolder, objShell, strDirectory, sDateDir, sFolder, oArgs
Set oArgs = WScript.Arguments
sFolder = oArgs(0)
sDateDir = "0" & Month(Now) & "-" & Right("0" & Day(Now), 2) & "-" & Right("0" & Year(Now), 4)
strDirectory =sFolder & sDateDir
' Create the File System Object
Set objFSO = CreateObject("Scripting.FileSystemObject")
' Note If..Exists. Then, Else ... End If construction
If objFSO.FolderExists(strDirectory) Then
Set objFolder = objFSO.GetFolder(strDirectory)
Else
Set objFolder = objFSO.CreateFolder(strDirectory)
End If
WScript.Quit