home *** CD-ROM | disk | FTP | other *** search
- Attribute VB_Name = "FPLaunch"
- Option Explicit
-
- Sub Main()
-
- Dim filename As String
- Dim server As String
- Dim web As String
- Dim user As String
- Dim page As String
- Dim fno As Integer
- Dim FPExplorer As Object
- Dim ret As Long
- Dim webURL As String
- Dim newWebURL As String
-
- Const ErrPrompt = "Error in FrontPage Launcher"
- Const FPExplorerID = "FrontPage.Explorer"
- Const prefix = "http://"
-
- filename = Trim$(Command$)
- If filename = "" Or InStr(LCase(filename), ".fpl") = 0 Then
- MsgBox "The 'fplaunch' helper app expects a path to a .fpl file on the command line.", vbCritical, ErrPrompt
- End
- End If
-
- fno = FreeFile
- On Error GoTo nofile
- Open filename For Input As #fno
-
- On Error GoTo badfile
- Line Input #fno, server
- server = Trim$(server)
- Line Input #fno, web
- web = Trim$(web)
- Line Input #fno, user
- user = Trim$(user)
- Line Input #fno, page
- page = Trim$(page)
- Close #fno
-
- If (server = "" Or web = "" Or page = "") Then
- MsgBox "Bad variable in parameter file.", vbCritical, ErrPrompt
- End
- End If
-
- On Error GoTo badole
-
- Set FPExplorer = CreateObject(FPExplorerID)
-
- webURL = FPExplorer.vtiGetWebURL
- newWebURL = server & "/" & web
- If Left$(newWebURL, Len(prefix)) <> prefix Then
- newWebURL = "http://" & newWebURL
- End If
- If webURL <> newWebURL Then
- If Not FPExplorer.vtiOpenWeb(server, web, user) Then
- If Len(user) > 0 Then
- MsgBox "Couldn't open web '" & newWebURL & "' as user '" & user & "'.", vbCritical, ErrPrompt
- Else
- MsgBox "Couldn't open web '" & newWebURL & "'.", vbCritical, ErrPrompt
- End If
- GoTo badweb
- End If
- End If
-
- ret = FPExplorer.vtiEditWebPage(page)
- If ret <> 1 Then
- MsgBox "Couldn't edit page '" & server & "/" & web & "/" & page & "'."
- End If
-
- badweb:
- Set FPExplorer = Nothing
-
- End
-
- badole:
- Exit Sub
-
- badfile:
- MsgBox "Bad format in parameter file.", vbCritical, ErrPrompt
- Close #fno
- Exit Sub
-
- nofile:
- MsgBox "Unable to open parameter file.", vbCritical, ErrPrompt
- Exit Sub
-
- End Sub
-
-