Jump to content

Looking to output elements in an array


Recommended Posts

New to AutoIT looking for some help

I have array that I want to use as a "Feeder" to input IP addresses into a login prompt of a Java based client as part of an automated process I am attempting to build.

I can get the array filled with the IP addresses, but I want to automate it so that during my loops the script will output one IP address which is stored at a different point in my array. I'll try to explain in psuedocode.

Array[1] = IP address 1

;I want it Continue with script ie: more code to perform tasks in the Java Client. I'll probably have to use an embedded loop in function

;When tasks in Java client are done I want to logout and log back in using the next IP address which is the next element in the array.

Array[2] = Ip address 2

;Repeat above steps

Array[3] = IP address 3

;Repeat above steps

Array[4] = IP address 4

;Repeat above steps

Array[5] = Ip address 5

Repeat until the end of the array is reached. End of array is determined by Array[0].

So

Global $Array[100] => I use StringSplit to populate the array => array hold N number of values. Stringsplit will populate array[0] with the total number of valid values so I planned to use this number as my total number of elements in the loop.

I was thinking of using this as my function.

Func insert_ip()

Local $i

For $i = 1 to $IP_Array[0] Step 1

ConsoleWrite($IP_Array[$i] & @LF)

Next

EndFunc

It does not populate the Java client field and appears to write the entire contents of the array to the debug console

What is the function to get this to output just the first array[1] and then follow the above logic into the Java client prompt? I've tried Send() but no luck yet.

Any suggestions or helpful tips would be appreciated. Thank you.

Link to comment
Share on other sites

Use AutoIT window tool to get the inputs handle, then use the command ControlSetText() to set the text, and if needed ControlClick() to submit.

[font="Impact"]Use the helpfile, It´s one of the best exlusive features of Autoit.[/font]http://support.microsoft.com/kb/q555375ALIBI Run - a replacement for the windows run promptPC Controller - an application for controlling other PCs[size="1"]Science flies us to the moon. Religion flies us into buildings.[/size][size="1"]http://bit.ly/cAMPZV[/size]
Link to comment
Share on other sites

Use AutoIT window tool to get the inputs handle, then use the command ControlSetText() to set the text, and if needed ControlClick() to submit.

The issue I have here is that the program I am attempting to automate is a Java based client (Jar file). The window info utility just gives me the Title and class of the program and that is about it. ControlSetText() requires a control ID which cannot be obtained with the Window Info utility. I wonder if there is a way to spoof this. I tried using ControlSetText(), but get a syntax error because I don't have a Control ID to use. Thank you for the suggestion though.

Link to comment
Share on other sites

youl need to geave some more info about that window (img of window)

did you wait to activate...

WinWait

WinActivate

WinWaitActive

or

SendKeepActive

...window before using send

did you try using send("{ENTER}") insted of @LF (@LF,@CRLF,@CR) or that did not work

did you try

ControlSend("Untitled", "", "", "This is a line of text in the notepad window")

with no control ID in filed (this can sometimes work)

?

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

I've attached a screen shot of windows info.

I came across this posting later on in my search.

Java and AutoIT

I found another solution however that solves my problem.

I used clipput() to copy the data from my array to the clipboard then I use the SEND() to insert the keyboard command CTRL+V. It works, but I am open to more advanced suggestions if anybody knows any thing more of interfacing AutoIT with Java applications. I used a series of embedded DO...WHILE loops to count through the array and choose each individual IP address when I need to log into each machine.

Once again if anybody has a more refined solutions using they would like to put out there I'm open to suggestions.

post-52201-12502006233601_thumb.jpg

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...