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 


VDS Snippet Libraries

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Sun Mar 09, 2003 11:18 am    Post subject: VDS Snippet Libraries Reply with quote

Update: Snippet begin marker and end marker has changed from
"<<Snippet Title Here" to "<<BEGINSNIP>>Snippet Title Here" and
">>" to "<<ENDSNIP>>". The marker for the end of the library has
also changed from ">>>" to "<<ENDLIB>>". Changes made to avoid
potential errors of someone having "<<", ">>" or ">>>" in their snippet
as part of the snippet.

Update: File extension of snippet libraries has been changed from
.snp to .snip due to other programs already using the .snp file
extension.

Greetings,

I've been working on a snippet program for VDS. It will allow for
multiple libraries of snippets to be used.

The interface is a tree view list box (William Weckles new dll), where
each top level folder is the begining of a library. Each library can
consist of 1 or numerous individual snippets.



The format for a snippet library is this:

Name of the library file is the name showing in the tree list, "Garrett's
Mixed Snips" file name is "Garrett's Mixed Snips.snip" and resides in
a sub-directory just for the snippets off the snippet program's
directory.

The source for a library goes like this:

Code:
<<BEGINSNIP>>Word Wrap
%%InText = "Only as an example, this resembles an address book.  But it is not a fully functional program at all.  It merely shows you how to insert and remove list items in a simple way."
%%WrapAt = 50
List Create,1
Repeat
  %%WrapCounter = %%WrapAt
  Repeat
    %A = @substr(%%InText,%%WrapCounter,%%WrapCounter)
    If @not(@equal(%A,@chr(32)))
      %%WrapCounter = @succ(%%WrapCounter)
    End
  Until @equal(%A,@chr(32))@not(@greater(@len(%%InText),%%WrapAt))
  List Add,1,@substr(%%InText,1,%%WrapCounter)
  %%InText = @substr(%%InText,%%WrapCounter,@len(%%InText))
Until @null(%%InText)
Info @text(1)
List clear,1
List close,1
<<ENDSNIP>>
<<BEGINSNIP>>Ctrl+Alt+Del
  OPTION SKDELAY,100
  If @greater(@file(@windir()\command.com,z),1)
    RUNH command
    Wait 1
    Window Send,MS-DOS Prompt,@ctrl(@alt(@key(DEL)))
    Window Close,MS-DOS Prompt
  Else
    This is not Win9x System
  End
  Exit
<<ENDSNIP>>


"<<BEGINSNIP>>" denotes the begining of a snippet, and is also the
title line for the snippet. The title goes immediately after the
"<<BEGINSNIP>>" marks. The "<<ENDSNIP>>" denotes the end of
the snippet. It must be one line below the actual end of the snippet.

To mark the end of the entire library, you add "<<ENDLIB>>" one
line below the very last line of the last snippet like:

Code:
<<BEGINSNIP>>Word Wrap
%%InText = "Only as an example, this resembles an address book.  But it is not a fully functional program at all.  It merely shows you how to insert and remove list items in a simple way."
%%WrapAt = 50
List Create,1
Repeat
  %%WrapCounter = %%WrapAt
  Repeat
    %A = @substr(%%InText,%%WrapCounter,%%WrapCounter)
    If @not(@equal(%A,@chr(32)))
      %%WrapCounter = @succ(%%WrapCounter)
    End
  Until @equal(%A,@chr(32))@not(@greater(@len(%%InText),%%WrapAt))
  List Add,1,@substr(%%InText,1,%%WrapCounter)
  %%InText = @substr(%%InText,%%WrapCounter,@len(%%InText))
Until @null(%%InText)
Info @text(1)
List clear,1
List close,1
<<ENDSNIP>>
<<BEGINSNIP>>Ctrl+Alt+Del
  OPTION SKDELAY,100
  If @greater(@file(@windir()\command.com,z),1)
    RUNH command
    Wait 1
    Window Send,MS-DOS Prompt,@ctrl(@alt(@key(DEL)))
    Window Close,MS-DOS Prompt
  Else
    This is not Win9x System
  End
  Exit
<<ENDSNIP>>
<<ENDLIB>>


More information about using the program itself such as adding,
editing and deleting snippets will be released when the program
is released.

For now, I'd like to ask if anyone would like, or would be willing to
make some snippet libraries of their own that they would like included
in the distribution of the snippet program. Just follow the examples
above to create your libraries and then email them to me at
"garrett@vdsworld.com".

What I consider to be a snippet is a line or several lines of code that
can be dropped into a program. Such as the above examples. Not
entire program examples.

If your snippets are specific to a version of VDS, then name your
library something like "Mac's VDS3 Snips", or if your snippets are
a collection of internet related routines, then name them something
like "Tommy's Internet Snips".... Of course, use your own name and
not Mac's or Tommy's name. If your snippets are a mix of specific
vds version code, then add a little comment in the snippet, or add to
the snippet's title with a "VDS2" or "VDS3" or "VDS4". But do try to
keep the comments in the snippets short and to the point. The idea
of this is for quick access and usage of the snippets, and not having
to read 20 lines of commenting.

Once I have the initial ground work of the program completed and
it's ready for distribution, I will be dropping the source code into the
"Open Source Projects" forum for anyone to add, edit or whatever.

And maybe, if enough people take to making and using these snippet
libraries, they'll get their own section on the Main part of the VDS
World Site.

-Garrett

_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)


Last edited by Garrett on Mon Mar 10, 2003 1:01 am; edited 3 times in total
Back to top
View user's profile Send private message
GeoTrail
Valued Contributor
Valued Contributor


Joined: 18 Feb 2003
Posts: 572
Location: Bergen, Norway

PostPosted: Sun Mar 09, 2003 4:49 pm    Post subject: Reply with quote

Hey Garrett. Any chance of compiling that and sending it to me? Would help me out alot. I'm not very organized and I store all the code snippets in an unorganized way that I can't even figure out my self Wink

robert@geotrail.no

Thanks in advance.

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Sun Mar 09, 2003 4:55 pm    Post subject: Reply with quote

I've been using this over a year if anyone's interested in the
code. The top line of the edit box on the right is the title shown
on the left. It allows ya to edit/copy/paste snippets on the fly.
I have it in VDS\TOOLS folder and it shows up on the menu.
Saves files as code000.txt, code001.txt, etc. The files are only
created/saved as needed.

Not fancy, but it works. Wink



[EDIT] OOPS - originally said it had 100 max. Just looked at the
code and it only starts with 100 in the list, then adds more as
needed. Actual code files are only created/saved as needed.
Sorry - it's been a while since I wrote this...

I posted the code - it should be VDS3 and VDS4 compatible.

http://www.vdsworld.com/forum/viewtopic.php?p=8403#8403

Cheers, Mac Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Sun Mar 09, 2003 9:13 pm    Post subject: Reply with quote

GeoTrail wrote:
Hey Garrett. Any chance of compiling that and sending it to me?


It's not ready for distribution yet.

-Garrett

_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Back to top
View user's profile Send private message
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Sun Mar 09, 2003 11:00 pm    Post subject: Reply with quote

File extension for libraries has been changed from .snp to .snip due to
other programs already using the .snp file extension.

-Garrett

_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Back to top
View user's profile Send private message
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Mon Mar 10, 2003 1:02 am    Post subject: Reply with quote

Snippet begin marker and end marker has changed from
"<<Snippet Title Here" to "<<BEGINSNIP>>Snippet Title Here" and
">>" to "<<ENDSNIP>>". The marker for the end of the library has
also changed from ">>>" to "<<ENDLIB>>". Changes made to avoid
potential errors of someone having "<<", ">>" or ">>>" in their snippet
as part of the snippet.

-Garrett

_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
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 -> General Help 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