| View previous topic :: View next topic |
| Author |
Message |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Sun Mar 09, 2003 11:18 am Post subject: VDS Snippet Libraries |
|
|
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 |
|
 |
GeoTrail Valued Contributor


Joined: 18 Feb 2003 Posts: 572 Location: Bergen, Norway
|
Posted: Sun Mar 09, 2003 4:49 pm Post subject: |
|
|
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
robert@geotrail.no
Thanks in advance. _________________
 |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Sun Mar 09, 2003 4:55 pm Post subject: |
|
|
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.
[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  _________________ 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 |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Sun Mar 09, 2003 9:13 pm Post subject: |
|
|
| 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 |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Sun Mar 09, 2003 11:00 pm Post subject: |
|
|
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 |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Mon Mar 10, 2003 1:02 am Post subject: |
|
|
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 |
|
 |
|
|
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
|
|