Sign in to follow this  
Followers 0
sandyd

Problem with Script and Array

3 posts in this topic

Hi everyone,

We have a phone system that you can telnet into to configure. I would like to pull the address book out of it, but no FTP access is allowed.

I have decided to be crude and use an autoit script to grab the detail using the following script. However, when I try to show the complete list at the end of the script, nothing is there.

I've looked at this for ages, but nothing is coming to me as to why its not working. :idiot:

Anyone care to comment?

dim $TextArray[100]

Send("#r")
WinWaitActive("Run","Type the name of a program, folder, document, or Internet resource, and Windows will open it for you.")
Send("telnet 192.168.1.31{ENTER}")
WinWaitActive("Telnet 192.168.1.31")
Send("AUSERNAME{ENTER}")
Sleep(1000)
Send("APASSWORD{ENTER}")
Sleep(1000)
Send("{ENTER}")
Sleep(1000)
Send("1{ENTER}")
Sleep(1000)
Send("7{ENTER}")
Sleep(1000)
Send("1{ENTER}")

$EndNotFound=1
$Ctr=1
while $EndNotFound
  Send("!{SPACE}")
  Sleep(100)
  Send("e")
  Sleep(100)
  Send("s")
  Sleep(100)
  Send("{ENTER}")
  Sleep(100)

 ;PasteToNotepadAndCheckForEnd
  $TextArray[$Ctr]=ClipGet()
  MsgBox(0,"",$TextArray[$Ctr])
  if StringInStr($TextArray[$Ctr],"._._._._._._._._._.") then ExitLoop

  $Ctr = $Ctr + 1
  Send("{ENTER}")
  Sleep(500)
wend

$Ctr = 1
msgbox(0,"",$TextArray[0])
while $Ctr < $TextArray[0] -1
  MsgBox(0,"Phone List",$TextArray[$Ctr])
  $Ctr = $Ctr + 1
wend

Thanks in advance ...


----[ SandyD ]---

Share this post


Link to post
Share on other sites



Questions/Comments

What does the first message box display?

As far as I can discern there isnt a $TextArray[0] because you didnt use a StringSplit to get your array.

The whole math on the While...WEnd statement, I think is another reason you arent getting much out of this.

Suggestions

1. Look at the different loop types. There may be others (Do...Until, For...Next) that fit your needs.

2. Run some debug message boxes. (Check out to see if there is a value on $TextArray[0]).

3. Format your script better. Eliminate uneeded steps. (not trying to be mean, just trying to encourage you).

4. Why not try writing the out put to a file?

I hope this helps,

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

Can't you give commands to telnet using Control commads? If you can you take also its window text with easy in a variant.

Also Run('telnet 192.168.1.31') does not work?

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  
Followers 0