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 


Tutorial Source File

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Knowledge Base
View previous topic :: View next topic  
Author Message
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Thu Feb 06, 2003 10:56 pm    Post subject: Tutorial Source File Reply with quote

__________________________________________________________________________________________________________________________

Here is a tutorial source file for the beginners of Visual DialogScript. I
tried to implement everything I had trouble finding out in it except for
progress bars which I will post a separate example for.

Code:
REM -- Tutorial script by FreezingFire at the VDSWORLD Forums (http://forum.vdsworld.com)
REM -- Permission is herby granted to redistribute this script.

title "Tutorial"
REM -- The TITLE command specifies the program's title. The actual dialog titles are NOT
REM -- specified with this command, but rather with the DIALOG command, which will be
REM -- explained further in this tutorial. The title can be changed by using this command
REM -- at any time. Note that the quotes are used to prevent errors. For example, if a
REM -- comma is placed within a set of quotes, it will not affect it, while a comma
REM -- in a command that is not supposed to separate a command will create an error.

OPTION ERRORTRAP,"Error"
REM -- This command will trap any errors in your script and generate the event "Error", which
REM -- will call for the label :Error. This way you can process your own error messages and
REM -- display your own message or allow you to use other commands/functions. Be sure that your
REM -- label :Error is in your script so that you can process the errror with this command.

%%hlp_path = C:\Program Files\Visual DialogScript\VDS.HLP
REM -- This is a variable. We are defining it for use later on in the script if an
REM -- error occurrs. You should set this variable to the path of your VDS.HLP help file.

OPTION SCALE,"96"
REM -- This command will make sure that your program's dialog boxes and controls will be
REM -- equally sized on systems that use different font sizes or accessibility options
REM -- for display. The "96" is the standard scale size and should be used most of the time.

info "Welcome to the to VDS Tutorial Script!"
REM -- This command will display a standard Windows information box. All that is needed is
REM -- text, preferably enclosed in quotes so that no errors occurr. These boxes will use the
REM -- same title as what was specified using the TITLE command.

warn "This is a "@chr(34)"Warning"@chr(34)" box."
REM -- This command uses the same syntax as the INFO command, but we are using quotes for
REM -- the text "WARNING". To display quotes in Visual DialogScript, you will need to use
REM -- the syntax @CHR(34). The function @CHR() converts the ASCII code for a character to
REM -- an actual character. The reason for the extra quotes is so that the function @CHR()
REM -- will work.

  DIALOG CREATE,Tutorial - [Dialog Title],-1,0,255,103,COLOR Yellow,CLASS VDSTutorialDlg
REM -- This command will create the dialog you are about to see. The actual dialog title
REM -- is set through this command and is NOT set by the TITLE command mentioned eariler.
REM -- The syntax of this command is:
REM --   DIALOG CREATE, TITLE, TOP, LEFT, WIDTH, HEIGHT, COLOR, CLASS NAME
  DIALOG ADD,STYLE,BLUE-UNDERLINE,,,U,,BLUE
REM -- This line defines the style we will be using for a link on our dialog box. Styles
REM -- are generally better to edit through the dialog designer that comes with VDS. You
REM -- can edit this dialog by selecting the word "DIALOG" in the DIALOG CREATE command
REM -- and pressing F2 which in the VDS IDE.
  DIALOG ADD,STYLE,BIG,Arial,18,,,
REM -- This is another style we will be using to make some text large.
  DIALOG ADD,TEXT,TEXT1,15,14,,,Welcome!,,BIG
REM -- This text uses the style "Big", which was defined directly above this line.
  DIALOG ADD,TEXT,TEXT2,48,14,,,Visit VDSWORLD!,,CLICK,BLUE-UNDERLINE,HAND
REM -- This is a link. It is a normal TEXT element but also uses the CLICK command,
REM -- which will generate a TEXT2CLICK event, calling to the label :TEXT2CLICK.
REM -- We also use the BLUE-UNDERLINE style defined above, and the style for using
REM -- a HAND cursor for this link.
  DIALOG ADD,STATUS,STATUS1,Welcome to the Visual DialogScript tutorial script!
REM -- This adds a status bar to the bottom of the dialog.
  DIALOG ADD,BUTTON,Close,24,150,88,40,Close,,BIG
REM -- This adds a close button to our dialog.
  DIALOG SHOW
REM -- This command shows the dialog that is created.

:Evloop
REM -- This is a label. It defines where a script should go when an event is generated.
REM -- This label and the commands directly following will be the "central event processing"
REM -- part of the script.
  wait event,1
REM -- This command tells the script to wait for an event. If an event is not generated, it
REM -- generates a TIMER event.
  goto @event()
REM -- This command will take the script to the actual event label.
:Timer
REM -- This part is not really needed but is in this tutorial script for demonstration purposes.
REM -- It is used in conjuction with the "wait event,1" command. If you choose not to use the
REM -- TIMER event, you should remove the ",1" from the "wait event".
  goto evloop
REM -- This returns the script to our "central event processing" part of the script.

:TEXT2CLICK
REM -- This is the link click event from our dialog. Now we're going to open a web page.
shell open,"http://www.vdsworld.com/"
REM -- The command above opens the main VDSWORLD site.
  goto evloop
REM -- This returns the script to our "central event processing" part of the script.

:CloseBUTTON
goto close

:Error
warn Oops! There's an error in your code! It's code @error(e) at line @error(n)!
warn I'm going to use the WINHELP command to open the Error Messages page.
WINHELP %%Hlp_Path,Error Messages
REM -- This opens the help file to the "Error Messages" page.
exit

:Close
if @ask(Do you want to generate an error before exiting?)
>> This will generate an error because it is invalid syntax.
end
exit

_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Knowledge Base 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