TC button:
Command: B:\test.vbs
Parameter: %L or Parameter: %P%N %T%M
Code: Select all
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Set dostep = CreateObject("Scripting.FileSystemObject")
'VB6 reacts::
Set Path = Wscript.Arguments -> 'Run-time error '424': Object required
If Path.Count = 1 Then
' Parameter: %L
Set Path2 = dostep.OpenTextFile(Path.Item(0),ForReading)
FullPathSRC = Path2.ReadLine
Path2.Close
' Set MyFile = dostep.OpenTextFile("B:\TEMP\FullPathSRC.txt", ForWriting, True)
' MyFile.WriteLine FullPathSRC
' MyFile.Close
Msgbox FullPathSRC
ElseIf Path.Count = 2 Then
' Parameter: %P%N %T%M
' Set MyFile = dostep.OpenTextFile("B:\TEMP\FullPathBoth.txt", ForWriting, True)
' MyFile.WriteLine Path.Item(0)
' MyFile.WriteLine Path.Item(1)
' MyFile.Close
Msgbox Path.Item(0) & vbnewline & Path.Item(1)
Else
WScript.Echo "the parameter for the active window: %L, or both windows: %P%N %T%M"
End If
WScript.Quit
How to write a code for VB6?