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 


Script Template

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 4 Source Code
View previous topic :: View next topic  
Author Message
LiquidCode
Moderator Team


Joined: 05 Dec 2000
Posts: 1751
Location: Space and Time

PostPosted: Sun Dec 22, 2002 1:27 am    Post subject: Script Template Reply with quote

Here is a template that I use for most of the programs that I make. It is
just a good starting point that I like to use.

Code:

   rem ** Standard Template for new scripts **
   option scale, 96
   option decimalsep, "."
   dialog create,dummy,0,0,0,0
   rem ** About Box/Program Settings **
   %%ver = 1.0
   %%title = Program
   %%author = Me
   %%programmer = Me
   %%webaddress = http://www.MyAddress.com
   %%emailaddress = "Support@MyAddress.com"
   title %%title %%ver
   rem ** End About Box/Program Settings **

:DebugCode
   rem -- Remove this if using "debug" at command line --
   %1 = "debug"
   rem == Debugging procedure =================================
:DEBUG
   if @equal(%1, "debug")
      option ERRORTRAP, ERROR
   end
   goto DEBUG_END
:ERROR
   %%errortype = @error(E)
   %%errorline = @error(N)
   %%error = Error %%ErrorType at line %%ErrorLine
   if @equal(%%ErrorType,12)
      warn Function not yet available.
      goto evloop
   end
   if @ask(%%error@cr()@cr()Do you wish to stop?@cr()@cr()Press YES if main program window is not visible.@tab())
      list CREATE, 9
      list ADD, 9, @datetime(hh:mm:ss am/pm) %%error
      list SAVEFILE, 9, @path(%0)@name(%0)_error.log
      list close,9
      stop
   end
   goto EVLOOP
:DEBUG_END
   rem ========================================================

   rem ** Main Code **
:main
   directory change,@path(%0)
   gosub Getini
   dialog CREATE,%%title %%ver,%%top,%%left,240,160
   rem *** Modified by Dialog Designer on 12/21/2002 - 20:12 ***
   dialog ADD,BUTTON,About,36,92,64,24,About
   dialog SHOW

:evloop
   wait event
   parse "%e;%d",@event(D)
   goto %e

:Close
   gosub setini
   stop
   rem ** End Main Code **

   rem ** Subs **

:SETINI
   inifile open,@path(%0)@name(%0)".ini"
   inifile write,%%title,Top,@dlgpos(,T)
   inifile write,%%title,Left,@dlgpos(,L)
   inifile write,%%title,OnTop,%%ontop
   exit

:GETINI
   inifile open,@path(%0)@name(%0)".ini"
   %%top = @iniread(%%title,Top,-1)
   %%left = @iniread(%%title,Left,0)
   %%ontop = @iniread(%%title,OnTop,Ontop)
   exit

:AboutButton
   Info Add your about box here.
   goto evloop

_________________
Chris
Http://theblindhouse.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
GeoTrail
Valued Contributor
Valued Contributor


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

PostPosted: Thu Mar 06, 2003 11:58 am    Post subject: Reply with quote

Nice template.
I specially like the error handling and the save window position routine Smile

Very cool.
I'm gonna use some of your codes in my template Wink

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Thu Mar 06, 2003 6:46 pm    Post subject: Reply with quote

Ever heard of the 'savepos' style? That one will also save the last position of the window. Wink
Back to top
View user's profile Send private message
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Thu Mar 06, 2003 6:52 pm    Post subject: Reply with quote

Quote:
SAVEPOS: save the dialog position (and size) and restore from the saved information next time it is created. This style can have an optional text ID to distinguish between different dialogs in a multi-dialog script, for example: SAVEPOS Options.

Copyright © 1995 - 2002 S.A.D.E. s.a.r.l. / All rights are reserved.

_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
LiquidCode
Moderator Team


Joined: 05 Dec 2000
Posts: 1751
Location: Space and Time

PostPosted: Thu Mar 06, 2003 6:59 pm    Post subject: Reply with quote

Well, I have had SAVEPOS not work for me most of the time. I like this way better. Razz It can also be made to save the window size.
_________________
Chris
Http://theblindhouse.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ShinobiSoft
Professional Member
Professional Member


Joined: 06 Nov 2002
Posts: 790
Location: Knoxville, Tn

PostPosted: Thu Mar 06, 2003 7:04 pm    Post subject: Reply with quote

SAVEPOS saves the dialogs position in either the registry or in an .ini file
in the Window directory. Try DS16.ini.

_________________
Bill Weckel
ShinobiSoft Software

"The way is known to all, but not all know it."
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 4 Source Code 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