Jump to content

Recommended Posts

Posted

Hello!

I just began with AutoIt so bare with me.

what i am trying to do:

I want to automate some tasks, to make my work easier.

I have 2 Browser windows(each on one side of the screen)

The left one is a list with checkboxes and names - I cannot give you link, it's on a login basis only

The right one is the gmail account.

I must check the appropriate checkbox, then click the name corresponding to it(it will navigate in another page, where i can copy the e-mail address, go back to were i was before), then jump the mail window, and send an email to that address.

I am not looking for free stuff, i did my search before comming here.

So far i managed to switch the windows the way i like it, and i am stuck at the checkbox select thing.

The problem is that, the list is a <table>

All the checkboxes have the same name = "name" and random values / id's. I can not guess those, they are random.

What i tried, didn't work

So far my code looks like:

#include <IE.au3>
#include <Inet.au3>
#include <Array.au3>
Func ActivateEmailAddresses()
If Not WinActive("Left window, email addresses", "") Then
WinActivate ( "Left window, email addresses", "")
EndIf
EndFunc
Func ActivateMail()
If Not WinActive("Right Window, Mail", "") Then
WinActivate ("Right Window, Mail", "")
EndIf
EndFunc
Func SearchChkBx()
$oIE = _IEAttach ("Left window, email addresses") ;attach the IExplore window to AutoIT
$chkbx = _IEGetObjByName($oIE, "ids") ; get the checkbox
$chkbxVal2 = $chkbx.value ; get the value of the checkbox, i will use this for the navigate link
Global $values[1] ; array that holds the checkboxes values
$values[0] = $chkbxVal2 ; assign first element
$arr_count = UBound($values) - 2 ; used for loops
_ArrayDisplay($values, "asta-i") ; test
;~ For $i = 0 to $arr_count Step 1
;~  $arrval = $values[$i]
;~  If $chkbx.value = $arrval Then
;~  EndIf
;~
;~ Next
$i= 0
While $i <= $arr_count
; ====> What i try to do here, is to add all the verified and used values of the checkboxes, to an array, so i can use it to check the rest of them
$arrval = $values[$i]
If $chkbx.value <> $arrval Then
$chkbxVal2 = $chkbx.value  ;;===>> If the value of the checkbox is not in the array, add it, and navigate to the link
_ArrayAdd($values, $chkbxVal2)
$chkbx.checked = True
_IENavigate($oIE, "javascript:showContact('" & $chkbxVal2 & "')") ; ==> Navigate
MsgBox(0, '', $chkbxVal2) ; Test
EndIf
$i = $i+1
WEnd
EndFunc

ActivateEmailAddresses()
SearchChkBx()

So far i only managed to do the first checkbox. The script stops, and never checks the second.

Do not worry about the navigate part back, part i have not done that yet. Baby steps ...

Can anyone think of a solution for this ?

Maybe i just reasoned it the wrong way and what i did has no logic... But i cannot think of a different way, not atm.

Thank you.

test.au3

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
  • Recently Browsing   0 members

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