crazycrash Posted March 9, 2007 Share Posted March 9, 2007 I have a problem that could potentially safe me tons of work, but i just can not figure out a way how to make it happen. Basically I have a table in an ie window that looks something like this: (can be a very long list...) row 1 <td align=right class=detail><input type=checkbox name=chkbox value=161290=></td> <td align=left class=detail><nobr>pending</nobr></td> <td align=left class=detail>itemnumber1</td> row 2 <td align=right class=detail><input type=checkbox name=chkbox value=161291=></td> <td align=left class=detail><nobr>pending</nobr></td> <td align=left class=detail>itemnumber2</td> row 3 <td align=right class=detail><input type=checkbox name=chkbox DISABLED value=></td> <td align=left class=detail><nobr>pending</nobr></td> <td align=left class=detail>itemnumber3</td> row 4 <td align=right class=detail><input type=checkbox name=chkbox DISABLED value=></td> <td align=left class=detail><nobr>pending</nobr></td> <td align=left class=detail>itemnumber4</td> row 5 <td align=right class=detail><input type=checkbox name=chkbox DISABLED value=></td> <td align=left class=detail><nobr>pending</nobr></td> <td align=left class=detail>itemnumber5</td> Now what i want my script to do is check the box, if its name is something like "chkbox value=somerandomnumberasinexample", if the checkboxs name is "chkbox DISABLED value=" then it should just leave it as it is. The table is not contained in a form, it is generated by a javascrit which then will check what boxes have been ticked... Here is what i have come up with, but i already fail at getting the object: expandcollapse popupGlobal $Paused, $go #include <Misc.au3> #include <GuiConstants.au3> #include <ie.au3> HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") HotKeySet("{HOME}", "getname") $dll = DllOpen("user32.dll") $processed = 0 ;; relaxationtime While 1 Sleep(10) WEnd Func getname() $oIE = _IEAttach ("System_Login_Mapper", "Title") If @error Then MsgBox(48, "Error", "There was a problem attaching to the browser.") Exit EndIf $oCheckboxes = _IEGetObjByName ($oIE, "chkbox value=") If @error Then MsgBox(48, "Error", "problem with checkbox") Exit EndIf EndFunc Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is "Paused"',0,0) WEnd ToolTip('Script is "Running"',0,0) EndFunc Func Terminate() MsgBox(0, "stopped early, only did the below specidied amount of repairs", $processed) Exit 0 EndFunc Thanks a ton in advance, Adrian Link to comment Share on other sites More sharing options...
Hasher Posted March 9, 2007 Share Posted March 9, 2007 $oCheckboxes = _IEGetObjByName ($oIE, "chkbox value=")oÝ÷ Ù8ZµÚ²{lyé«mNjg°¢é]míýr£ýnëlw¶«yªÞ©ò¢6ÞrÛ0ØmëéÚ쨺ÈhºWZqǬ²Ø^o+az'NDz¢èZ½ëaz¸ ×(uè^쨹ƧiDzËax3¡ûajÚç-)jëh×6 $oCheckboxes.value $oCheckboxes.name $oCheckboxes.checked Hope that helps Firefox's secret is the same as Jessica Simpson's: its effortless, glamorous style is the result of shhh extensions! Link to comment Share on other sites More sharing options...
crazycrash Posted March 9, 2007 Author Share Posted March 9, 2007 Thanks for the quick response, i cant check by its id as it varies all the time. The macro would really have to look for the checkbox that has "name=chkbox value=x" and tick it somehow. I just cant figure out how to do that, would be so much easier if it were a form (so far i havent had problems with those checkboxes at least...) Any idea how to solve this? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 9, 2007 Moderators Share Posted March 9, 2007 (edited) I'm ashamed as usual after reading these IE posts, of not being up to date on Dales IE.au3. After reading through the UDF source quickly, have you tried: _IEFormElementGetObjByName _IEFormElementCheckboxSelect Or _IEFormElementOptionselect Edit: You may need to parse the source first, to find the info you want to get the object name of. Edited March 9, 2007 by SmOke_N 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 More sharing options...
Hasher Posted March 9, 2007 Share Posted March 9, 2007 (edited) SmOke_N : The webpage he is working with has no form so those functions wont work :-( The only idea I have is check several values to see if you have the correct checkbox like if $oCheckboxes.ID = 6 AND $oCheckboxes.name = "chbox" then ;........... endif Other than that I got nothing :-( Post a full page and I will have a better idea what you working with.... Edited March 9, 2007 by Hasher Firefox's secret is the same as Jessica Simpson's: its effortless, glamorous style is the result of shhh extensions! Link to comment Share on other sites More sharing options...
DaleHohm Posted March 9, 2007 Share Posted March 9, 2007 (edited) If you pass -1 to _IEGetObjByName it will return a collection of all objects with that name... you can then iterate through them with For In Next This should get you going. Dale expandcollapse popup#include <IE.au3> MakeBrowser() $oCBs = _IEGetObjByName($oIE, "chkbox", -1) For $oCB In $oCBs If Not $oCB.disabled Then $oCB.checked = True Next ;-------------------------------------------------------- Func MakeBrowser() $sHTML = "" $sHTML &= "<h1>Checkbox with no Form</h1>" $sHTML &= "<table>" $sHTML &= "<td align=right class=detail><input type=checkbox name=chkbox value=161290=></td>" $sHTML &= "<td align=left class=detail><nobr>pending</nobr></td>" $sHTML &= "<td align=left class=detail>itemnumber1</td>" $sHTML &= "</tr>" $sHTML &= "<td align=right class=detail><input type=checkbox name=chkbox value=161291=></td>" $sHTML &= "<td align=left class=detail><nobr>pending</nobr></td>" $sHTML &= "<td align=left class=detail>itemnumber2</td>" $sHTML &= "</tr>" $sHTML &= "<td align=right class=detail><input type=checkbox name=chkbox DISABLED value=></td>" $sHTML &= "<td align=left class=detail><nobr>pending</nobr></td>" $sHTML &= "<td align=left class=detail>itemnumber3</td>" $sHTML &= "</tr>" $sHTML &= "<td align=right class=detail><input type=checkbox name=chkbox DISABLED value=></td>" $sHTML &= "<td align=left class=detail><nobr>pending</nobr></td>" $sHTML &= "<td align=left class=detail>itemnumber4</td>" $sHTML &= "</tr>" $sHTML &= "<td align=right class=detail><input type=checkbox name=chkbox DISABLED value=></td>" $sHTML &= "<td align=left class=detail><nobr>pending</nobr></td>" $sHTML &= "<td align=left class=detail>itemnumber5</td>" $sHTML &= "</tr>" $sHTML &= "</table>" Global $oIE = _IECreate() _IEBodyWriteHTML($oIE, $sHTML) EndFunc ;==>MakeBrowser Edit: typos Edited March 9, 2007 by DaleHohm Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
crazycrash Posted March 9, 2007 Author Share Posted March 9, 2007 man thanks so much, just made a donation to autoit =D Link to comment Share on other sites More sharing options...
DaleHohm Posted March 9, 2007 Share Posted March 9, 2007 man thanks so much, just made a donation to autoit =DCool. You're welcome.Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now