Good morning,
it is my very first time I work with AutoIt.
My first Script is about to download some files from a homepage.
I found the following function to set checkboxes on the internet:
Func _IEX_CheckboxSetStatebyName($objekt, $name, $state = True)
$oObjekt = _IEGetObjByName($objekt, $name)
If not (($state = $oObjekt.checked) = True) Then
_IEAction($oObjekt, "click")
EndIf
EndFunc
This worked with my first checkboxes, but I got a problem using this on another part of this page. Because I have to login on this page with a company-internal user and password I can not give you access to this. But I hope the following HTML-Code will help:
<form action="/https/www.autoitscript.com/report/run">
<h3>Fields to Display</h3>
<table width="100%" class="layout">
<tr>
<td valign="top">
<b>Product Details</b><br/>
<input type="checkbox" name="d_product" id="d_product" checked="checked"/>Product name<br/>
<input type="checkbox" name="d_company" id="d_company" checked="checked"/>Company<br/>
<input type="checkbox" name="d_lc" id="d_lc" />Legacy Company<input type="checkbox" name="d_lccoc" id="d_lccoc"/>Change of Control Date<br/>
<input type="checkbox" name="d_country" id="d_country" checked="checked"/>Country<br/>
<input type="checkbox" name="d_legalcat" id="d_legalcat"/>Legal category
<input type="checkbox" name="d_legalcatchanged" id="d_legalcatchanged"/>Date Changed<br/>
<input type="checkbox" name="d_fad" id="d_fad"/>First Approval Date<br/>
<input type="checkbox" name="d_marketauth" id="d_marketauth"/>Marketing Authorisation<br/>
[b]<input type="checkbox" name="d_marketed" id="d_marketed"/>Marketed<br/>[/b] ----------------------
<input type="checkbox" name="d_withdrawn" id="d_withdrawn"/>Product Withdrawn<br/>
<input type="checkbox" name="d_regcode" id="d_regcode"/>Regulatory Code<br/>
</td>
</tr>
<tr>
<td valign="top"><b>Active/Antigen</b><br/>
<input type="checkbox" name="d_aaname" id="d_aaname"/>Active/Antigen name<br/>
<input type="checkbox" name="d_aastate" id="d_aastate"/>Antigen state<br/>
<input type="checkbox" name="d_aacat" id="d_aacat"/>Active/Antigen category<br/>
<input type="checkbox" name="d_pres" id="d_pres"/>Presentation<br/>
</td>
<td valign="top"><b>Indications</b><br/>
<input type="checkbox" name="d_species" id="d_species"/>Species
<input type="checkbox" name="d_spapproval" id="d_spapproval"/>New Approval Date<br/>
<input type="checkbox" name="d_route" id="d_route"/>Administration route<br/>
<input type="checkbox" name="d_subroute" id="d_subroute"/>Administration sub-route<br/>
<input type="checkbox" name="d_ud" id="d_ud"/>Use-Disease
<input type="checkbox" name="d_udapproval" id="d_udapproval"/>New Approval Date<br/>
<input type="checkbox" name="d_udcat" id="d_udcat"/>Use-Disease category<br/>
</td>
</tr>
</table>
<h3>Report Options</h3>
<table class="layout">
<tr>
<td><input type="submit" name="r_full" value="Full Report" id="r_full"/></td>
<td>Display all information on the matching products.</td>
</tr>
<tr>
<td><input type="submit" name="r_restrict" value="Restricted Report" id="r_restrict"/></td>
<td>Display only specified criteria from product search.</td>
</tr>
</table>
</form>
I tried to set the bold checkbox as 'checked' with this AutoIt-Code:
_IEX_CheckboxSetStatebyName($oIE, "d_marketed", True)
which worked for other checkboxes.
On these checkboxes I get the error: "Error: Variable must be of type "Object"".
The mistake must be on line : If not (($state = $oObjekt.checked) = True) Then
But though I am not familiar with AutoIt I do not have any idea about a solution.
I would be appreciated for any help.
Greets,
Michael