--- joko/ToolBox/Windows/VpnDial/src/Module_Main.bas 2005/09/28 20:36:46 1.1 +++ joko/ToolBox/Windows/VpnDial/src/Module_Main.bas 2005/09/28 22:50:30 1.2 @@ -21,6 +21,9 @@ Dim cmdline As New CommandLine Dim conName As String + Dim script_name As String, script_args As String + Dim rasItem As RasEntryData + Dim success As Boolean ReadRasEntries cmdline.parse @@ -28,8 +31,37 @@ If cmdline.hasSwitch("gui") Then Form_Main.Show Else - conName = cmdline.getArgument(conName) - MsgBox conName + + If cmdline.hasSwitch("dial") Then + + ' dial command + conName = cmdline.getArgument("dial") + On Error Resume Next + Set rasItem = RasEntries(conName) + If Err.Number = 0 Then + success = RasConnect(rasItem.entryname, rasItem.PhonebookPath) + Else + MsgBox "Unkown RAS-Connection """ & conName & """." + End If + On Error GoTo 0 + + ElseIf cmdline.hasSwitch("hangup") Then + ' hangup command + conName = cmdline.getArgument("hangup") + success = RasDisconnect(conName) + 'MsgBox success + + End If + + ' run script + If cmdline.hasSwitch("script") And success = True Then + script_name = cmdline.getArgument("script") + If script_name <> "" Then + script_args = Chr(34) & DetermineClientIP() & Chr(34) & " " & Chr(34) & DetermineServerIP & Chr(34) + Shell App.Path & "\" & script_name & " " & script_args, vbHide + End If + End If + End If End Sub