November 29, 2022, 07:07:55 AM

## News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!

## IWB key word converter

Started by Andy, October 26, 2019, 08:39:04 AM

0 Members and 1 Guest are viewing this topic.

#### Andy

##### October 26, 2019, 08:39:04 AM
Hi everyone,

Here is my program to convert IWB keywords to upper / lower case as you like.

Step 1 (one time only).
Amend line 72 to the path of your IWBDev.ini file

Step 2 (one time only).
Compile the program - don't run it yet!.

Step 3.
Open your IWB IDE program.

Step 4.
Add this exe file to your IDE "Tools" menu - call it anything you want.

Step 5 (Anytime after that).
Click on a file you have open in the IDE.

Step 6.
Go to "Tools" and run the program - give it a file name and click "Convert".

Step 7.
Check the output file.

Job done!

Took a week to get this far.

Massive thanks to Brian for all his help adding in the key words, and checking the code!!!!!

Thanks,
Andy.

Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

#### billhsln

##### October 26, 2019, 08:18:20 PM #1
I haven't had a chance to compile the program, but just glancing thru the code I noticed some thing.

Take the following line:

IF LCASE\$(MID\$(CheckWord,1,1)) = "\$" THEN From = 0 : LoopTo = 6

I would bet, if you had a \$ in the code and actually printed the LoopTo value before the 'FOR z = From TO LoopTo', you would see that LoopTo = 998, not 6.  In fact, any match will end up with 998.

You should probably test, but I am pretty sure this is how IWB works.  The ':' says next line basically, it does not associate the code after it with the IF.

Its like writing:

IF LCASE\$(MID\$(CheckWord,1,1)) = "\$" THEN From = 0
LoopTo = 6
IF LCASE\$(MID\$(CheckWord,1,1)) = "@" THEN From = 9
LoopTo = 466

So, in the end LoopTo = 998.

Bill

PS, quicker test might be, see if this compiles without an error

IF LCASE\$(MID\$(CheckWord,1,1)) = "\$" THEN From = 0 : LoopTo = 6 ELSE From = 15

It should error.
When all else fails, get a bigger hammer.

#### Andy

##### October 27, 2019, 01:41:12 AM #2
Bill,

Not are you only correct, but I noticed a simple typo!

I was using LCASE\$, where it should have been UCASE\$

I'm just checking now, but it looks correct now, and it's quicker.

Will post an update shortly!

Thanks,
Andy.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

#### Andy

##### October 27, 2019, 04:45:54 AM #3
Well,

After looking at the code, and making the changes mentioned, I tested it again and put in a basic tick count (now removed) to see the difference.

Before I converted code and it took just over 10.6 seconds.
After the amendents, it took just over 3.3 seconds - much faster.

Now I'm not saying you won't find instances where my tool works 100% for 100% of code, it's down to how you've typed it I guess.

But I can say, for most of your code it will work 100% for 99.999999% of the time - if that makes sense (probably not!).

Anyway, here is the amendment.

Please remember (after a week of trying different methods) this is what I've got for you.

It as after all a tool, not an example of best programming!

Thanks,

Andy.

Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

#### billhsln

##### October 27, 2019, 10:18:05 AM #4
I can't help it (OCD), just another thought.  I am not sure if this will speed anything up more than what you have but, how about trying;

`SELECT UCASE\$(MID\$(CheckWord,1,1)) CASE "\$" From = 0 LoopTo = 6 CASE "@" From = 9 LoopTo = 466 CASE "A" From = 469 LoopTo = 494 CASE "B" From = 497 LoopTo = 507 CASE "C" From = 510 LoopTo = 554 CASE "D" From = 557 LoopTo = 626 CASE "E" From = 629 LoopTo = 659 CASE "F" From = 662 LoopTo = 698 CASE "G" From = 701 LoopTo = 735 CASE "H" From = 738 LoopTo = 740 CASE "I" From = 743 LoopTo = 761 CASE "J" From = 764 LoopTo = 764 CASE "K" From = 767 LoopTo = 768 CASE "L" From = 771 LoopTo = 792 CASE "M" From = 795 LoopTo = 805 CASE "N" From = 808 LoopTo = 811 CASE "O" From = 814 LoopTo = 823 CASE "P" From = 826 LoopTo = 837 CASE "R" From = 840 LoopTo = 868 CASE "S" From = 871 LoopTo = 935 CASE "T" From = 938 LoopTo = 949 CASE "U" From = 952 LoopTo = 958 CASE "V" From = 961 LoopTo = 962 CASE "W" From = 965 LoopTo = 998ENDSELECT`
Just thinking it would look cleaner.

Still glad you were able to come up with this code so quickly, will make my life easier.  At least this way I can get all my older programs to look like what the newer ones do.  Since I prefer the keywords to all be upper case.

Thanks,
Bill
When all else fails, get a bigger hammer.

#### billhsln

##### October 27, 2019, 11:10:40 AM #5 Last Edit: October 27, 2019, 11:20:29 AM by billhsln
Compiled and did all the steps, including:

Quote from: undefinedStep 4.
Add this exe file to your IDE "Tools" menu - call it anything you want.

I then closed the IDE and brought it back up, but I don't see the program in the Tools Menu, so I am guessing I am missing something or doing something wrong.

I tried this on both installations of IWB, I have 1 for work use and 1 for home use.  It did not load on either version.

Bill
When all else fails, get a bigger hammer.

#### Andy

##### October 28, 2019, 03:57:27 AM #6 Last Edit: October 28, 2019, 04:00:46 AM by Andy
Bill,

I know you know how to add a tool but just in case make sure you browse to the exe file and then click Add. See screenshot.

I don't even have to restart my IDE.

Re OCD and code.
Know the feeling, but obviously feel free to amend the code as much as you like.

Andy.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

#### billhsln

##### October 28, 2019, 08:31:27 AM #7
I did both steps and the file still does not show up in Tools for me, weird.

Thanks,
Bill
When all else fails, get a bigger hammer.

#### LarryMc

##### October 28, 2019, 12:10:58 PM #8
Bill
Are you using a "normal" IWB installation or a "memory stick" installation? I t determines where your .inct file is located.  Sounds like that might be missing.
LarryMc
Larry McCaughn
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

#### billhsln

##### October 28, 2019, 02:33:15 PM #9
I think I did both, 1 is stored in:

"C:\Program Files (x86)\IWBDev3\bin\IWBDev.exe" - Work version

and the other is in:

C:\IWBDev3\bin\IWBDev.exe - Home version

Looked for an .inct file, don't have any.  What filename should I be looking for.

Thanks,
Bill
When all else fails, get a bigger hammer.

#### Andy

##### October 29, 2019, 04:12:07 AM #10
Bill,

LarryMc is correct, this might help you.

Screenshot 1, locate your IWBDev.ini file.
Where this is, you should see some folders called:

examples
help
templates
tools <------------- this is the folder you want.

In the tools folder (screenshot 2), I have two .inct files:
Constants search.inct
IWB key word case converter.inct <------ this is the entry you need.

I opened it with notepad (screenshot 3).

`'*NAME|IWB key word case converter'*USERTOOL|c:\test\subtest\convertkeywords.exe,IWB key word case converter`
I renamed it to something else and it disappeared from the tools menu, changed it back and it shows up.

Hope this helps!
Andy.

Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

#### billhsln

##### October 29, 2019, 09:18:04 PM #11
This is very strange, I have 4 IWBdev.ini files, 3 of which say:

help=C:\IWBDev3\help
tools=C:\IWBDev3\tools
help2=C:\IWBDev3\help2

However, when I look under C:\IWBDev3, there is no help, tools or help2 subdirectories.

The other IWBDev3 shows:

help=C:\IWBDev3\help
tools=C:\Users\Bill\AppData\Local\IonicWind\IWBasic3\tools
help2=C:\Users\Bill\AppData\Local\IonicWind\IWBasic3\help2

tools and help2 doesn't exist there either.  Very weird.

Tools do work, tried the MessageBox Builder and the ColorPicker both come up with no problems.  Not sure where their tools exist.

I wonder, are those directories normally blank?  The reason I ask is I ran a program to delete blank directories, which could be why they don't exist?

Bill
When all else fails, get a bigger hammer.

#### LarryMc

##### October 30, 2019, 07:09:39 AM #12
MessageBox Builder and the ColorPicker tools are built in tools and don't use the tools folder.
The tools folder is only for user added tools.

The reason you found 2 different sets of folders is because to installed IWB 2 different ways which is explained in the TOOLS section of the help file.
LarryMc
Larry McCaughn
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library