View previous topic :: View next topic |
Author |
Message |
Estas Contributor
Joined: 31 Jan 2004 Posts: 66 Location: Germany
|
Posted: Mon Apr 24, 2006 3:04 pm Post subject: Variable Counter - Freeware VDS extension-tool |
|
|
Hi folks,
I have just finished a small freeware utility, that automatically finds and lists all variables used in a vds source file, showing their position (line no) and how many times they are being used. Meant for larger projects, especially when approaching the 220 variable limit in order to reduce the amount of variables used and to keep track where they are located in your script.
Feel free to test it and comment on this tool.
Email: mdoran65@gmx.net
Greetings Mike
Download:
http://www.vdsworld.com/search.php?view_mode=fileinfo&file_id=480&sid=74017b32787c635c11008f62216ee1ce _________________ Greetings to all the folks back home in the States. A friendly "hola -como estas" to all my friends from Spain and Greece.
Last edited by Estas on Tue May 02, 2006 10:43 am; edited 21 times in total |
|
Back to top |
|
|
Skit3000 Admin Team
Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Mon Apr 24, 2006 3:50 pm Post subject: |
|
|
Working pretty cool Maybe you can add something that if I put your tool in my "Visual Dialogscript\Tools" directory and use the Tools menu from VDS, the code will automatically start processing the currently open file... You might be able to do this by looking if the %1 variable is specified
Btw. I couldn't seem to open your attached ZIP file with Winzip, although it did work using WinRar _________________ [ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial! |
|
Back to top |
|
|
Estas Contributor
Joined: 31 Jan 2004 Posts: 66 Location: Germany
|
Posted: Mon Apr 24, 2006 4:23 pm Post subject: |
|
|
Yes, the zip-file has been created using WinRar!
I hope though it works for most of you... _________________ Greetings to all the folks back home in the States. A friendly "hola -como estas" to all my friends from Spain and Greece. |
|
Back to top |
|
|
WidgetCoder Contributor
Joined: 28 May 2002 Posts: 126 Location: CO, USA
|
Posted: Mon Apr 24, 2006 5:57 pm Post subject: |
|
|
Thanks Mike this would be useful on larger projects. I did find a minor parsing issue with your tool causing some variables to be listed with extraneous text appended onto their names for example (%Asometext). I assume you're parsing each line of the script's text with "@pos(@chr(37),%%Line)" and grabbing the sub-string from that position to the next @chr(32) or @cr() as the variable name. So if the var is embedded within a string with out spaces a portion of the string gets returned as the var name. This could be corrected for local vars by checking the next chr after the pos and if it's not "%" you would just grab the next chr as the var name. |
|
Back to top |
|
|
Estas Contributor
Joined: 31 Jan 2004 Posts: 66 Location: Germany
|
Posted: Tue Apr 25, 2006 8:33 am Post subject: Variable Counter - Update V 1.0.0l |
|
|
I just uploaded the new version 1.0.0.58. It should now work as intended.
I merely overlooked the fact that there is a possibility of declaring or using variables in such a way eg. (%Axxxxxxxxxx).
Improvements:
-You can now save the results to your harddisk.
-Jump directly to a specific variable by dblclicking on it. _________________ Greetings to all the folks back home in the States. A friendly "hola -como estas" to all my friends from Spain and Greece.
Last edited by Estas on Wed Apr 26, 2006 3:11 pm; edited 1 time in total |
|
Back to top |
|
|
WidgetCoder Contributor
Joined: 28 May 2002 Posts: 126 Location: CO, USA
|
Posted: Tue Apr 25, 2006 4:48 pm Post subject: |
|
|
The updated version works great I know I'll be using it quite often, Thank you for sharing this little gem with us. |
|
Back to top |
|
|
Aslan Valued Contributor
Joined: 31 May 2001 Posts: 589 Location: Memphis, TN USA
|
Posted: Tue Apr 25, 2006 9:53 pm Post subject: |
|
|
Nice piece of work
Something to consider fixing though. It seems to accept "<" and ">" as valid variable characters.
eg.
%%variable<html_tag> shows up as %%variable<html_tag>
%%variable</html_tag> shows up as %%variable<
This means that %%variable is counted as 3 different variables
just a thought |
|
Back to top |
|
|
Estas Contributor
Joined: 31 Jan 2004 Posts: 66 Location: Germany
|
Posted: Tue Apr 25, 2006 10:12 pm Post subject: |
|
|
Your right - this will be fixed by tomorrow...
Thanks for the reply.
Uploaded V 1.0.0.84 - Go for it.
New: it will now automatically start processing the currently open file! _________________ Greetings to all the folks back home in the States. A friendly "hola -como estas" to all my friends from Spain and Greece. |
|
Back to top |
|
|
Estas Contributor
Joined: 31 Jan 2004 Posts: 66 Location: Germany
|
Posted: Fri Apr 28, 2006 12:16 pm Post subject: |
|
|
New Update available: Version 1.2.0.17
Added a couple of new features. You can now:
-able to read project-file (.dsp files)
-inspect an entire project which include multiple dsc-files.
-enhanced the code for faster source-code processing.
I hope you guys find it useful - a bief feedback message is appreciated. _________________ Greetings to all the folks back home in the States. A friendly "hola -como estas" to all my friends from Spain and Greece. |
|
Back to top |
|
|
Estas Contributor
Joined: 31 Jan 2004 Posts: 66 Location: Germany
|
Posted: Fri Apr 28, 2006 6:08 pm Post subject: |
|
|
For completeness sake: one more update...
New: Update available: Version 1.2.0.44
There was one thing I had disregarded in the previous versions:
That was to differentiate between GLOBAL and LOCAL variables.
Well, that's been included now as well... _________________ Greetings to all the folks back home in the States. A friendly "hola -como estas" to all my friends from Spain and Greece. |
|
Back to top |
|
|
trapper Contributor
Joined: 28 Jan 2005 Posts: 112 Location: Brisbane, Australia
|
Posted: Fri Apr 28, 2006 10:14 pm Post subject: |
|
|
Thanks for a useful utility Estas.
I ran it through my largest project and it picked up 287 variables and 253 global variables... this is due to a few errors in identifying variables.
I'll list the variable found, followed by the code snippet it was found in...
Var: %%CheckToppyConnection) Found: if @zero(%%CheckToppyConnection)
Var: %%CheckToppyConnection = Found: %%CheckToppyConnection = %%false
Var: %%CheckToppyConnection = @iniread(Options,CheckToppyConnection, 1) Found: %%CheckToppyConnection = @iniread(Options,CheckToppyConnection, 1)
Var: %%RecParamOverrideVals,1,3) Found: dialog set, STARTSPIN, @substr(%%RecParamOverrideVals,1,3)
Var: %%FindText' Found: info Cannot find '%%FindText'
Var: %%TimerConflictDetection,@not( Found: if @both(%%TimerConflictDetection,@not(%%AllTimersRejected))
Var: %^ Found: This was found in a long string used as a replacement test
I think that covers most of the error types. If you are able to fix these I'll run it through again and report back the results.
Cheers. _________________ John Trappett |
|
Back to top |
|
|
Estas Contributor
Joined: 31 Jan 2004 Posts: 66 Location: Germany
|
Posted: Sat Apr 29, 2006 6:13 pm Post subject: |
|
|
Problem fixed - hopefully
New: Update available: Version 1.2.0.47
Thanks for the report. _________________ Greetings to all the folks back home in the States. A friendly "hola -como estas" to all my friends from Spain and Greece. |
|
Back to top |
|
|
DaveR Valued Contributor
Joined: 03 Sep 2005 Posts: 413 Location: Australia
|
Posted: Sun Apr 30, 2006 4:34 am Post subject: |
|
|
Very nice, Mike. No problems here. _________________ cheers
Dave |
|
Back to top |
|
|
trapper Contributor
Joined: 28 Jan 2005 Posts: 112 Location: Brisbane, Australia
|
Posted: Sun Apr 30, 2006 5:28 am Post subject: |
|
|
Thanks for the fix.
I didn't get any erroneous entries this time, however, the report is a little baffling:
Total number of variables: 254
Global Variables used: 222
I thought VDS only had a maximum of 220 global (user-defined) variables.
Cheers... _________________ John Trappett |
|
Back to top |
|
|
Estas Contributor
Joined: 31 Jan 2004 Posts: 66 Location: Germany
|
Posted: Sun Apr 30, 2006 5:59 am Post subject: |
|
|
That's right - according to VDS.
I once tried to see what happens if I used more than the recommended 220 variables. I tested it with a script that was close to the limit and added some unneeded variable names. It added up to 240 user defined variables and the script still compiled - and worked.
It probably also depends on what content you assign to the variables or how many variables are needed at a specific time. The application might crash if too many variables are used at runtime.
It might be worth a test to create a script and see where exactly the limit is and what VDS does in this case. _________________ Greetings to all the folks back home in the States. A friendly "hola -como estas" to all my friends from Spain and Greece. |
|
Back to top |
|
|
|