Replacing files with VB

B

BioColor

Hi,

I have used VB6 to automate the FrontPage 2000 publishing of new PNG
files
to my web site using a modified version of the example in the MSKb.
With the proper DIMs I use the lines:

Set oFPweb = oFP.Webs.Add(Servername & FPWebFolder, "username",
"passwd")
oFPweb.Activate
oFPweb.RootFolder.Files.Add FilePath, True

This works, but the first line (I think) causes the folder FPWebfolder
to be converted into a
web folder when it was just a plain folder before running the VB
publish program.

To avoid this (my designer gets very uncomfortable), I've experimented
with various things like LocateFolder, but can't even get the program
to compile. I'm stumbling around like a blind man with the FP
description of the Web object methods and properties.

Can someone tell me what combination of methods I need to use to open
the web, "move" to the destination folder, and then copy new versions
of the files to that folder? Or is there a source for a better
description of how to manipulate a web with VB?

TIA
Duncan
 
S

Stefan B Rusynko

Start here
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbafpw11/html/fpobjWebFile.asp
then look at
http://msdn.microsoft.com/library/d...-us/vbafpw11/html/fpmthPublish.asp?frame=true

You want to Open the web or publish the web (not add a web)



| Hi,
|
| I have used VB6 to automate the FrontPage 2000 publishing of new PNG
| files
| to my web site using a modified version of the example in the MSKb.
| With the proper DIMs I use the lines:
|
| Set oFPweb = oFP.Webs.Add(Servername & FPWebFolder, "username",
| "passwd")
| oFPweb.Activate
| oFPweb.RootFolder.Files.Add FilePath, True
|
| This works, but the first line (I think) causes the folder FPWebfolder
| to be converted into a
| web folder when it was just a plain folder before running the VB
| publish program.
|
| To avoid this (my designer gets very uncomfortable), I've experimented
| with various things like LocateFolder, but can't even get the program
| to compile. I'm stumbling around like a blind man with the FP
| description of the Web object methods and properties.
|
| Can someone tell me what combination of methods I need to use to open
| the web, "move" to the destination folder, and then copy new versions
| of the files to that folder? Or is there a source for a better
| description of how to manipulate a web with VB?
|
| TIA
| Duncan
|
 
B

BioColor

You want to Open the web or publish the web (not add a web)

Mr. Rusynko,

Thanks for the helpful links! Opening makes perfect sense.

I'm still a little stuck, and experimentation is proving fruitless. I
now have:

Set oFPweb = oFP.Webs.Open(Servername, "username", "passwd")

oFPweb.Activate

FilePath = LocPath & FileName ' Local file location
oFPweb.RootFolder.Files.Add FilePath, True ' Modify this

Since the final destination folder is not a web folder, I had to leave
its path out of the Servername string in the Open method.

Now I cannot figure out how to modify the .Add method to place the
files into the correct destination folder instead of the RootFolder.
The destination folder is two levels down from the RootFolder. The
examples all refer to files in the RootFolder.

I tried various iterations using a WebFolder object and LocateFolder,
but nothing would compile.

I don't think I can use Publish since I am just replacing image files
and do not have the rest of the web on my local computer.

Any suggestions?

Thank you for the assistance.
Duncan
 
S

Stefan B Rusynko

TBMK you can not just file upload w/ FP VBA
- you need to Publish a local web w/ the changed file to the remote web
Open you local Web/subweb (w/ the file in it) and then publish it w/ VBA to the remote

If you are just trying to upload a file use another tool like FP 2002 File Upload or server side scripting (ASP or PHP)




| On Thu, 9 Dec 2004 12:31:44 -0500, "Stefan B Rusynko"
|
| >You want to Open the web or publish the web (not add a web)
|
| Mr. Rusynko,
|
| Thanks for the helpful links! Opening makes perfect sense.
|
| I'm still a little stuck, and experimentation is proving fruitless. I
| now have:
|
| Set oFPweb = oFP.Webs.Open(Servername, "username", "passwd")
|
| oFPweb.Activate
|
| FilePath = LocPath & FileName ' Local file location
| oFPweb.RootFolder.Files.Add FilePath, True ' Modify this
|
| Since the final destination folder is not a web folder, I had to leave
| its path out of the Servername string in the Open method.
|
| Now I cannot figure out how to modify the .Add method to place the
| files into the correct destination folder instead of the RootFolder.
| The destination folder is two levels down from the RootFolder. The
| examples all refer to files in the RootFolder.
|
| I tried various iterations using a WebFolder object and LocateFolder,
| but nothing would compile.
|
| I don't think I can use Publish since I am just replacing image files
| and do not have the rest of the web on my local computer.
|
| Any suggestions?
|
| Thank you for the assistance.
| Duncan
|
 
B

BioColor

On Fri, 10 Dec 2004 04:34:46 -0500, "Stefan B Rusynko"

Mr. Rusynko,

Thank you for the response.

That's a new one. It means?
you can not just file upload w/ FP VBA
- you need to Publish a local web w/ the changed file to the remote web
Open you local Web/subweb (w/ the file in it) and then publish it w/ VBA to the remote

Yes, I know about the need to Publish, after my designer screamed at
me for using FTP, and my ISP upgraded their servers. ("Well... it used
to work.")

The purpose for using VB6 (not VBA) is to be able to automate the
upload task with a DOS .BAT file. I know how to start a VB6 .exe with
command line arguments. The images are generated at night when the
data becomes available. I am trying to emulate in VB what I can do
manually by opening FP and dragging the file from Windows Explorer and
dropping it into the right folder in the FP folders view of the web on
the server.

I have no web or sub-web on my machine. Just new .PNG files.
If you are just trying to upload a file use another tool like FP 2002 File Upload

Perhaps it's time to upgrade (although my designer is disgusted with
FP2003). Does anyone know if FP200(3) File Upload can be run with a
DOS command line?

For now I guess I'll go back and let my program convert the
destination folder into a WebFolder and tell my designer to get over
it. I gather it is that folder type distinction that makes my program
impossible.

Thanks again for the assistance.

Duncan
 
S

Stefan B Rusynko

TBMK - To Best of My Knowledge

You (or your designer) are making a simple task complicated
- you are trying to publish when you don't need to

A site w/ the FP SE should not be FTP'd to for web pages (causes corruption)
Media content can be FTP'd to a FP SE site w/o harm
(and large media like movies, webbcam feeds , etc. often are, or must be)

It sounds like you are just replacing existing images in kind
- yes FP will not recognize the image file date change until the site is opened on FP and the designer runs a Tools Recalculate
Hyperlinks (for reports, etc.)
- but if the image file name is the same and image hxw is unchanged, the web pages will recognize the new image "content" and
display it w/o FP knowing anything changed
So just FTP it
- the designer could also set up a subweb just for "FTP" media content (and not open the subweb in FP)




| On Fri, 10 Dec 2004 04:34:46 -0500, "Stefan B Rusynko"
|
| Mr. Rusynko,
|
| Thank you for the response.
|
| >TBMK
|
| That's a new one. It means?
|
| >you can not just file upload w/ FP VBA
| >- you need to Publish a local web w/ the changed file to the remote web
| >Open you local Web/subweb (w/ the file in it) and then publish it w/ VBA to the remote
|
| Yes, I know about the need to Publish, after my designer screamed at
| me for using FTP, and my ISP upgraded their servers. ("Well... it used
| to work.")
|
| The purpose for using VB6 (not VBA) is to be able to automate the
| upload task with a DOS .BAT file. I know how to start a VB6 .exe with
| command line arguments. The images are generated at night when the
| data becomes available. I am trying to emulate in VB what I can do
| manually by opening FP and dragging the file from Windows Explorer and
| dropping it into the right folder in the FP folders view of the web on
| the server.
|
| I have no web or sub-web on my machine. Just new .PNG files.
|
| >
| >If you are just trying to upload a file use another tool like FP 2002 File Upload
|
| Perhaps it's time to upgrade (although my designer is disgusted with
| FP2003). Does anyone know if FP200(3) File Upload can be run with a
| DOS command line?
|
| For now I guess I'll go back and let my program convert the
| destination folder into a WebFolder and tell my designer to get over
| it. I gather it is that folder type distinction that makes my program
| impossible.
|
| Thanks again for the assistance.
|
| Duncan
|
|
 
B

BioColor

On Fri, 10 Dec 2004 11:51:10 -0500, "Stefan B Rusynko"

[Snipped correct information about FTP]
So just FTP it

I used to do this with FTP until my ISP installed new servers and
FPExt. Before I had a chance to verify that FTP would still work, my
ISP disabled FTP saying it was a security risk. That's what forced me
to the VB6 route.

Anyway, thanks for the help.

Duncan
 
S

Stefan B Rusynko

OK
W/ that constraint on FTP use FP Publish w/ VB / VBA

Have the designer move the image(s) to a folder named media
Create a subweb in his main root web as say http://mainweb.com/media/
(or convert the media folder to a subweb in FP)
- he can add 1 html page (it can be just a redirect back to root home page) if he wants
- the image(s) you are trying to update are in the root of the subweb
(all links in the root web are relative external links to the these images in the subweb)

Then you create a local FP web named C:\Media and use your VB to publish your media web to the main media subweb (make sure you run
a VB recalc of the web before you publish it to remote)





| On Fri, 10 Dec 2004 11:51:10 -0500, "Stefan B Rusynko"
|
| [Snipped correct information about FTP]
|
| >So just FTP it
|
| I used to do this with FTP until my ISP installed new servers and
| FPExt. Before I had a chance to verify that FTP would still work, my
| ISP disabled FTP saying it was a security risk. That's what forced me
| to the VB6 route.
|
| Anyway, thanks for the help.
|
| Duncan
|
 
B

BioColor

W/ that constraint on FTP use FP Publish w/ VB / VBA
[snip complete instructions]

Mr. Rusynko,

That all looks straightforward. Thanks so much for your patience and
your valuable help!

Duncan
 
A

Auerbach

Stefan spends untold hours helping FP users of all skill levels, none of
whom pay a dime, and you are giving him attitude?

If you have something constructive to add to a thread, whether it's a
newbie's confused query or a complex programming issue, do so. But why waste
our time and your own with a snotty, useless comment -- while hiding your
identity?

Alex
 
S

SueF

I know this is way to late in the thread, but want to go on record.

While I don't really know what Dave meant by the "!", I took it to mean
Amazing!, Wonderful!, More than helpful! Super!

Stefan has helped me in ways he cannot know. I don't always understand,
being such a newbie, but I have printouts of his answers that I refer back to
as my understanding increases.

Thank you Stefan

Cheers, Sue
 
A

Auerbach

The subject line of Dave's message was "Stefan - Master of the Obvious",
followed by "You really are !" in the body of the message. It was,
idiotically, intended as a slam against Stefan, who is one of the most
knowledgeable, helpful and patient contributors to this newsgroup.

The post is meaningless as regards Stefan, but it tells you everything you
need to know about Dave.

Alex
 
Top