Jump to content

Read Control Value and Delete


Recommended Posts

In 2004, I asked how to get rolling with AI and I admit that I got sidetracked on picking a project and learn from it. I really didn't have a project then but I do now. I have a need to training a couple of individuals on the steps needed to resolve some configuration issues in Outlook 2003 that resulted from a change in the middleware I am using. While I can write the procedures down on paper, I can not get them to read or follow them consistently. The problem with not being in MGT but having to answer questions over and over. So what I am trying to do is kill two birds with one stone. Get a little done while familiarizing them with the interface and to start down my road of exploration of AI and scripting.

I have come to understand how to send keystrokes like CRTL+TAB to manipulate Outlook to arrive at the screen I want and the edit control that I need to manipulate. I just keep going round and round in the help and searching the web for something to connect the dots with what it is I want to accomplish and how I rationalize it.

I am at the following location: Tools>Options>Security>Settings>Security Setting Preferences>Security Settings Name drop down box.

What I want to do is read the contents and if anything exists (ie. John.doe@ or NetSign..., etc) then execute the delete option which is button instance 5. I want to continue to loop the function until the edit control is blank. From there proceed through the process to close Outlook.

The problem I have is that when deleting the first settings it then populates the settings from another program we used before it. So, I may have to loop at least 4 times before the control is blank.

The real issue is that I lack the ability that you folks probably take for granted, the ability to read the help files and say, oops; should have thought of that. I am really struggling here and I was wondering if someone could explain to me in plain terms what the best process is to use and why. i am not asking for the code, in truth I would like very much to figure it out myself but I am struggling to learn to connect the dots. Any assistance you might provide would be greatly appreciated.

V/r

Casey

Link to comment
Share on other sites

I would start with the AutoIt Window Info tool. (Au3Info.exe)

Depending on the types of controls you're dealing with, you should be able to manipulate them with ControlClick, ControlCommand, ControlSetText, ControlSend, and the various type-specific functions.

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Link to comment
Share on other sites

I would start with the AutoIt Window Info tool. (Au3Info.exe)

Depending on the types of controls you're dealing with, you should be able to manipulate them with ControlClick, ControlCommand, ControlSetText, ControlSend, and the various type-specific functions.

Thanks, I'll start there and see what I come up with. Much appreciated.

Link to comment
Share on other sites

  • 2 weeks later...

Well I have worked though some of the code needed to do the task and I find myself returning for a little insight on what the best way to do the following. I looked at the help on "Do Until" but I can't make sense of really how to accomplish it.

Scenario: XP + Outlook 2003

Navigating in Outlook: Tools, Options, Security Tab, Settings..., one finds a combobox directly under security Setting Preferences. Below is the info for the combobox.

*******************************************************************************

Title: Change Security Settings

Class: #32770

Position: -923, 241

Size: 404, 418

Style: 0x94C800CC

ExStyle: 0x00010101

Handle: 0x0377039C

>>>> Control <<<<

Class: Edit

Instance: 1

ClassnameNN: Edit1

Advanced (Class): [CLASS:Edit; INSTANCE:1]

ID: 1001

Text:

Position: 29, 47

Size: 344, 15

ControlClick Coords: 311, 10

Style: 0x50000380

ExStyle: 0x00000000

Handle: 0x002902CE

>>>> Mouse <<<<

Position: -580, 320

Cursor ID: 0

Color: 0xFFFFFF

>>>> StatusBar <<<<

>>>> Visible Text <<<<

Security Setting Preferences

&Security Settings Name:

My S/MIME Settings (casey@my.comany.com)

My S/MIME Settings (casey@my.comany.com)

***********************************************************************

The problem is that the entries in the combobox need to be deleted by clicking the delete button, info as follows

***********************************************************************

>>>> Window <<<<

Title: Change Security Settings

Class: #32770

Position: -923, 241

Size: 404, 418

Style: 0x94C800CC

ExStyle: 0x00010101

Handle: 0x0379039C

>>>> Control <<<<

Class: Button

Instance: 5

ClassnameNN: Button5

Advanced (Class): [CLASS:Button; INSTANCE:5]

ID: 4354

Text: &Delete

Position: 236, 154

Size: 75, 23

ControlClick Coords: 30, 14

Style: 0x50010000

ExStyle: 0x00000004

Handle: 0x002003A6

>>>> Mouse <<<<

Position: -654, 431

Cursor ID: 0

Color: 0x000000

>>>> StatusBar <<<<

>>>> Visible Text <<<<

Security Setting Preferences

&Security Settings Name:

My S/MIME Settings (casey@my.company.com)

My S/MIME Settings (casey@my.company.com)

****************************************************************

So, I know that the following will click delete one time...

****************************************************************

Run("outlook.exe")

WinWaitActive("Inbox")

; Open Outlook Options

Opt("WinWaitDelay",3000)

Opt("WinTitleMatchMode",1)

Opt("WinDetectHiddenText",1)

Opt("MouseCoordMode",0)

WinActivate("Inbox","")

WinWaitActive("Inbox","")

Send("{ALTDOWN}t{ALTUP}o")

Opt("WinWaitDelay",100)

Opt("WinTitleMatchMode",1)

Opt("WinDetectHiddenText",1)

Opt("MouseCoordMode",0)

WinWait("Options","")

If Not WinActive("Options","") Then WinActivate("Options","")

WinWaitActive("Options","")

; Send not so clean, I am sure there is a better way, just haven't found it yet.

;Cycles through the tabs to get to the security tab

Send("{CTRLDOWN}{TAB}{TAB}{TAB}{TAB}{CTRLUP}")

; Press the settings... button

ControlClick("Options","&Settings...","[iD:4352]")

; Press the Delete button

ControlClick("Change Security Settings","&Delete","[iD:4354]")

***************************************************************

The problem is that there could be as many as 5 unknown entries in the list. I assume that the ControlClick command could be executed 5 times but it doesn't seem right or clean if you will. The bigger problem is that I can't compare my problem with the help file for "Do Until" and derive a solution. I have searched the forum and the web; no joy.

Would you please point me again is a direction or provide some insight to if this is possible.

Thanks again for the assistance.

Casey

Link to comment
Share on other sites

  • Moderators

Might do yourself a favor for any outlook automation, and look on the forum for some COM options.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Might do yourself a favor for any outlook automation, and look on the forum for some COM options.

Thanks for the advice. I will do so but for know I need to learn a few basics and going this route initially is teaching me a few things. I'll make that learning project 2; convert what I create this way into a more solid form using COM objects.

Thanks again for your time.

Link to comment
Share on other sites

  • 3 weeks later...

Might do yourself a favor for any outlook automation, and look on the forum for some COM options.

Ok, I have hit the brick wall and I have to ask about COM options. Yes, I believe this is where I told you so comes in. I am very sorry for having been stubborn.

I am nearly done with my first project but can't manipulate IE6 or IE7 the way that I want to. What I am trying to do is select all of the certificates under the personal tab and remove them. What I can't seem to do is highlight them. I started with ControlClick and Send(MouseMove). I have read through posts regarding what one can do with Class: SysListView32 and haven't been able to figure it out. I also looked at _IEAction but can pull it off there either.

Has anyone developed code to do this function already or can anyone at least tell me where to start? I am willing to read and learn through trial and error. Any assistance would be greatly appreciated.

Link to comment
Share on other sites

Outlook's security settings are stored in the registry, yes? Personally, I'd go directly after the registry key and change it without even having to open that dinosaur.

I considered this but I didn't intend for the technician to become reliant on this. I was aiming for more of a graphical presentation while yet accomplishing something. If I asked them to edit the registry I believe that they would do more harm then good. The few times that I have provided them classes on what one should and not do in there it didn't seem to sink in. Possibly information overload... Thanks for the advise though, always appreciated.

You wouldn't happen to know the answer to my IE problem would you? Any way, thanks again.

Casey

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...