View previous topic :: View next topic |
Author |
Message |
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1751 Location: Space and Time
|
Posted: Sun Dec 22, 2002 1:27 am Post subject: Script Template |
|
|
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 |
|
|
GeoTrail Valued Contributor
Joined: 18 Feb 2003 Posts: 572 Location: Bergen, Norway
|
Posted: Thu Mar 06, 2003 11:58 am Post subject: |
|
|
Nice template.
I specially like the error handling and the save window position routine
Very cool.
I'm gonna use some of your codes in my template _________________
|
|
Back to top |
|
|
Skit3000 Admin Team
Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Thu Mar 06, 2003 6:46 pm Post subject: |
|
|
Ever heard of the 'savepos' style? That one will also save the last position of the window. |
|
Back to top |
|
|
FreezingFire Admin Team
Joined: 23 Jun 2002 Posts: 3508
|
Posted: Thu Mar 06, 2003 6:52 pm Post subject: |
|
|
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 |
|
|
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1751 Location: Space and Time
|
Posted: Thu Mar 06, 2003 6:59 pm Post subject: |
|
|
Well, I have had SAVEPOS not work for me most of the time. I like this way better. It can also be made to save the window size. _________________ Chris
Http://theblindhouse.com |
|
Back to top |
|
|
ShinobiSoft Professional Member
Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Thu Mar 06, 2003 7:04 pm Post subject: |
|
|
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 |
|
|
|
|
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
|
|