WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: bmclellan on April 30, 2020, 12:39:20 PM

Title: MapCreate
Post by: bmclellan on April 30, 2020, 12:39:20 PM
Hello,

I've been checking out the MapCreate function, but not having much luck.

From the help file, if I run Example 1, or Example 2
Example 1:
   Pairs = 'Apples,0':@tab:'Oranges,0':@tab:'Pears,0'
   Fruit = MapCreate(Pairs)
   ; Count an apple.
  Fruit["apples"] += 1

I get an error ArrDimension: Unable to allocate or lock memory.

I'm on the latest version:  2020A Jan 8, 2020

Thanks!
Barry






Title: Re: MapCreate
Post by: td on April 30, 2020, 01:10:21 PM
I would imagine that you are running the example using WinBatch Studio's debugger. Running the example outside the debugger works just fine.  However, the debugger is known to cause problems with WIL maps.   Until the next release, you will have to play with WIL maps outside the debugger.

Thanks for reporting the problem.
Title: Re: MapCreate
Post by: td on April 30, 2020, 01:44:22 PM
While staring mindlessly out the window I realized I should have mentioned a workaround that allows you to use maps in the debugger. All you need is the top secret IntControl 100

Code (winbatch) Select
IntControl(100, 64,0,0,0)

Pairs = 'Apples,0':@tab:'Oranges,0':@tab:'Pears,0'
Fruit = MapCreate(Pairs)
; Count an apple.
Fruit["apples"] += 1


[edit]
The link to IntControl 100 documenation:
https://docs.winbatch.com/mergedProjects/WindowsInterfaceLanguage/html/IntControl_100.htm (https://docs.winbatch.com/mergedProjects/WindowsInterfaceLanguage/html/IntControl_100.htm)
Title: Re: MapCreate
Post by: bmclellan on May 01, 2020, 07:14:51 AM
lol, thanks!