Sign in to follow this  
Followers 0
mitchelwb

multiple beginners questions

5 posts in this topic

I found AutoIt last week and was very excited because I currently manage a large screen scraping application at work that only works with our mainframe systems As our mainframe systems are being phased out, and they are being replaced with GUI systems, I'm losing functionality and my clients have no where to turn. I really think AutoIt could help with a lot of this, but I have a hand full of questions that I've not found answers to yet. I'm hoping for a little help with them. Either by way of direct answers or direct links to the answers I'm looking for.

I've already been through a lot of the documentation and I've also downloaded a copy of the O'Reilly reference book but I still have some questions. Some are probably simple, some might be too complex for me to even understand yet, but they are things that are important for me to make it a success. Much of the documentation I find is geared more towards building a GUI using AutoIt but I really need to be able to use it for it's automation features far more than I need it for building GUI's.

All of my questions are in reference to the AutoIt specific syntax and logic. Not how to do IF statements.

What if I have more than one control with the same ID? In the first script I've written, it correctly opens an application, and enters a password into one of about 6 text fields. But what I found was that when I went to pull the control ID of the text field, there were 4 different text fields that all had the same control ID. If I did a ControlClick on the control ID, it went to one of the other fields instead. The application defaulted to the field I needed on load, so I was able to just send the value, but if it hadn't defaulted to that field, I don't know what I would need to do to get the cursor in the right place.

Could I have used the windows handle of the particular field? Or would it be better to use the application coordinates to just send the mouse to click on it? In either case, how do I do that? I've been able to send the mouse to a specific screen coordinate to click there, but I've not figured out how to send the mouse to a specific coordinate relative to the 0,0 coordinate of a window. How is that done?

My next question has to do with finding a window that may or may not be there. For example.. the script I've written logs into the extranet where I work. It opens the connection app, enters my password, then clicks the connect button. All this is great, but if there is a network issue that prevents it from connecting and I get a different message than the confirmation, how do I check for the existence of either window? I would like to be able to look for the failure window and go down one path, or find the confirmation window and go down a different path. I've not figured out how to determine what the current active window is, or how to determine if a particular window even exists. Also, in this case, there is a certain amount of time that has to pass as the app is trying to contact and communicate with my extranet. WinWaitActive works great for waiting for the Confirmation window, but if I get an error message, I could sit and WinWaitActive forever leaving the script hanging.

No my questions start to get a little harder... Is it possible to pull my windows credentials? When I log into my computer, I use the exact same credentials as I do to log into the extranet. Right now, I have my password hard coded into my script. I'm forced to change my password every 60 days however, so I'll have to update my script every time. I could probably store it in a text file and read from there, but would really rather just read it from the windows AD credentials and pop that into the extranet app.

Final and mose intricate question. Where I work, as we replace mainframe systems, they are being replaced by apps that sit on Citrix servers and so far, I've not been able to convince anyone to allow me to load these new apps on a desktop. Is there a way to communicate through a Citrix Metaframe? I realize using strictly coordinates is a possibility for sending information, but how do I read data values from text fields that are simply being displayed through the metaframe to my local machine as an image? Things like WinWaitActive won't be useful in that type of situation. Or would it? What I do know is that the possibility of me loading any kind of helper app on the Citrix box is going to be 99.993% impossible.

Ok, that's all I have for now. If you made it all the way through, I really appreciate it. If you have any answers for me, I really appreciate that even more!!!

MitchelWB

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

1.

I don't know how the controlID's would be the same unless the fields are in a container and the window info tool is only seeing the container.

The fields should have unique instance numbers that can be used to identify them with ControlGetHandle().

2.

WinGetTitle("") returns the active window's title. WinGetTitle works on both minimized and hidden windows. If multiple windows match the criteria, the most recently active window is used.

3.

Checks to see if a specified window exists.

WinExists ( "title" [, "text"] )

4.

Not sure what credentials you need. @UserName and IsAdmin() may help.

5.

AutoIt will not see any contents of your Citrix session...someone else will have to clarify

Edited by weaponx

Share this post


Link to post
Share on other sites

I was kind of surprised that the control ID's were the same as well. They were all Control ID 1. All the labels and the drop downs and everything else had Control ID's that started over 1000.

So does this mean there is some way to drill down to it? Application.Panel.ControlID = 1 type of thing?

I actually assume this is kind of how application specific screen coordinates should work, but I've not been able to find any information on it.

As for the windows credentials that I'm looking to retrieve, what I would like to do is pull my windows password rather than having to hardcode my password into the script. Otherwise, I have to remember to go in and update my script every time I change my password.

MitchelWB

Share this post


Link to post
Share on other sites

I was kind of surprised that the control ID's were the same as well. They were all Control ID 1. All the labels and the drop downs and everything else had Control ID's that started over 1000.

So does this mean there is some way to drill down to it? Application.Panel.ControlID = 1 type of thing?

I told you, you can access controls by their instance number which is shown in the AutoIt Window Info tool:

http://www.autoitscript.com/autoit3/docs/intro/controls.htm

What are you passing your credentials to? If it was that easy to retrieve your password that would be a huge security problem.

If you are needing to execute programs remotely, Psexec is able to forawrd your credentials onto the remote machine.

Share this post


Link to post
Share on other sites

I wondered about the security risk, but at the same time, I'm already logged into the machine. I'm looking for the password that I already had to use.

I have a laptop that when I'm at my office, I log into Windows and it validates by connecting to our AD domain and connects me to the network all in one action. When I bring my laptop home and work from my home office, I log in to windows and it validates me based on local Windows policies, then I use a remote access client to log into the network at work. The windows credentials are the same credentials I need to access the remote access network.

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