D
DontEvenBother
I've been trying to use WSH with VBScript to automate the publishing of
FP 2000, but to no avail. I have looked at 2 available examples, but
am still having trouble.
I first tried an MSDN example by Jimco:
http://msdn.microsoft.com/library/d...n-us/dnfp2k2/html/odc_fppublishingwithvba.asp
But it's written for FP 2002/2003 and isn't working for me in 2000.
FWIS, here are the errors it produces:
Dim pw As PageWindowEx => User-defined type not defined.
I then changed it to just PageWindow (FP2K syntax?) and got no errror,
but still getting this next error...
boolPublishResult = PublishWeb(txtDestination.Text, fpPublishFlags) =>
Compile Error: Sub or function not defined.
If I removed the parens as the FP2K syntax would suggest, I get
"Compile Error: Expected end of statement." I gave up on this example,
but hopefully learned a little.
*The second Script I found was written to work as a VBA macro within FP
and does work in that environment:
Sub PublishActiveWeb
Dim myWeb, sDestWebURL, sUser, sPassword
Set myWeb = Application.ActiveWeb
sDestWebURL = "http://mywebsite.com"
sUser = "myusername"
sPassword = "mypassword"
myWeb.publish sDestWebURL, fpPublishAddToExistingWeb +
fpPublishIncremental, sUser, sPassword
End sub
** So with a little culling and some tweaking, like creating the FP
Application object and opening the source web first, I arrived at the
following:
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
Dim sSourceWeb, sDestWeb, sUser, sPassword
Dim oMyWeb
Set oMyWeb = WScript.CreateObject("FrontPage.Application")
sSourceWeb = "http://LocalWeb"
sDestWeb = "http://www.mywebsite.com"
sUser = "myusername"
sPassword = "mypassword"
oMyWeb.Webs.Open(sSourceWeb)
oMyWeb.ActiveWeb.Publish sDestWeb,fpPublishAddToExistingWeb +
fpPublishIncremental,sUser,sPassword
oMyWeb.ActiveWebWindow.Close
The resulting error:
Line: 18 (the oMyWeb.Publish line)
Char: 1
Error: Bad Parameter passed to Web Server Extensions. Check the
information you entered and try again
Code: 80004005
Could someone please tell me where I am going wrong? The docs on the
FP Object Model for FP2K are slim & confusing, and making the changes
from VBA to VBScript may also be eluding me.
Thanks,
Jim
FP 2000, but to no avail. I have looked at 2 available examples, but
am still having trouble.
I first tried an MSDN example by Jimco:
http://msdn.microsoft.com/library/d...n-us/dnfp2k2/html/odc_fppublishingwithvba.asp
But it's written for FP 2002/2003 and isn't working for me in 2000.
FWIS, here are the errors it produces:
Dim pw As PageWindowEx => User-defined type not defined.
I then changed it to just PageWindow (FP2K syntax?) and got no errror,
but still getting this next error...
boolPublishResult = PublishWeb(txtDestination.Text, fpPublishFlags) =>
Compile Error: Sub or function not defined.
If I removed the parens as the FP2K syntax would suggest, I get
"Compile Error: Expected end of statement." I gave up on this example,
but hopefully learned a little.
*The second Script I found was written to work as a VBA macro within FP
and does work in that environment:
Sub PublishActiveWeb
Dim myWeb, sDestWebURL, sUser, sPassword
Set myWeb = Application.ActiveWeb
sDestWebURL = "http://mywebsite.com"
sUser = "myusername"
sPassword = "mypassword"
myWeb.publish sDestWebURL, fpPublishAddToExistingWeb +
fpPublishIncremental, sUser, sPassword
End sub
** So with a little culling and some tweaking, like creating the FP
Application object and opening the source web first, I arrived at the
following:
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
Dim sSourceWeb, sDestWeb, sUser, sPassword
Dim oMyWeb
Set oMyWeb = WScript.CreateObject("FrontPage.Application")
sSourceWeb = "http://LocalWeb"
sDestWeb = "http://www.mywebsite.com"
sUser = "myusername"
sPassword = "mypassword"
oMyWeb.Webs.Open(sSourceWeb)
oMyWeb.ActiveWeb.Publish sDestWeb,fpPublishAddToExistingWeb +
fpPublishIncremental,sUser,sPassword
oMyWeb.ActiveWebWindow.Close
The resulting error:
Line: 18 (the oMyWeb.Publish line)
Char: 1
Error: Bad Parameter passed to Web Server Extensions. Check the
information you entered and try again
Code: 80004005
Could someone please tell me where I am going wrong? The docs on the
FP Object Model for FP2K are slim & confusing, and making the changes
from VBA to VBScript may also be eluding me.
Thanks,
Jim