INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Internet

A way to collect your KB articles from internet. by ramani
Posted: 20 Nov 03 (Edited 21 Nov 03)

**********************************************************
* Author      : Ramani (Subramanian.G)
*               FoxAcc Software / Winners Software
* Type        : Freeware with reservation to Copyrights
* Warranty    : Nothing implied or explicit
***********************************************************
* How to use:
* 1. Copy the following as  GsKb.PRG.
* 2. From the command window Type..   DO gskb
* 3. The form starts a browser instance.
*    Use this for browsing.
*    When you want to save the content of a page
*    switch to gsKb and click on Add. Follow it.
* 4. If you close the browser, by mistake,
*    close the gskb and start it again- DO gskb.
*    Else an error will popup.. close and exit.
* 5. This is used by me and so, provided as it is
*    without much tighter user controls.
* 6. I will think users at large and
*    add error routines OR a better way to do same
*    ...   when time permits
*************************************************
* PROCEDURE gsKb
PUBLIC okbarticle

okbarticle = NEWOBJECT("kbarticle")
okbarticle.Show

RETURN
**************************************************
DEFINE CLASS kbarticle AS form

    Height = 324
    Width = 598
    ShowWindow = 2
    DoCreate = .T.
    DataSession = 2
    Caption = "Internet Explorer - KB Articles Collection"
    Name = "kbarticle"

    ADD OBJECT cmdAdd AS commandbutton WITH ;
        Top = 12, ;
        Left = 24, ;
        Height = 27, ;
        Width = 60, ;
        Caption = "Add", ;
        Name = "cmdAdd"

    ADD OBJECT cmddel AS commandbutton WITH ;
        Top = 12, ;
        Left = 84, ;
        Height = 27, ;
        Width = 60, ;
        Caption = "Delete", ;
        Name = "cmdDel"

    ADD OBJECT cmdnav AS commandbutton WITH ;
        Top = 12, ;
        Left = 144, ;
        Height = 27, ;
        Width = 60, ;
        Caption = "GoToURL", ;
        Name = "cmdNav"

    ADD OBJECT cmdfirst AS commandbutton WITH ;
        Top = 12, ;
        Left = 204, ;
        Height = 27, ;
        Width = 60, ;
        Caption = "First", ;
        Name = "cmdFirst"

    ADD OBJECT cmdprev AS commandbutton WITH ;
        Top = 12, ;
        Left = 264, ;
        Height = 27, ;
        Width = 60, ;
        Caption = "Previous", ;
        Name = "cmdPrev"

    ADD OBJECT cmdnext AS commandbutton WITH ;
        Top = 12, ;
        Left = 324, ;
        Height = 27, ;
        Width = 60, ;
        Caption = "Next", ;
        Name = "cmdNext"

    ADD OBJECT cmdlast AS commandbutton WITH ;
        Top = 12, ;
        Left = 384, ;
        Height = 27, ;
        Width = 60, ;
        Caption = "Last", ;
        Name = "cmdLast"

    ADD OBJECT cmdExit AS commandbutton WITH ;
        Top = 12, ;
        Left = 444, ;
        Height = 27, ;
        Width = 60, ;
        Caption = "Exit", ;
        Name = "cmdExit"

    ADD OBJECT grdkb AS grid WITH ;
        DeleteMark = .F., ;
        Height = 111, ;
        Left = 12, ;
        ReadOnly = .T., ;
        Top = 60, ;
        Width = 576, ;
        Name = "grdKb"

    ADD OBJECT edtArticle AS editbox WITH ;
        Height = 132, ;
        Left = 12, ;
        Top = 180, ;
        Width = 576, ;
        DisabledForeColor = RGB(255,255,255), ;
        Name = "edtArticle"

    PROCEDURE Init
       SET DELETED ON
       IF ! FILE('KB.DBF')
          CREATE TABLE kb (art_categ C(10), ;
                  art_title C(35), article M, url M)
          INDEX ON art_title TAG art_title
          INDEX ON art_categ TAG art_categ
          USE
       ENDIF
       SELECT 0
       USE kb ORDER art_title ALIAS kb
       WITH Thisform
          .EdtArticle.ControlSource = "kb.article"
          .grdKb.RecordSource = "kb"
          .grdKb.RecordSourceType = 1
          cSite = 'http://www.winnersoft.coolfreepages.com'
          .AddProperty("oBrowser", ;
             CREATEOBJECT("internetexplorer.application"))
          .oBrowser.Navigate(cSite)
          .oBrowser.Visible = .T.
       ENDWITH
    ENDPROC

    PROCEDURE cmdAdd.Click
       LOCAL lcCategory
       lcCategory = SPACE(10)
       lcCategory = INPUTBOX("Category ", ;
                      "New Knowledge Article", lcCategory)
       lcTitle = SPACE(30)
       IF ! EMPTY(lcCategory)
          lcTitle = INPUTBOX("Title ", ;
                    "New Knowledge Article", lcTitle)
          IF ! EMPTY(lcTitle)
             _clipText = ""
             ThisForm.Obrowser.Document.ExecCommand("COPY")
             lcArticle = _clipText
             IF EMPTY(lcArticle)
                ThisForm.Obrowser.Document.ExecCommand("SelectAll")
                ThisForm.Obrowser.Document.ExecCommand("Copy")
             ENDIF
             lcArticle = _clipText
             ThisForm.Obrowser.Document.ExecCommand("UnSelect")
        **
             lcAddress = ThisForm.oBrowser.LocationUrl
             IF !EMPTY(lcArticle)
                INSERT INTO kb(art_categ, art_title, article, url) ;
                VALUES (lcCategory, lcTitle, lcArticle, lcAddress)
             ELSE
                MESSAGEBOX("You must select text in the browser instance",;
                          0, "Data incomplete")
             ENDIF
          ELSE
             MESSAGEBOX("You must specify a Title for this Knowledge Article", ;
                        0, "Data incomplete")
          ENDIF
       ELSE
          MESSAGEBOX("You must specify a catagory", ;
                     0, "Data incomplete")
       ENDIF
       ThisForm.Refresh()
       **
    ENDPROC

    PROCEDURE cmdfirst.Click
       GO TOP
       ThisForm.Refresh()
       ThisForm.grdKb.SetFocus()
    ENDPROC

    PROCEDURE cmdprev.Click
       IF !BOF()
          SKIP -1
          ThisForm.Refresh()
          ThisForm.grdKb.SetFocus()
       ENDIF
    ENDPROC

    PROCEDURE cmdnext.Click
       IF !EOF()
          SKIP
          IF EOF()
             SKIP -1
          ENDIF
          ThisForm.Refresh()
          ThisForm.grdKb.SetFocus()
       ENDIF
    ENDPROC

    PROCEDURE cmdlast.Click
       GO BOTTOM
       ThisForm.Refresh()
       ThisForm.grdKb.SetFocus()
    ENDPROC

    PROCEDURE cmddel.Click
       DELETE NEXT 1
       ThisForm.cmdNext.Click()
    ENDPROC

    PROCEDURE cmdnav.Click
       ThisForm.oBrowser.Navigate(ALLTRIM(kb.url))
    ENDPROC

    PROCEDURE cmdExit.Click
       USE IN KB
       ThisForm.Release
    ENDPROC

    PROCEDURE grdkb.AfterRowColChange
       LPARAMETERS nColIndex
       ThisForm.edtArticle.Refresh()
    ENDPROC

ENDDEFINE
* EndDefine: kbarticle
**************************************************
* Ramani (Subramanian.G) - FoxAcc / WinnerSoft
* www.winnersoft.coolfreepages.com
**************************************************
* Evaluate to let others know how useful is this.
**************************************************

Back to Microsoft: Visual FoxPro FAQ Index
Back to Microsoft: Visual FoxPro Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close