Macro for Frontpage DRW (Spooky) Diet (Full Version)

All Forums >> [Web Development] >> ASP, PHP, and Database



Message


William Lee -> Macro for Frontpage DRW (Spooky) Diet (3/7/2002 15:15:21)

This macro is written by Stephen Travis, MVP for Frontpage.
__________________________________________

Sub spooky_Diet()
    Dim innerHTML As String, Webbot As String
    If Not FrontPage.ActiveDocument Is Nothing Then
        If FrontPage.ActivePageWindow.ViewMode = fpPageViewNormal Then
            innerHTML = ActiveDocument.body.innerHTML
        Do
        Webbot = Ellipse(innerHTML, "<!--webbot" , "-->" )
        If Webbot = ""  Then Exit Do

            If InStr(Webbot, "bot=""" ) <> 0 Then
                innerHTML = Replace(innerHTML, Webbot, "" )
            End If
        
        Loop
        ActiveDocument.body.innerHTML = innerHTML
        End If
    End If
End Sub
    
Function Ellipse(i, s, e)
    Dim f As Integer, t As Integer
    Ellipse = "" 
    f = InStr(1, i, s, 1)
    If f > 0 Then
        t = InStr(f + 1, i, e, 1)
        If t > 0 Then
            Ellipse = Mid(i, f, t - f) & e
        End If
    End If
End Function


Updated to remove all web bot information.
Prevents crashing when using against list boxes.

Note - all webbot information is removed, so if you have bots other than database in the page, they will also be removed.

The other alternative is to specify all of the possible options that you want to include or exclde with this code :

 
           If InStr(Webbot, "bot=""Database" ) <> 0 Then
                innerHTML = Replace(innerHTML, Webbot, "" )
            End If
           If InStr(Webbot, " bot=""SaveAsASP" ) <> 0 Then
                innerHTML = Replace(innerHTML, Webbot, "" )
            End If
etc...






Mike54 -> RE: Macro for Spooky Diet (3/7/2002 17:29:53)

Hi William,

I guess I'll step forward and show my ignorance, exactly what does it do?

ah reckon, tharfo'e ah's, ah reckon.





William Lee -> RE: Macro for Spooky Diet (3/8/2002 4:26:36)

Hi Mike
Yes its good to be cautious and you showed the way for the rest, you din't showed your ignorance

This macro stripped all the webbot code of the DRW as was done in the Spooky Diet.
First you have to create this macro in FP.
Tools>Macro>macros..
Give it a name, then click Create.
This brings up the Visual Basic Editor interface.( Not sure if this is available on non-Windows OS)
Then copy the codes for the subroutine and function.
click Save and go back to FP.

Go to a page that you have inserted a results region.
Go to Tools>Macro>Macros..
Select the macro and click Run.

This macro will spooky-diet whatever results region you have on that page. If you have a particular results region on that page that you don't want to diet down, then this macro will not work.



Before I posted it, I tested it out more than twice

William Lee

Edited by - William Lee on 03/08/2002 05:57:53




Mike54 -> RE: Macro for Spooky Diet (3/8/2002 6:22:32)

Thanks for explaining William.

Sounds like a "cool tool" and it's been placed in the toolbox.

ah reckon, tharfo'e ah's, ah reckon.





Spooky -> RE: Macro for Spooky Diet (3/8/2002 19:48:52)

Hmm, thought I replied.....my mind must be going.

Ill try it soon myself!
Thanks William!




SerenityNet -> RE: Macro for Spooky Diet (3/14/2002 0:19:12)

Wow William, this is great! I've got a new smiley button on my FP toolbar already and linked to run this macro.

To new users to the Spooky Diet, just remember to back up your page before putting it on a diet.

Thanks again,

Andrew
webmaster@serenitynet.net - But the fruit of the Spirit is love, joy, peace, patience, kindness, goodness, faithfulness, gentleness, and self-control..." Gal. 5:22




Mike54 -> RE: Macro for Spooky Diet (3/18/2002 7:51:03)

Informational only.

Played with this over the weekend and it seems to work great. Point of caution however, don't try it on any DIW results pages. It locks everything up.
Leave it to MS to get everything working together smoothly, why can't a DRW just be a DRW?

ah reckon, tharfo'e ah's, ah reckon.





stu -> RE: Macro for Spooky Diet (3/30/2002 19:36:34)

William Lee,
Thanks very much for the macro. Works great - saved me a bunch of time.





Light -> RE: Macro for Spooky Diet (4/27/2002 23:02:21)

Hi William,

Thank you, this is great, works very good,

<%Thgil%>




jwpenuel -> RE: Macro for Spooky Diet (5/16/2002 15:37:36)

I like the concept of this macro, but can't seem to get it to run. I followed the steps outlined below to create the macro, and it appears on the list. When I open a document in front page and run the macro, nothing seems to happen. I have tried switching to html view, highlighting html, etc, with no success.
I am using Front Page 2002.

Any suggestions?

James Penuel<BR>jpenuel@digestivehealth.com

Edited by - jwpenuel on 05/16/2002 15:38:28




sarge -> RE: Macro for Spooky Diet (6/1/2002 20:27:58)

Oh boy, this is going to sound a reeely stupid question, but here goes...

I've gone into the 'Tips from the Community' forum, and then into 'Macro for Spooky Diet'. I want to set up the macro so that I have a little macro smiling face in Frontpage which I click on to do the Spooky Diet on the the current page. (I've done lots of macros in Word, successfully).

So, from within Frontpage I go to 'Tools', then 'Macro', them 'Macros', I type in 'Spooky_Diet' as the macro name, and click 'create'.

Then I paste the whole of the code in the window. This seems to give me two chunks of code, the first called 'Spooky_Diet' and the second called 'Ellipse'.

OK, all good so far. From here I can click the 'Run' button, and the thing duly runs, successfully. The current page in Frontpage is transformed. All those grey bits of code disappear, the whole thing shrinks wonderfully, the big yellow blobs in Preview disappear, etc.

Now, I would like to save this wonderful macro, so that all I have to do within Frontpage is to click a little smiling face.. and .. presto.

But how do I save it? I've tried saving File>Save Microsoft_Frontpage, and I've tried saving by clicking the floppy icon, but to no avail.

...anybody?

Regards,
Sarge

 




Eli -> RE: Macro for Spooky Diet (6/4/2002 12:11:20)

Sweet!!! Thanks VERY much!I've been meaning to put my site on THE DIET but have resisted due to time restrictions - this works like a charm!

"... treat me like a child.."




Cookie -> RE: Macro for Spooky Diet (6/20/2002 5:53:34)

Message in reply to Sarge:
How to assign the Spooky Diet macro to a Smiley Button:

1)Right click over the toolbar
2)Choose customise
3)Select the toolbars tab
4)Click New and name it "Spooky Diet" Click OK
5)Ensure the little tick box is checked, and you should now see somewhere on the page a new toolbar called Spooky Diet.
6)Click on the commands tab, scroll all the way to the bottom and choose Macros
7)Drag the smiley face that you can now see over to the Spooky Toolbar you have created.
8)Right Click the icon on your new tool bar and choose Assign Macro
9)Choose the spooky diet macro and click OK.
10)Drag the toolbar to wherever you want!!

Hope this helps!

Cookie




sarge -> RE: Macro for Spooky Diet (6/20/2002 11:42:35)

Thanks Cookie!

 




rdouglass -> RE: Macro for Spooky Diet (6/26/2002 13:01:56)

Nice!!.... works well and a timesaver for people that use the DWR a lot....2 thumbs up!!!




hzarabet -> RE: Macro for Spooky Diet (6/28/2002 20:43:01)

WOW




Bnugent -> RE: Macro for Spooky Diet (7/15/2002 17:40:25)

Truly amazing. The amount of time saved is awesome!!!!




Spooky -> RE: Macro for Spooky Diet (3/15/2003 14:28:40)

Also, refer to this post for a possible fix if you experience crashing :-)




ACEDISH -> RE: Macro for Spooky Diet (5/21/2003 21:13:31)

Cool Beans, This is great. Will be one of the most used tools in FP




evansforsyth -> RE: Macro for Spooky Diet (6/15/2003 16:18:01)

When running the macro a " run time error 5 . . .Invalid procedure call or argument" error shows up. The debugger goes to the following line.

ActiveDocument.body.innerHTML = innerHTML

It' s a simple DRW. Anybody have an idea what is happening?

Thanks!

Evans




Spooky -> RE: Macro for Spooky Diet (6/19/2003 16:55:15)

Hmmm - sorry no. FP2002?
If you renew the macro, pasting from notepad, does it change?




evansforsyth -> RE: Macro for Spooky Diet (6/20/2003 2:28:41)

Yes, FP 2002. Sounds like you' ve heard this lament before!

quote:

If you renew the macro, pasting from notepad, does it change?


No it seems to be the same, and still does not work. The macro used to work, on the same computer. Maybe that was before upgrading to Windows XP and FP2002. Wonder if the problem is in that area.

Has anyone heard if FP 2003 is better at databases than 2002? That would be the only reason I' d get excited about upgrading.

Spooky--I' ve noticed in a post that you are not really keen on 2003--do you expect that Outfront, and you in particular, be supporting 2003?

Thanks

Evans




Spooky -> RE: Macro for Spooky Diet (6/20/2003 4:42:28)

With 2003, I fear data connections will become more inaccessible than they are now.
I havent used it yet, but my understanding is, unless you have 2003 server and Windows SharePoint Services, you may be out of luck for easy database display.

I hope thats not the case, and the DRW in some form still exists.
Someone can confirm?




evansforsyth -> RE: Macro for Spooky Diet (6/20/2003 12:21:34)

Well, this morning the macro decided to work!

Created a new page, removed all borders, removed the theme, pasted in the DRW, did not save the page, and ran the macro!

Beats me, thought I' d tried that earlier--many times. (Not complaining, you understand.)

Then, of course, changed the criteria to " &DisciplineOfArtID&" (double quotes, no single quotes) to get rid of the data type mismatch.

Hope this helps the next person! (It' ll be a good reminder to me too.)




ACEDISH -> RE: Macro for Spooky Diet (7/3/2003 11:55:02)

I have the same problem with the macro, it will work when i first generate the page but if i bring up an old page and try to run the macro I get errors.

I uses FP2002 and win 2000pro




lyners -> RE: Macro for Spooky Diet (7/25/2003 15:52:05)

What is the difference between DRW and DIW? What is DRW? I tried using this tool, but it locked my system, which makes me think i must be using DIW.

Any help out there?[:(]




Spooky -> RE: Macro for Spooky Diet (7/25/2003 15:56:24)

The DIW is a group of pages created by frontpage for the editing / adding / deleting / displaying of database pages.
The DRW is (typically) a display of data reached from the " insert" menu




lyners -> RE: Macro for Spooky Diet (7/25/2003 16:07:32)

OK,
I have 1 page which has 3 database result tables. 2 are drop downs and the 3rd is the result from the selection of the first 2. I wanted to clean-up the FP ASP code. I tried using the macro, but frontpage locks up everytime I use the macro. Any ideas as to what is going on?

Signed,
Frustrated with the macro.[&o]




Spooky -> RE: Macro for Spooky Diet (7/25/2003 16:16:45)

2 options
1) add a drw 1 to a page, run the macro on each one, then add all of the slimmed down code to one page.
2) Manually modify the code as per my original article without the macro




evansforsyth -> RE: Macro for Spooky Diet (7/28/2003 1:18:31)

Seem to remember that the macro does not work for a drop-down database result!

------------------------------------

Yahoo! Since that time the macro has been updated--it now works in all kindsa situations!

Evans




Page: [1] 2   next >   >>

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.125