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 


Code Reference Editor/System/VDS Help File Attachement/Thing

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 3 Source Code
View previous topic :: View next topic  
Author Message
cnodnarb
Professional Member
Professional Member


Joined: 11 Sep 2002
Posts: 762
Location: Rockeledge, GA

PostPosted: Sat Oct 26, 2002 7:13 pm    Post subject: Code Reference Editor/System/VDS Help File Attachement/Thing Reply with quote

This code attaches a source code reference directly to the VDS Help file, you will have to supply the code references though Wink

Code:

REM INTELLECTUAL PROPRIETY OF BRANDON CUNNINGHAM
REM OPEN SOURCE FREEWARE
REM THIS FILE MUST BE DISTRIBUTED WITH ANY RELEASE AS ORIGINAL.DSC
REM DO NOT REMOVE THE TOP FOUR LINES
rem DESCRIPTION:  Attaches code references to vds.hlp
REM NOTE:  May have to open help file twice to see new references even though they are saved.
REM To uninstall run program with parameter uninstall

title Code Reference Editor
inifile open,@path(%0)coderef.ini

:vdspathinit
%%vdspath = @iniread(vds,path)
if @null(%%vdspath)
info This is your first time running this program"," it will attach a Code Reference to your VDS Help file.
goto askpath
else
end

if @equal(%1,uninstall)
goto uninstall
else
end

%%vdscntbak = @iniread(contents,backup)
if @null(%%vdscntbak)
directory create,@path(%0)vdscnt
file copy,%%vdspath\vds.cnt,@path(%0)vdscnt\vds.cnt
inifile write,contents,backup,1
else
end

list create,1,sorted

  DIALOG CREATE,Code Reference Editor,-1,0,403,403
  DIALOG ADD,GROUP,GROUP1,2,4,262,40,Title
  DIALOG ADD,GROUP,GROUP2,46,4,396,294,Code
  DIALOG ADD,BUTTON,BUTTON1,346,5,122,24,Save Reference
  DIALOG ADD,LIST,LIST1,128,102,180,144
  DIALOG ADD,EDIT,EDIT1,16,10,250,19
  DIALOG ADD,EDIT,EDIT2,60,10,384,272,,Multi,SCROLL
  DIALOG ADD,BUTTON,BUTTON2,376,5,122,24,Load Reference
  DIALOG ADD,BUTTON,BUTTON3,346,134,122,24,Delete Reference
  DIALOG ADD,BUTTON,BUTTON4,376,134,122,24,Open VDS Help
  DIALOG ADD,BUTTON,BUTTON5,346,262,122,24,Email CNodNarb
  DIALOG ADD,BUTTON,Button6,376,262,122,24,About
  DIALOG SHOW

  :evloop
  wait event
  goto @event()

:close
exit

:button1button
if @null(@dlgtext(edit1))
info Please enter a title.
goto evloop
else
end
dialog set,list1,@dlgtext(edit2)
directory create,@path(%0)coderef
list savefile,list1,@path(%0)coderef\@dlgtext(edit1).crf

:updateloop
list clear,list1
list loadfile,list1,@path(%0)vdscnt\vds.cnt
list seek,list1,0
list insert,list1,:Base vds.hlp>proc4
list insert,list1,:Index vds.hlp
list insert,list1,:Link vds.hlp
list add,list1,1 Code Reference
directory change,@path(%0)coderef
list clear,1
list filelist,1,*.crf

option fieldsep,"\"
parse "%a;%b;%c;%d;%e;%f;%g",@path(%0)coderef

rem %g is coderef
if %g
%%hlpdirtranslate = %a\\%b\\%c\\%d\\%e\\%f\\%g\\
goto gottrans
else
end

rem %f is coderef
if %f
%%hlpdirtranslate = %a\\%b\\%c\\%d\\%e\\%f\\
goto gottrans
else
end

rem %e is coderef
if %e
%%hlpdirtranslate = %a\\%b\\%c\\%d\\%e\\
goto gottrans
else
end

rem %d is coderef
if %d
%%hlpdirtranslate = %a\\%b\\%c\\%d\\
goto gottrans
else
end

rem %c is coderef
if %c
%%hlpdirtranslate = %a\\%b\\%c\\
goto gottrans
else
end

rem %b is coderef
if %b
%%hlpdirtranslate = %a\\%b\\
goto gottrans
else
end

rem %f is coderef
if %a
%%hlpdirtranslate = %a\\
goto gottrans
else
info There has been a fatal error and this program will now be shot.
info BANG! BANG!
info ARRGGHHH!
stop
end

:gottrans
REM List Seek Header by NodNarb
%%index = 0
%%count = @count(1)
repeat
list seek,1,%%index
list add,list1,@name(@item(1))"="!EF"("@chr(34)notepad.exe@chr(34)","@chr(34)%%hlpdirtranslate@item(1)@chr(34)","1")"
%%index = @succ(%%index)
until @equal(%%index,%%count)
list add,list1,1 Dummy Book
list savefile,list1,%%vdspath\vds.cnt
goto evloop

:button2button
directory change,@path(%0)coderef
%%filedlg = @filedlg(Code Reference Files|*.crf)
if %%filedlg
list loadfile,list1,%%filedlg
dialog set,edit2,@text(list1)
dialog set,edit1,@name(%%filedlg)
else
end
goto evloop

:button3button
if @file(@path(%0)coderef\@dlgtext(edit1).crf)
file delete,@path(%0)coderef\@dlgtext(edit1).crf
dialog clear,edit1
goto updateloop
else
info Code reference to remove does not exists.
end
goto evloop

:askpath
%%ask = @ask(Your Visual DialogScript path must be defined to continue"," would you like to define this path now?)
if %%ask
gosub vdspath
goto vdspathinit
else
info This program is now exiting.
exit
end
goto evloop
 
  :vdspath
rem must create tempdlg to use dirdlg function
dialog create,tempdlg
  %%vdspath = @dirdlg("Please locate your Visual DialogScript directory")
  rem close tempdlg
dialog close
  inifile write,vds,path,%%vdspath
  exit
 
  :button4button
  shell open,%%vdspath\vds.hlp
  goto evloop
 
  :button5button
  shell open,mailto:cnodnarb"@"aol.com
  goto evloop
 
  :button6button
  info Original program by Brandon @chr(34)NodNarb@chr(34) Cunningham"," whom is not liable for whatever complaint you may come up with"," no matter how viable.
  goto evloop
 
  :uninstall
  info This will remove Code Reference from you VDS Help File.  Please delete @path(%0)coderef @path(%0)coderef.ini @path(%0)coderef.exe @path(%0)coderef.dsc @path(%0)vdscnt AFTER pressing OK.
  file copy,@path(%0)vdscnt\vds.cnt,%%vdspath\vds.cnt
  info Uninstall complete.
  stop

Cheers!

NodNarb

PS Why do I feel like saying "Vote for Me!" or something?
Wink
Back to top
View user's profile Send private message AIM Address
Skit3000
Admin Team


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

PostPosted: Sat Oct 26, 2002 9:51 pm    Post subject: Reply with quote

Great code! The only thing is that I don't know what's the use of it (a lot of difficult English words... Smile )

But, that's not the reason I posted this reply.

In :Updateloop you must replace the line list seek,list1,0 (line 69) with this:
Code:
if @greater(@count(list1),0)
  list seek,list1,0
  end

Otherwise it will crash your script with a 'List index out of range'...
Back to top
View user's profile Send private message
Garrett
Moderator Team


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

PostPosted: Sat Oct 26, 2002 10:12 pm    Post subject: Reply with quote

I make that mistake a lot, especially when dealing with a lot of lists.

-Garrett
Back to top
View user's profile Send private message
cnodnarb
Professional Member
Professional Member


Joined: 11 Sep 2002
Posts: 762
Location: Rockeledge, GA

PostPosted: Sat Oct 26, 2002 10:16 pm    Post subject: Reply with quote

Actually, error trapping this particular case is not necessary, because vds.cnt must exists and have contents for this program to be useful.

HOWEVER I did mess up somewhere else, I accidently disabled the Find function in the help file. Here is the updated code.

The purpose of the program is to add a new "Book" in the VDS Help file containing useful code snippet "Pages".

Code:

REM INTELLECTUAL PROPRIETY OF BRANDON CUNNINGHAM
REM OPEN SOURCE FREEWARE
REM THIS FILE MUST BE DISTRIBUTED WITH ANY RELEASE AS ORIGINAL.DSC
REM DO NOT REMOVE THE TOP FOUR LINES
rem DESCRIPTION:  Attaches code references to vds.hlp
REM NOTE:  May have to open help file twice to see new references even though they are saved.
REM To uninstall run program with parameter uninstall

title Code Reference Editor
inifile open,@path(%0)coderef.ini

:vdspathinit
%%vdspath = @iniread(vds,path)
if @null(%%vdspath)
info This is your first time running this program"," it will attach a Code Reference to your VDS Help file.
goto askpath
else
end

if @equal(%1,uninstall)
goto uninstall
else
end

%%vdscntbak = @iniread(contents,backup)
if @null(%%vdscntbak)
directory create,@path(%0)vdscnt
file copy,%%vdspath\vds.cnt,@path(%0)vdscnt\vds.cnt
inifile write,contents,backup,1
else
end

list create,1,sorted

  DIALOG CREATE,Code Reference Editor,-1,0,403,403
  DIALOG ADD,GROUP,GROUP1,2,4,262,40,Title
  DIALOG ADD,GROUP,GROUP2,46,4,396,294,Code
  DIALOG ADD,BUTTON,BUTTON1,346,5,122,24,Save Reference
  DIALOG ADD,LIST,LIST1,128,102,180,144
  DIALOG ADD,EDIT,EDIT1,16,10,250,19
  DIALOG ADD,EDIT,EDIT2,60,10,384,272,,Multi,SCROLL
  DIALOG ADD,BUTTON,BUTTON2,376,5,122,24,Load Reference
  DIALOG ADD,BUTTON,BUTTON3,346,134,122,24,Delete Reference
  DIALOG ADD,BUTTON,BUTTON4,376,134,122,24,Open VDS Help
  DIALOG ADD,BUTTON,BUTTON5,346,262,122,24,Email CNodNarb
  DIALOG ADD,BUTTON,Button6,376,262,122,24,About
  DIALOG SHOW

  :evloop
  wait event
  goto @event()

:close
exit

:button1button
if @null(@dlgtext(edit1))
info Please enter a title.
goto evloop
else
end
dialog set,list1,@dlgtext(edit2)
directory create,@path(%0)coderef
list savefile,list1,@path(%0)coderef\@dlgtext(edit1).crf

:updateloop
list clear,list1
list loadfile,list1,@path(%0)vdscnt\vds.cnt
list seek,list1,0
list insert,list1,:Base vds.hlp>proc4
rem list insert,list1,:Index vds.hlp
rem list insert,list1,:Link vds.hlp
list add,list1,1 Code Reference
directory change,@path(%0)coderef
list clear,1
list filelist,1,*.crf

option fieldsep,"\"
parse "%a;%b;%c;%d;%e;%f;%g",@path(%0)coderef

rem %g is coderef
if %g
%%hlpdirtranslate = %a\\%b\\%c\\%d\\%e\\%f\\%g\\
goto gottrans
else
end

rem %f is coderef
if %f
%%hlpdirtranslate = %a\\%b\\%c\\%d\\%e\\%f\\
goto gottrans
else
end

rem %e is coderef
if %e
%%hlpdirtranslate = %a\\%b\\%c\\%d\\%e\\
goto gottrans
else
end

rem %d is coderef
if %d
%%hlpdirtranslate = %a\\%b\\%c\\%d\\
goto gottrans
else
end

rem %c is coderef
if %c
%%hlpdirtranslate = %a\\%b\\%c\\
goto gottrans
else
end

rem %b is coderef
if %b
%%hlpdirtranslate = %a\\%b\\
goto gottrans
else
end

rem %f is coderef
if %a
%%hlpdirtranslate = %a\\
goto gottrans
else
info There has been a fatal error and this program will now be shot.
info BANG! BANG!
info ARRGGHHH!
stop
end

:gottrans
REM List Seek Header by NodNarb
%%index = 0
%%count = @count(1)
repeat
list seek,1,%%index
list add,list1,@name(@item(1))"="!EF"("@chr(34)notepad.exe@chr(34)","@chr(34)%%hlpdirtranslate@item(1)@chr(34)","1")"
%%index = @succ(%%index)
until @equal(%%index,%%count)
list add,list1,1 Dummy Book
list savefile,list1,%%vdspath\vds.cnt
goto evloop

:button2button
directory change,@path(%0)coderef
%%filedlg = @filedlg(Code Reference Files|*.crf)
if %%filedlg
list loadfile,list1,%%filedlg
dialog set,edit2,@text(list1)
dialog set,edit1,@name(%%filedlg)
else
end
goto evloop

:button3button
if @file(@path(%0)coderef\@dlgtext(edit1).crf)
file delete,@path(%0)coderef\@dlgtext(edit1).crf
dialog clear,edit1
goto updateloop
else
info Code reference to remove does not exists.
end
goto evloop

:askpath
%%ask = @ask(Your Visual DialogScript path must be defined to continue"," would you like to define this path now?)
if %%ask
gosub vdspath
goto vdspathinit
else
info This program is now exiting.
exit
end
goto evloop
 
  :vdspath
rem must create tempdlg to use dirdlg function
dialog create,tempdlg
  %%vdspath = @dirdlg("Please locate your Visual DialogScript directory")
  rem close tempdlg
dialog close
  inifile write,vds,path,%%vdspath
  exit
 
  :button4button
  shell open,%%vdspath\vds.hlp
  goto evloop
 
  :button5button
  shell open,mailto:cnodnarb"@"aol.com
  goto evloop
 
  :button6button
  info Original program by Brandon @chr(34)NodNarb@chr(34) Cunningham"," whom is not liable for whatever complaint you may come up with"," no matter how viable.
  goto evloop
 
  :uninstall
  info This will remove Code Reference from you VDS Help File.  Please delete @path(%0)coderef @path(%0)coderef.ini @path(%0)coderef.exe @path(%0)coderef.dsc @path(%0)vdscnt AFTER pressing OK.
  file copy,@path(%0)vdscnt\vds.cnt,%%vdspath\vds.cnt
  info Uninstall complete.
  stop


NodNarb
Back to top
View user's profile Send private message AIM Address
GeoTrail
Valued Contributor
Valued Contributor


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

PostPosted: Fri Feb 21, 2003 5:26 am    Post subject: Reply with quote

Wow, very impressive. Shocked
_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
cnodnarb
Professional Member
Professional Member


Joined: 11 Sep 2002
Posts: 762
Location: Rockeledge, GA

PostPosted: Tue Feb 25, 2003 2:23 am    Post subject: Reply with quote

Thank you; glad someone found it useful other than me. Wink

Brandon "NodNarb" Cunningham
SAP
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 3 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