Jump to content
Sign in to follow this  
USMCGalloway

Redim

Recommended Posts

USMCGalloway

I have the following code sitting in a While loop, is there a reason that it is not seeing $i on in the ReDim 
Func getPhoneList(ByRef $s)
   Local $type, $primary, $int, $areaCode, $first3, $last4 , $ext, $finialArray[100], $localArray[100],$i = 0 , $lastString
   while 1 

;Lots of work and clicking and fun cool stuff

If $phoneString == $lastString    Then;
         Redim $finialArray($i + 1)
         $s = _ArrayToString($finialArray, "|||")
         Send("{ESC}")
         Send("{RIGHT}")
         Send("{ENTER}")
         return $s
     else
         $lastString = $phoneString
         $finialArray[$i] = $phoneString
         $i = $i + 1
         Send("{DOWN}")
         Send("{SPACE}")
         Send("{TAB}")
         Send("{TAB}")
         Send("{ENTER}")
     EndIf ;==> Go back to top of while loop

The Error it is giving

(512) : ==> No variable given for "Dim", "Local", "Global", "Struct" or "Const" statement.:
ReDim $finialArray($i + 1)
ReDim $finialArray^ ERROR
Edited by USMCGalloway

Share this post


Link to post
Share on other sites
FireFox

Hi,

Have you looked the examples in the helpfile?

The indexes of the arrays are between brackets [ ].

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
BrewManNH

Why are you ReDimming the array in the first place? You're redimming it in the part of the If statement that isn't adding anything to it, but you're not redimming it in the section that does. Seems like you're doing it backwards.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
USMCGalloway

I am just creating an array that I know is to large for the data I need to add to it. 

First I am checking if the string is the same value as the last time (meaning I am at the bottom of the list) it ran the loop, if it is then I ReDim the large array, and turn the array into a string which will at some point be passed to Java. 

If it does not match( I am not at the bottom of the list) it takes the string that it just created of the data it collected, puts it in the array , and updates lastString. I think it does what I want it to do,  :sweating:

You were right FireFox, I was just going off an example I seen posted on some where else on here. Wont do that again  o:)

Share this post


Link to post
Share on other sites
MilesAhead

It may be more consistent to just declare an array, then use the array functions such as _ArrayAdd or _ArrayInsert.  Let them handle the memory allocations.  The code is already debugged.

.

Edited by MilesAhead

Share this post


Link to post
Share on other sites
FireFox

then use the array functions such as _ArrayAdd or _ArrayInsert.  Let them handle the memory allocations.

These functions are not tricky or advanced, it's only for beginners or easy coding.

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
kylomas

USMCGalloway,

If you are trying to scrape phone numbers from a Web site / app that code will NOT do that, even assuming that you get the syntax / logic correct.  I might be more helpful if you described at a higher level what you want to do.

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites
USMCGalloway

I am clicking though a database that is running off of Citrix, when I get to the correct screen, I am running though assigning fields to specific variables. The above function is being used in a getFunction.

Once it makes one run through the selected data, I form it into a large string, with two sets of delimiters, one to separate key words from data, and then another to separate the pairs from one another, and in some cases I have another delimiter to separate   the data sets, which will be sent away to a program that is calling the scripts. 

And see above for the rest. 

Its doing what I want it to do, by if someone has a better, more stable way to do this I am all ears. 

The main problem I am having is with server lag spikes from Citrix, my code is filled with pixelSerches to makes sure screens are loaded, and fields are updating .... 

Share this post


Link to post
Share on other sites
kylomas

USMCGalloway,

Thanks for the explanation. As stated in an earlier thread, it would make life a hell of a lot simpler if you could get read access to the DB ( or copy of the DB).

Good Luck,

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites
USMCGalloway

Yea, it would be, but with what I am dealing with there are rules against it, all I have the ability to do is to access, and edit some of the data, yet we can not save any of the data to the local machines. I'm sure I will have more dumb questions down the road, as I think I am going to be using Autoit for a long time. 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×