Created
November 12, 2009 00:08
-
-
Save eight/232452 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'##################################################### | |
' ショートカット作成スクリプト | |
' 設定ファイル複数受付版 | |
'##################################################### | |
Const FOR_READING = 1 | |
Const COL_FOLDER = 0 | |
Const COL_SUB_FOLDER = 1 | |
Const COL_TITLE = 2 | |
Const COL_PATH = 3 | |
Const COL_WORK = 4 | |
Set objArgs = WScript.Arguments | |
'Wscript.Echo objArgs(0) | |
'Wscript.Echo objArgs.length | |
For arg_index = 0 to objArgs.length-1 | |
Set objFSO = CreateObject("Scripting.FileSystemObject") | |
Set objTextFile = objFSO.OpenTextFile(objArgs(arg_index), FOR_READING) | |
Do Until objTextFile.AtEndOfStream | |
strNextLine = objTextFile.Readline | |
if strNextLine <> "" then | |
conf = Split(strNextLine , ",") | |
if conf(COL_FOLDER) <> "" then | |
Set Shell = CreateObject("WScript.Shell") | |
CreatePath = Shell.SpecialFolders(conf(COL_FOLDER)) | |
if CreatePath = "" then CreatePath = conf(COL_FOLDER) | |
if conf(COL_SUB_FOLDER) <> "" then | |
CreatePath = CreatePath & "\" & conf(COL_SUB_FOLDER) | |
if not objFSO.FolderExists(CreatePath) then | |
objFSO.CreateFolder(CreatePath) | |
end if | |
end if | |
Set link = Shell.CreateShortcut(CreatePath & "\" & conf(COL_TITLE) &".lnk") | |
link.Description = conf(COL_TITLE) | |
link.HotKey = "" | |
link.IconLocation = conf(COL_PATH) | |
link.TargetPath = conf(COL_PATH) | |
'通常のウインドウ | |
link.WindowStyle = 1 | |
link.WorkingDirectory = conf(COL_WORK) | |
args = "" | |
For i = COL_WORK+1 to Ubound(conf) | |
args = args & " " & conf(i) | |
Next | |
link.Arguments = args | |
ret = link.Save | |
'デバッグ情報 | |
' Wscript.Echo "タイトル:" & conf(0) | |
' Wscript.Echo "パス:" & conf(1) | |
' Wscript.Echo "作業ディレクトリ:" & conf(2) | |
' Wscript.Echo "引数:" & args | |
' Wscript.Echo ret | |
end if | |
end if | |
Loop | |
Next |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment