Errors using WSH to automate FP2000

D

DontEvenBother

I've been trying to use WSH using 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 copied 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 mein FP 2000.
Here are the errors it produces:

Dim pw As PageWindowEx => User-defined type not defined. I then changed
it to just PageWindow since FP2K doesn't have any of the 'Ex' objects
and got no errror (FWIW), 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 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 came up with 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
 
M

MD Websunlimited

Hi Jim,

You'd have to instantiate the FrontPage object first in WSH then you can use the objects and methods to do the publishing.

If you're goal here is to automatically publish FP then consider using the scheduler and the FPSE command line parameters.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top