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 Checker - OPEN SOURCE

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


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

PostPosted: Thu Dec 19, 2002 6:58 pm    Post subject: Script Checker - OPEN SOURCE Reply with quote

Here it is. Maybe ya'll be able to help work the bugs out.

I can keep the newest compiled version on my web site.

If you've downloaded the .exe already you have the .dsr file for the bitbtn images. If not you can download the package here.
This program also uses the vdshtml.dll for displaying a report.

IMPORTANT NOTE:

Quote:
By the way, and this is important, DO NOT try to run the compiled Script
Checker on the Script Checker script. It doesn't work. At least it didn't for
me.


Code:

  %%rscfile = @path(%0)scrptchk.dsr
  rem *** Generated by Resource Compiler - do not modify *** [scrptchk.dsr]
  %%OpenFile_bmp = %%rscfile|0
  %%Spelling_bmp = %%rscfile|3126
  %%Help_bmp = %%rscfile|3372
  %%About_bmp = %%rscfile|3618
  %%ScriptChecker_ico = %%rscfile|4872
  %%Replace_ani = %%rscfile|8134
  rem *** End of code generated by Resource Compiler ***

  TITLE Script Checker 2.0
 
  external @path(%0)vdshtml.dll
 
  %%root = LOCAL
  %%key = Software\ShinobiSoft\Script Checker\2.0
  %%top = @regread(%%root,%%key\Main,Top,)
  %%left = @regread(%%root,%%key\Main,Left,)
 
  Option fieldsep,@chr(44)
  Option scale,96
   
  DIALOG CREATE,Script Checker,%%top,%%left,640,305,RESIZABLE,Class ScriptChecker
REM *** Modified by Dialog Designer on 12/4/02 - 20:28 ***
  dialog add,STYLE,St1,Courier New,9,,White,Black
  DIALOG ADD,MENU,&File,&Open|Ctrl+O,-,E&xit|Alt+X
  dialog add,MENU,&Script,&Generate Labels|F9
  DIALOG ADD,MENU,&Help,&Contents|F1,-,&About Script Checker
  DIALOG ADD,LIST,Script,0,0,0,0
  DIALOG ADD,GROUP,TBar1,0,5,630,30
  DIALOG ADD,BITBTN,Open,5,10,20,20,%%OpenFile_bmp,,Open script
  DIALOG ADD,GROUP,TBarSep1,0,35,2,30
  DIALOG ADD,BITBTN,Check,5,40,20,20,%%Spelling_bmp,,Check script
  DIALOG ADD,GROUP,TBarSep2,0,65,2,30
  DIALOG ADD,BITBTN,About,5,70,20,20,%%About_bmp,,About Script Checker
  DIALOG ADD,BITBTN,TBarHelp,5,95,20,20,%%Help_bmp,,Help contents
  DIALOG ADD,GROUP,GROUP1,35,5,190,245,Defined dialogs
  DIALOG ADD,LIST,Dialogs,50,10,180,225,,CLICK,St1
  DIALOG ADD,GROUP,GROUP2,35,200,435,245,Dialog code
  DIALOG ADD,EDIT,Code1,50,205,425,225,,,MULTI,SCROLL,TABS,St1
  DIALOG ADD,STATUS,Stat
  DIALOG SHOW
 
  %%dlgs = @winexists(~Dialogs)
  %%code = @winexists(~Code1)
  %%openb = @winexists(~Open)
  %%checkb = @winexists(~Check)
  %%aboutb = @winexists(~About)
  %%helpb = @winexists(~TBarHelp)
 
  list create,9
  list add,9,#%%dlgs|Defined dialogs within the current script - click on a dialog to view its description
  list add,9,#%%code|Contains the dialog code for the selected dialog
  list add,9,#%%openb|Opens a Visual DialogScript script for event checking
  list add,9,#%%checkb|Checks the current script for appropriate event labels and generates them if necessary
  list add,9,#%%aboutb|Opens the About Script Checker dialog
  list add,9,#%%helpb|Opens Script Checker Help contents
 
  if %1
    goto OpenMENU
  end
 
:Evloop
  wait 0.1,event
  parse "%E;%D",@event(D)
  goto %E
 
:Timer
  dialog select,0
  if @Null(@text(Dialogs))
    dialog disable,Check
  else
    dialog enable,Check
  end
  %%wId = @winatpoint(@mousepos(x),@mousepos(y))
  list seek,9,0
  %M = @match(9,#%%wId)
  if @greater(%M,0)
    option fieldsep,|
    parse "%%wId;%%sbText",@item(9)
    dialog set,Stat,%%sbText
    option fieldsep,@chr(44)
  else
    dialog set,Stat,Ready...
  end
  goto Evloop
 
:Resize
  parse "%W;%H",@dlgpos(,WH)
  dialog setpos,Tbar1,0,5,@diff(%W,10),30
  dialog setpos,Group1,35,5,190,@diff(%H,60)
  dialog setpos,Dialogs,50,10,180,@diff(%H,80)
  dialog setpos,Group2,35,200,@diff(%W,205),@diff(%H,60)
  dialog setpos,Code1,50,205,@diff(%W,215),@diff(%H,80)
  goto Evloop
 
:DialogsCLICK
  dialog select,0
  list create,3
  if @equal(@index(Dialogs),0)
    %%dlg = @item(Dialogs)
  else
    %%dlg = @substr(@item(Dialogs),5,1024)
  end
  %%dlgDesc =
  list seek,Script,0
  %M = @match(Script,"Dialog create,"%%dlg,)
  if %M
    list seek,Script,@index(Script)
    repeat
      %N = @next(Script)
      list add,3,%N
    until @greater(@pos(Dialog show,%N),0)
    dialog set,Code1,@text(3)
    %%text = @text(3)
  end
  list close,3
  goto Evloop

:OpenBUTTON
:OpenMENU
  %%dlgsCount = 0
  %%dlgNames =
  %x = 0
  if @not(%1)@equal(%1,IDE)
    %F = @filedlg("DialogScript files (*.dsc;*.dlg)|*.dsc;*.dlg",Open Script,%F,Open)
  else
    %F = %1
    %1 = IDE
  end
  If @file(%F,z)
    dialog title,Script Checker - [@name(%F).@ext(%F)]
    list clear,Script
    list loadfile,Script,%F
    %%open = @text(Script)
    list seek,Script,0
    repeat
      %M = @match(Script,"Dialog Create,")
      if %M
        parse "%a;%b",@item(Script)
        if @null(%%dlgNames)
          %%dlgNames = %%dlgNames%b@cr()
        else
          %%dlgNames = %%dlgNames"    "%b@cr()
        end
        list seek,Script,@succ(@index(Script))
        %%dlgsCount = @succ(%%dlgsCount)
      end
      %x = @succ(%x)
    until @null(%M)@greater(%x,@count(Script))
    list assign,Dialogs,%%dlgNames
    rem Info There are %%dlgsCount Dialog resources within this script.@cr()@cr()%%dlgNames
  end
  goto Evloop

:CheckBUTTON
:Generate LabelsMENU
  %%allNewLabels =
  %%newLabelsCount =
  %%newLabels =
 
  DIALOG CREATE,Script Update Progress,-1,0,450,125,NOTITLE
REM *** Modified by Dialog Designer on 5/7/02 - 16:34 ***
  DIALOG ADD,GROUP,Group1,0,0,450,125
  DIALOG ADD,TEXT,TEXT1,15,90,340,15,Processing dialog resource
  DIALOG ADD,TEXT,TEXT2,30,90,345,15,Processing line
  DIALOG ADD,GROUP,GROUP2,50,85,345,60,Progress
  DIALOG ADD,TEXT,TEXT3,65,110,40,15,Current:
  DIALOG ADD,PROGRESS,Pr1,65,160,255,15,0
  DIALOG ADD,TEXT,TEXT4,85,110,40,15,Overall:
  DIALOG ADD,PROGRESS,Pr2,85,160,255,15,0
  DIALOG ADD,ANIICON,ANIICON1,40,20,40,40,Replace.ani,,TRANSPARENT
  dialog add,List,Dialogs,0,0,0,0
  dialog add,List,DialogEvents,0,0,0,0
  dialog add,List,ElementEvents,0,0,0,0
  dialog add,LIST,NewLabels,0,0,0,0
  DIALOG SHOW
 
  dialog cursor,wait
 
  list loadtext,DialogEvents
"CLICK
"RESIZE
"PAINT
"DRAGDROP
"CLOSE

  list loadtext,ElementEvents
"CLICK
"DBLCLICK
"EXIT
"ICON
rem "BUTTON
rem "MENU
 
  dialog set,Text1,Backing up original script...
  dialog set,Text2,Saving as... @path(%F)@name(%F).~sc
  file copy,%F,@path(%F)@name(%F).~sc
 
  wait 1
  list create,1
  dialog select,0
  %%dlgNames = @text(Dialogs)
  %%count = @count(Dialogs)
  dialog select,1
  list assign,Dialogs,%%dlgNames
  %%dlgsCount = 0
  repeat
    list seek,Dialogs,%%dlgsCount
    if @equal(%%dlgsCount,0)
      %%dlgItem = @item(Dialogs)
    else
      %%dlgItem = @substr(@item(Dialogs),5,1024)
    end
    dialog select,1
    list clear,NewLabels
    dialog set,TEXT1,Processing dialog: @succ(%%dlgsCount) of %%count
    dialog select,0
    list seek,Script,0
    rem  Load the current dialog description from the Script stringlist
    %M = @match(Script,"Dialog create,"%%dlgItem)
    if %M
      list clear,1
      list seek,Script,@index(Script)
      repeat
        %N = @next(Script)
        list add,1,%N
      until @greater(@pos(DIALOG SHOW,%N),0)@null(%N)
    end
    rem  Now check for Dialog Create in the loaded dialog description
    list seek,1,0
    %M = @match(1,"DIALOG CREATE,"%%dlgItem)
    if %M
      rem  If it's there, loop through DialogEvents looking for @pos() @item(DialogEvents)
      rem  in string %I 
      %I = @item(1)
      %x = 0
      repeat
        rem  DialogEvents Check
        dialog select,1
        list seek,DialogEvents,%x
        %%dlgEvent = @item(DialogEvents)
        %P = @pos(%%dlgEvent,%I)
        if @greater(%P,0)
          if @not(@zero(@count(NewLabels)))
            list seek,NewLabels,0
          end
          dialog select,0
          rem  Check to see if the Script has a match for :%%dlgEvent
          %M = @match(Script,:%%dlgEvent)
          if @null(%M)
            dialog select,1
            rem  Now check to be sure that the %%dlgEvent isn't in the NewLabels list
            %M = @match(NewLabels,:%%dlgEvent)
            if @null(%M)
              rem If it's not there, then add it to NewLabels list
              list add,NewLabels,:%%dlgEvent@cr()"  "goto Evloop@cr()
            end
          end
        end
        %x = @succ(%x)
        dialog select,1
      rem  Continue through the loop until all DialogEvent types have been processed
      until @equal(%x,@count(DialogEvents))
    end
    rem Now let's loop throught the rest of the stringlist checking the dialog elements
    %x = 1
    repeat
      list seek,1,%x
      %O = @item(1)
      option fieldsep,@chr(44)
      parse "%%dlgAdd;%%element;%%eName",%O
     
      if @equal(%%element,MENU)@equal(%%element,BUTTON)@equal(%%element,BITBTN)@equal(%%element,STYLE)
        dialog select,1
        dialog set,Text2, Processing line: @succ(@index(1))
        if @equal(%%element,MENU)
          gosub MenuFunct
        end
        if @equal(%%element,BUTTON)@equal(%%element,BITBTN)
          gosub ButtonFunct
        end
      else
        %c = 0
        %%pp2 = @pos("&",%%eName)
        if @greater(%%pp2,0)
          %%eName = @strdel(%%eName,%%pp2)
        end
        repeat
          dialog select,1
          dialog set,Text2, Processing line: @succ(@index(1))
          list seek,ElementEvents,%c
          %%elmEvent = @trim(@item(ElementEvents))
          %P = @pos(%%elmEvent,%O)
          if @greater(%P,0)
            dialog select,0
            list seek,Script,0
            %M = @match(Script,:%%eName%%elmEvent)
            if @null(%M)
              dialog select,1
               list add,NewLabels,:%%eName%%elmEvent@cr()"  "goto Evloop@cr()
            end
          end
          %c = @succ(%c)
          dialog select,1
          dialog set,Pr1,@div(@prod(@succ(@index(1)),100),@count(1))
        until @equal(%c,@count(ElementEvents))
      end
      %x = @succ(%x)
    until @equal(%x,@count(1))
    %%dlgsCount = @succ(%%dlgsCount)
    dialog select,1
    dialog set,PR2,@div(@prod(%%dlgsCount,100),@count(Dialogs))
    %%newLabels = @text(NewLabels)
    if @not(@null(%%newLabels))
      %%newLabelsCount = @sum(%%newLabelsCount,@count(NewLabels))
      %%allNewLabels = %%allNewLabels@cr()%%newLabels
      dialog select,0
      list seek,Script,0
      %M = @match(Script,@item(1,0))
      rem list seek,Script,@sum(@index(Script),@pred(@count(1)))
      %M = @match(Script,"Dialog show")
      %M = @match(Script,:)
      list seek,1,@index(1)
      list insert,Script,REM *** Generated by Script Checker - @datetime(ddddd t) ***@cr()%%newLabels
    end
    dialog select,1
  until @equal(%%dlgsCount,@count(Dialogs))
  list close,1
 
  dialog select,1
  dialog close
  wait event
  parse "%E;%D",@event(D)
  if @null(%%allNewLabels)
    info All dialog elements have event labels associated with them.
  else
    list create,4
    list savefile,Script,%F
    if @equal(%1,IDE)
      dialog select,0
      clipboard set,@text(Script)
      window hide,#ScriptChecker
      window send,#TMainWin,@alt(EA)@alt(EP)
      window normal,#ScriptChecker
    end
    list add,4,<html>
    list add,4,<head>
    list add,4,"    "<title>Script Checker</title>
    list add,4,<style>
    list add,4,h2{
    list add,4,"    "color: #00FF00;
    list add,4,"    "background-color: #000000;
    list add,4,}
    list add,4,</style>
    list add,4,</head>
    list add,4,<body bgcolor="#FFFFFF">
    list add,4,<h2 align="center">Unlabeled Events</h2><hr>
    list add,4,<pre>
    list add,4,<p><b>Script Checker 2.0</b><br>
    list add,4,<b>@datetime(ddddd t)</b><br><br>
    list add,4,<b>Script</b>: %F<br>
    list add,4,<b>Backup file</b>: <font color="#FF0000">@path(%F)@name(%F).~sc</font></p>
    list add,4,
    list add,4,There were <font color="#FF0000">%%newLabelsCount</font> undefined events within
    list add,4,script <font color="#0000FF">%F</font>.
    list add,4,The event labels have been generated and appended to the
    list add,4,script benieth the dialog definitions containing the events and the
    list add,4,script has been re-saved.If you ran Script Checker from the Visual
    list add,4,DialogScript IDE the script has been reloaded into the IDE for you
    list add,4,to view the generated event labels.
    list add,4,
    list add,4,It is recommended that you view the placement of the event label
    list add,4,additions to ensure they weren't placed in a position that could
    list add,4,affect the current running condition of your script. Every effort has
    list add,4,been taken to ensure that this won't be a problem. However@chr(44) do to
    list add,4,that diffent programmers program differently@chr(44) there is always a
    list add,4,possibility.
    list add,4,
    list add,4,
    list add,4,The following missing event lables have been generated:
    list add,4,<font color="#800000"><b>
    list create,3
    list assign,3,%%allNewLabels
    %x = 0
    if @greater(@count(3),0)
      repeat
        list seek,3,%x
        %I = @item(3)
        if @not(@null(%I))
          list add,4,@tab()%I
        end
        %x = @succ(%x)
      until @equal(%x,@count(3))
    end
    list close,3
    list add,4,</b></font>
    list add,4,</pre>
    list add,4,</body>
    list add,4,</html>
    list savefile,4,@path(%0)SCReport.htm
    list close,4
   
    dialog create,Report,-1,0,450,300,SmallCap
    html parent,Report
    html size,0,0,450,300
    html focusmode,focused
    html loadfile,@shortname(@path(%0)SCReport.htm)
    dialog show
    html show
   
    rem dialog set,Code1,@text(4)
  end
  dialog cursor
  goto Evloop

:TBarHelpBUTTON
:ContentsMENU
  shell open,@path(%0)Script Checker.chm
  goto Evloop
 
:AboutBUTTON
:About Script CheckerMENU
  DIALOG CREATE,About,-1,0,300,185,SMALLCAP
REM *** Modified by Dialog Designer on 12/6/02 - 23:05 ***
  DIALOG ADD,STYLE,St1,Times New Roman,16,L,,BLUE
  DIALOG ADD,BITMAP,Icon,10,15,32,32,%%ScriptChecker_ico
  DIALOG ADD,TEXT,TEXT1,10,65,225,25,Script Checker 2.0,,St1
  DIALOG ADD,TEXT,TEXT2,45,65,225,15,Copyright © 2002 ShinobiSoft
  DIALOG ADD,TEXT,TEXT3,65,65,225,15,All rights reserved.
  DIALOG ADD,GROUP,GROUP1,95,5,290,2
  DIALOG ADD,TEXT,TEXT4,110,25,250,30,This program is protected by U.S. and international copyright laws. Copyright © 2002 ShinobiSoft.
  DIALOG ADD,BUTTON,Ok,155,115,70,25,&Ok
  DIALOG SHOW
 
  goto Evloop
 
:OkBUTTON
:ExitMENU
:CancelBUTTON
:CLOSE
  if @greater(%D,0)
    dialog select,%D
    dialog close
    wait event
    parse "%E;%D",@event(D)
    goto Evloop
  end
  registry write,%%root,%%key\Main,Top,@winpos(#ScriptChecker,T)
  registry write,%%root,%%key\Main,Left,@winpos(#ScriptChecker,L)
  exit
 
:MenuFunct
  %%P1 = @pos(%%eName,%O)
  %%sub1 = @sum(%%P1,@len(%%eName))
  %%sub2 = @strdel(%O,1,%%sub1)
  list create,4
  repeat
    %%p2 = @pos(",",%%sub2)
    if @greater(%%p2,0)
      %%sub2 = @strdel(%%sub2,%%p2)
      %%sub2 = @strins(%%sub2,%%p2,@cr())
    end
  until @zero(%%p2)
  rem  Add an even more confusing loop here to deal with parsing out all of
  rem  the different menu items.
  if %%sub2
    list assign,4,%%sub2
    %%CC = 0
    if @greater(@count(4),0)
      repeat
        list seek,4,%%CC
        %Y = @trim(@item(4))
        %%Y = @pos(|,%Y)
        if @greater(%%Y,0)
          %Y = @substr(%Y,1,@pred(%%Y))
        end
        %%Y = @pos(&,%Y)
        if @greater(%%Y,0)
          %Y = @strdel(%Y,%%Y)
        end
        if @not(@equal(%Y,-))
          dialog select,0
          list seek,Script,0
          %M = @match(Script,:%YMENU)
          if @null(%M)
            dialog select,1
            list add,NewLabels,:%YMENU@cr()"  "goto Evloop@cr()
          end
        end
        %%CC = @succ(%%CC)
      until @equal(%%CC,@count(4))
    end
  end
  list close,4
  exit
 
:BitBtnFunct
:ButtonFunct
  dialog select,0
  list seek,Script,0
  %M = @match(Script,:%%eName"BUTTON")
  if @null(%M)
    dialog select,1
    list add,NewLabels,:%%eName"BUTTON"@cr()"  "goto Evloop@cr()
  end
  exit



Edit #1 Added the 'Important Note' above.

_________________
Bill Weckel
ShinobiSoft Software

"The way is known to all, but not all know it."


Last edited by ShinobiSoft on Sat Dec 21, 2002 4:36 am; edited 3 times in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
cnodnarb
Professional Member
Professional Member


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

PostPosted: Fri Dec 20, 2002 12:12 am    Post subject: Reply with quote

Thank you very much for making this open source, this is actually one of my favorite VDS programs.

http://mywebpages.comcast.net/bweckel/vdsScript.zip
does not work...
use
http://mywebpages.comcast.net/bweckel/vdsscript.zip

Brandon Cunningham
Back to top
View user's profile Send private message AIM Address
ShinobiSoft
Professional Member
Professional Member


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

PostPosted: Fri Dec 20, 2002 12:19 am    Post subject: Reply with quote

I'm glad someone likes it. Maybe one of the many talented VDS programmers
around here can optimize this code, or something. I still need to do a
subroutine to validate TAB elements and to validate any controls that
might be added during run time. Such as other controls on a TAB element.

I'm just one person. Maybe the efforts of a few can make this one heck of a utility! Cool

_________________
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
ShinobiSoft
Professional Member
Professional Member


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

PostPosted: Fri Dec 20, 2002 9:22 am    Post subject: Reply with quote

Did anybody's head spin reading through all the code? Laughing
_________________
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
cnodnarb
Professional Member
Professional Member


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

PostPosted: Sat Dec 21, 2002 1:43 pm    Post subject: Reply with quote

If you really want your head to spin, try sorting through one of my old codes. It came out really good on the user end, but it's a maintainance programmers worse nightmare! It's a SFX exe file.

http://members.aol.com/webwritepro/webwritepro.exe

NodNarb
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 Open Source Projects 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