forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


VDSWorld News Reader

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript Open Source Projects
View previous topic :: View next topic  
Author Message
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Sun Dec 24, 2006 5:12 pm    Post subject: VDSWorld News Reader Reply with quote

Hi All,
I have built a news reader for VDSWorld.com. I posted the current source code at the VDSWorld main site. There is still room for it to grow. It needs to translate the BBCode. Maybe a System Tray Icon with tooltip windows. Anyway I am posting it as opensource. Have fun with it. Heres the code.

The code requires VDS 5.0, VDSBrw50.dll, GadgetX.dll, and Microsoft XML parser.


Code:

#-----------------------------------------------------------------------------#
#                                                                             #
# This is a simple RSS reader for VDSWorld.com                                #
#                                                                             #
# Author: Johnny Kinsey (A.K.A. DragonSphere)                                 #
#                                                                             #
# Copyright: Copyright 2006 Dragon Sphere Software                          #
#                                                                             #
#-----------------------------------------------------------------------------#
Option DecimalSep,"."

# I will add more to this later...  But for now it will read the RSS feed for the forum.
Title VDSWorld News
If @Greater(@Name(@SYSINFO(DSVER)),4)
  External GadgetX.dll,@SysInfo(DSVER)
  # GadgetX Commands
  #DEFINE COMMAND,GadgetX,DEFINE,OLE,Set
  # GadgetX Functions
  #DEFINE FUNCTION,GadgetX,OLE,Get,STREPL

  # VDS Browser
  External vdsbrw50.dll
  #DEFINE COMMAND,BROWSER
  #DEFINE FUNCTION,BROWSER

  # Utility functions
  #DEFINE FUNCTION,EMOTICONS
 
Else
  Warn This Example uses VDS 5 or above syntax.
  Stop
End


# The following line is required
Ole Init

# Define GadgetX variables that we will be using
Define Variable,Object,xmlDoc
Define Variable,Object,xmlChanNode
Define Variable,Object,Chan_elements
Define Variable,Collection,colChan_elements

Define Variable,Object,xmlNode
Define Variable,Object,elements
Define Variable,Collection,colelements

# Load the Microsoft XML DOM document object.
# I will be changing this to a different XML parser
Set xmlDoc,@Ole(Create,MSXML.DOMDocument)
# Set the object syncronous mode
Ole Set,xmlDoc,"Async = ^B",False

# List 1 will hold all the data for the RSS feed in the following format
# %%ChannelTitle@tab()%%ChannelLink@tab()%%Title@tab()%%Link@tab()%%PubDate@tab()%%Author@tab()@chr(34)%%Description@chr(34)
List create,1

# Add RSS 2.0 feed URL's to List 2
List create,2
List Add,2,http://forum.vdsworld.com/feed.rss
List Add,2,http://www.vdsworld.com/feed.rss


# Holds emoticons and image links
List create,3
List Add,3,:D@Tab()images/smiles/icon_biggrin.gif@Tab()Very Happy
List Add,3,:)@Tab()images/smiles/icon_smile.gif@Tab()Smile
List Add,3,:(@Tab()images/smiles/icon_sad.gif@Tab()Sad
List Add,3,:o@Tab()images/smiles/icon_surprised.gif@Tab()Surprised
List Add,3,:shock:@Tab()images/smiles/icon_eek.gif@Tab()Shocked
List Add,3,:?@Tab()images/smiles/icon_confused.gif@Tab()Confused
List Add,3,8)@Tab()images/smiles/icon_cool.gif@Tab()Cool
List Add,3,:lol:@Tab()images/smiles/icon_lol.gif@Tab()Laughing
List Add,3,:x@Tab()images/smiles/icon_mad.gif@Tab()Mad
List Add,3,:P@Tab()images/smiles/icon_razz.gif@Tab()Razz
List Add,3,:oops:@Tab()images/smiles/icon_redface.gif@Tab()Embarassed
List Add,3,:cry:@Tab()images/smiles/icon_cry.gif@Tab()Crying or Very sad
List Add,3,:evil:@Tab()images/smiles/icon_evil.gif@Tab()Evil or Very Mad
List Add,3,:twisted:@Tab()images/smiles/icon_twisted.gif@Tab()Twisted Evil
List Add,3,:roll:@Tab()images/smiles/icon_rolleyes.gif@Tab()Rolling Eyes
List Add,3,:wink:@Tab()images/smiles/icon_wink.gif@Tab()Wink
List Add,3,:!:@Tab()images/smiles/icon_exclaim.gif@Tab()Exclamation
List Add,3,:?:@Tab()images/smiles/icon_question.gif@Tab()Question
List Add,3,:idea:@Tab()images/smiles/icon_idea.gif@Tab()Idea
List Add,3,:arrow:@Tab()images/smiles/icon_arrow.gif@Tab()Arrow
List Add,3,:|@Tab()images/smiles/icon_neutral.gif@Tab()Neutral
List Add,3,:mrgreen:@Tab()images/smiles/icon_mrgreen.gif@Tab()Mr. Green
List Add,3,8|@Tab()images/smiles/icon_eye.gif@Tab()Rolleyes
List Add,3,:worship:@Tab()images/smiles/icon_worship.gif@Tab()Worship
List Add,3,:crying:@Tab()images/smiles/ext_cry.gif@Tab()Crying
List Add,3,:bigsmile:@Tab()images/smiles/ext_bigsmile.gif@Tab()Big Smile
List Add,3,:hi:@Tab()images/smiles/ext_hi.gif@Tab()Hi
List Add,3,:insane:@Tab()images/smiles/ext_insane.gif@Tab()Insane
List Add,3,:miserable:@Tab()images/smiles/ext_miserable.gif@Tab()Miserable
List Add,3,:shame:@Tab()images/smiles/ext_shame.gif@Tab()Shame (on you)
List Add,3,:zzz:@Tab()images/smiles/ext_sleep.gif@Tab()Sleep
List Add,3,:stupid:@Tab()images/smiles/ext_stupid.gif@Tab()Stupid
List Add,3,:thumbsup:@Tab()images/smiles/ext_thumbsup.gif@Tab()Thumbs Up
List Add,3,:tired:@Tab()images/smiles/ext_tired.gif@Tab()Tired
List Add,3,:wave:@Tab()images/smiles/ext_wave.gif@Tab()Wave
List Add,3,:yes:@Tab()images/smiles/ext_yes.gif@Tab()Yes
List Add,3,:no:@Tab()images/smiles/ext_no.gif@Tab()No
List Add,3,:dontknow:@Tab()images/smiles/ext2_shakehead.gif@Tab()Don't know
List Add,3,:confusedangry:@Tab()images/smiles/ext2_confangry.gif@Tab()Confused, angry
List Add,3,:confused:@Tab()images/smiles/ext2_confused2.gif@Tab()Confused
List Add,3,:noclue:@Tab()images/smiles/ext2_nixweiss.gif@Tab()No clue
List Add,3,:eek:@Tab()images/smiles/ext2_eek2.gif@Tab()Eek
List Add,3,:tounge:@Tab()images/smiles/ext_tounge.gif@Tab()Sticking Out Tounge
List Add,3,:banana:@Tab()images/smiles/ext_banana.gif@Tab()Dancing Banana
List Add,3,:outta:@Tab()images/smiles/ext_outta.gif@Tab()Outta Here

:MainDialog
  DIALOG CREATE,VDSWorld News,-1,0,311,577,COLOR WHITE,SNAP
  DIALOG ADD,STYLE,ctrlssty2,Times New Roman,10,,C5CED6,BLACK
  DIALOG ADD,STYLE,ctrlssty,Times New Roman,10,L,ECF0F6,BLACK
  DIALOG ADD,STYLE,ctrlssty1,Times New Roman,10,C,ECF0F6,BLACK
  DIALOG ADD,STYLE,TitleSty,Tahoma,12,BUC,WHITE,BLACK
REM *** Modified by Dialog Designer on 12/23/2006 - 21:52 ***
  DIALOG ADD,TEXT,feedstxt,16,5,302,34,,,CLICK,TitleSty,HAND
  DIALOG ADD,LINE,layer1,54,4,305,501
  DIALOG ADD,TEXT,postslbl,55,5,302,32,@chr(32)Post:,,ctrlssty2
  DIALOG ADD,COMBO,postscbo,58,36,200,21,,Select a post to view,CLICK
  #DIALOG ADD,TEXT,lnktxt,104,5,302,24,,Click to open post,CLICK,ctrlssty,HAND
  DIALOG ADD,BUTTON,view,59,240,64,24,View
  DIALOG ADD,TEXT,authorlbl,88,5,68,16,@chr(32)Author:,,ctrlssty
  DIALOG ADD,TEXT,authortxt,88,74,233,16,,,ctrlssty
  DIALOG ADD,TEXT,datetimelbl,104,5,68,16,@chr(32)Posted:,,ctrlssty
  DIALOG ADD,TEXT,datetimetxt,104,74,233,16,,,ctrlssty
  DIALOG ADD,TEXT,descrlbl,120,5,68,16,@chr(32)Description:,,ctrlssty
  DIALOG ADD,TEXT,descrlbl2,120,74,233,16,,,ctrlssty
  DIALOG ADD,BROWSER,BROWSER1,137,5,302,379,,,NONAVIGATE
  DIALOG ADD,TEXT,blanktxt,517,5,302,36,,,ctrlssty2
  DIALOG ADD,BUTTON,BUTTON1,522,122,64,24,Update
  DIALOG ADD,STATUS,STATUS1,
  DIALOG ADD,TASKICON,TASK1,,Click to Show
  DIALOG SHOW
  %%ChannelLink =
  %%OldIdx =
  %%Hiding = 0 
  GoSub BUTTON1BUTTON

:evloop
  Repeat
    wait event,0.003
    %E = @event()
    If %E
      GoSub %E
    End
  Until @Equal(%E,CLOSE)@Equal(%E,QUITMENU)
Exit

:TIMER
  If @Equal(@winpos(VDSWorld News,S),2)
    %%Hiding = 1
    Dialog HIDE
  End
Exit

:BROWSER1NAVIGATE

Exit

:TASK1CLICK
  %%MB = @click(B)
  if @Equal(%%MB,RIGHT)
    If @Equal(%%Hiding,1)
      DIALOG POPUP,Show|View|Update|Quit,
    Elsif @Equal(%%Hiding,0)
      DIALOG POPUP,Hide|View|Update|Quit,
    End
  Elsif @Equal(%%MB,LEFT)
    DIALOG SHOW
    WINDOW NORMAL,VDSWorld News
    %%Hiding = 0
  End
Exit

:SHOWMENU
    DIALOG SHOW
    WINDOW NORMAL,VDSWorld News
    %%Hiding = 0
Exit

:HIDEMENU
  WINDOW ICONIZE,VDSWorld News
  %%Hiding = 1 
Exit

:FEEDSTXTCLICK
  # Launches the Website link
  If %%ChannelLink
    Dialog Set,Status1,Opening %%ChannelLink...
    Shell Open,%%ChannelLink
    Dialog Set,Status1
  End
Exit

:VIEWMENU
:LNKTXTCLICK
:VIEWBUTTON
  # Launches the direct link to the post
  If %%Link
    Dialog Set,Status1,Opening %%Link...
    Shell Open,%%Link
    Dialog Set,Status1
  End
Exit

:TIMER1CTDOWN
:UPDATEMENU
:BUTTON1BUTTON
 # Get the RSS 2.0 Feed
 Dialog Set,Status1,Updating...
 Dialog Set,TASK1,Updating...
 #List clear,1
 #List clear,postscbo
 %%cnt = 0
 %%count = @count(2)
 %%ChannelTitle =
 Repeat
 # Get a URL from List 2
 Ole Call,xmlDoc,"Load(^B)",@Item(2,%%cnt)
 # Process the URL
 # Get a collection of channels usually there is only 1
 Set Chan_elements,@Ole(Call,xmlDoc,^o,"documentElement.getElementsByTagName(^B)",channel)
 Set colChan_elements,@Ole(BeginCollection,Chan_elements)
 # Loop through the XML channel elements collection
 While @Ole(Next,xmlChanNode,in,colChan_elements)
   %%ChannelTitle = @Ole(Get,xmlChanNode,"^B","selectSingleNode(^B).text",title)
   %%ChannelLink = @Ole(Get,xmlChanNode,"^B","selectSingleNode(^B).text",link)
   If %%ChannelLink
     %%IsSmartFeed = @Pos(smartfeed.php,%%ChannelLink)
     If @Greater(%%IsSmartFeed,0)
       %%ChannelLink = @Substr(%%ChannelLink,1,@Pred(%%IsSmartFeed))
     End
   End   
   # Get a collection of the Item elements
   Set elements,@Ole(Call,xmlDoc,^o,"documentElement.getElementsByTagName(^B)",item)
   Set colelements,@Ole(BeginCollection,elements)
   %%Item =
   # Loop through the XML elements collection
   While @Ole(Next,xmlNode,in,colelements)
    %%Title = @Ole(Get,xmlNode,"^B","selectSingleNode(^B).text",title)
    %%Link = @Ole(Get,xmlNode,"^B","selectSingleNode(^B).text",link)
    %%PubDate = @Ole(Get,xmlNode,"^B","selectSingleNode(^B).text",pubDate)
    %%Author = @Ole(Get,xmlNode,"^B","selectSingleNode(^B).text",author)
    %%Description = @Ole(Get,xmlNode,"^B","selectSingleNode(^B).text",description)
    # Syntax: @Emoticons(Description,ChannelLink,VDS List of Emoticon info)
    %%Description = @Emoticons(%%Description,%%ChannelLink,3)
    %%Item = %%ChannelTitle@tab()%%ChannelLink@tab()%%Title@tab()%%Link@tab()%%PubDate@tab()%%Author@tab()%%Description
    If @Greater(@count(1),0)
     List Seek,1,0
    End
    If @Null(@Match(1,%%Item))
      # If the post has not been added add the title to the posts combo box
      List Add,postscbo,%%Title
      Dialog Set,TASK1,%%Title
      # Add all the collected data to List 1
      List Add,1,%%Item
    End
   Wend
 Wend
 If @Greater(@count(postscbo),0)
   List Seek,postscbo,0
 End
 %%cnt = @succ(%%cnt)
 Until @Equal(%%cnt,%%count)
 If @Greater(@count(postscbo),0)
   List Seek,postscbo,0
   Dialog Set,TASK1,@Item(postscbo,0)
   # For some strange reason I had to resort to sending keys to the combo box to have it send a click event :-(
   Window Send,@winexists(~postscbo),@KEY(DOWN)
   Window Send,@winexists(~postscbo),@KEY(UP)   
 End
 Dialog Set,Status1,Update complete
 TIMER START,1,CTDOWN,00-00:30:00
Exit

:POSTSCBOCLICK
  # This will update the dialog when you choose a post
    %%Idx = @Index(postscbo)
      %%Item = @Item(1,%%Idx)
      If %%Item
        %%OldSep = @fsep()
        Option FieldSep,@Tab()
        Parse "%%ChannelTitle;%%ChannelLink;%%Title;%%Link;%%PubDate;%%Author;%%Description",%%Item
        Dialog Set,feedstxt,%%ChannelTitle
        # Dialog Set,lnktxt,%%Link
        Dialog Set,Status1,%%Link...
        If @Greater(@Pos(vdsworld,%%ChannelTitle),0)
          Dialog Set,authortxt,@SubStr(%%Author,@Succ(@Pos(@chr(40),%%Author)),@Pred(@Pos(@chr(41),%%Author)))
        Else
          Dialog Set,authortxt,%%Author
        End
        Dialog Set,datetimetxt,%%PubDate
        Dialog Set,BROWSER1,<HTML><HEADER><link rel="stylesheet" href="http://www.vdsworld.com/templates/lightblue/style.css" type="text/css" /></HEADER><BODY><span class="postbody">%%Description</span></BODY></HTML>

        Option FieldSep,%%OldSep
        %%OldIdx = %%Idx
      End

Exit

:QUITMENU
:CLOSE
 # close and clean up everything
 if @Get(colChan_elements)
   Ole Free,Collection,colChan_elements
 end
 if @Get(Chan_elements)
   Ole Free,Object,Chan_elements
 end
 if @Get(colelements)
   Ole Free,Collection,colelements
 end
 if @Get(elements)
   Ole Free,Object,elements
 end

 if @Get(xmlDoc)
   Ole Free,Object,xmlDoc
 end
 List clear,1
 List clear,2
 List clear,3
 List close,1
 List close,2
 List close,3
Exit

# Utility functions below

:emoticons
  # This function hunts for emoticons in the description and replaces the emoticons with their image links
  # Returns the description with all emoticons replaced
 
  # Description text
  %R = %1
  # ChannelLink
  %Z = %2
  # VDS List with Emoticon information
  %L = %3
 
    %%icnt = 0
    %%icount = @count(%L)
    %%OldSep = @fsep()
    Option FieldSep,@Tab()
    repeat
      %%EmoticonInfo = @Item(%L,%%icnt)
      Parse "%%Emoticon;%%EmoticonLink;%%EmoticonAlt",%%EmoticonInfo
      If @Greater(@Pos(%%Emoticon,%R),0)
        %%EmoticonLink = <img src=@Chr(34)%Z%%EmoticonLink@Chr(34) alt=@Chr(34)%%EmoticonAlt@Chr(34) border=@Chr(34)0@Chr(34) />
        %R = @Strepl(%R,%%Emoticon,%%EmoticonLink)
      End
      %%icnt = @Succ(%%icnt)
    Until @Equal(%%icnt,%%icount)
    Option FieldSep,%%OldSep
 

Exit %R

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Tue Jan 02, 2007 11:34 pm    Post subject: Reply with quote

Hi All,
As you can probably see I have updated the VDSWorld News code above. Now the code will search the description text for the Emoticons and replace them with their image links. I have also added a TaskIcon with a simple menu for this as well.

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Tue Jan 16, 2007 3:55 am    Post subject: Reply with quote

Hi All,
This is now a package. Go here to download all the needed files including a compiled exe and the source. http://www.vdsworld.com/search.php?view_mode=fileinfo&file_id=484

Have Fun... Several updates have been added.

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Fri Jan 19, 2007 9:49 pm    Post subject: Reply with quote

Hmmm,
More updates... Goto the URL above and check them out.

My bad Embarassed I fat fingered somethings but now those have been fixed.

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Fri Jan 26, 2007 10:34 pm    Post subject: Reply with quote

Hi all,
A couple more updates. Go grab the new version from the URL above and delete the old and extract the new in its place. Have fun Wave

Also I forgot to mention in the File description that the program now defaults to sorting the items by it's viewstate so this means items that you have already read will be at the bottom of the feed while items you have not read will be at the top. Basicly as new items come in they should be at the top of the list. I didn't like scrolling and scrolling to find items I had not read yet. Please give me your thoughts about this?

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Boo
Valued Contributor
Valued Contributor


Joined: 31 Oct 2003
Posts: 599
Location: Gulf Breeze, Florida USA

PostPosted: Mon Aug 16, 2010 12:36 am    Post subject: Reply with quote

I am unable to run your example... I get run time error 11 at line 441...

Any chance of updating this example? Thanks.
Back to top
View user's profile Send private message
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Tue Aug 17, 2010 1:42 pm    Post subject: Reply with quote

This is a free open source project for VDS NOOB's to learn from. The VDS code is given please update as you desire all I ask is that you share your changes or fixes so others may benefit and learn as well. Most likely it is missing a resource or some other data.
_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Boo
Valued Contributor
Valued Contributor


Joined: 31 Oct 2003
Posts: 599
Location: Gulf Breeze, Florida USA

PostPosted: Tue Aug 17, 2010 6:05 pm    Post subject: Reply with quote

Cool. Thanks.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript Open Source Projects All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum




Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group