Search the Community
Showing results for tags 'Do until'.
-
Why hello there! I have a script reading an Excel sheet (currently only looking at A1), copying the data in that cell, and then searching for it in a Website's search tool. Then it does some stuff if it actually finds something. After that, I need it to go back to the Excel sheet, write "yes" into column B if the search was good -- "no" if no results were found, then go down to A2 and do the whole thing all over again until column A has nothing left. I really suck at loops and have a hard time grasping how it works. Any help or guidance is really appreciated! SearchCourse() ;~ Now that were logged in, navigate to the course search page. Func SearchCourse() _IENavigate($oIE, $urlBBCourseSearch) ;~ Change the search criteria to "Course ID" _bbCourseSearchCategoryChange("Course ID") ;~ Open the selected Excel file Local $oAppl = _Excel_Open() Local $oWorkbook = _Excel_BookOpen($oAppl, $ChosenFileName, Default, Default, True) ;~ Copy whats in the first cell (A1) _Excel_RangeCopyPaste($oWorkbook.Worksheets(1), "A1") Global $WhatsCopied = ClipGet() ;~ Paste whats copied into the search text box and click submit Local $oForm = _IEGetObjByName($oIE, "courseManagerFormSearch") Local $oSearchString = _IEFormElementGetObjByName($oForm, "courseInfoSearchText") _IEFormElementSetValue($oSearchString, $WhatsCopied) _IEFormSubmit($oForm) ;~ Lets see what we got from the search Local $oBBTable = _IETableGetCollection($oIE, 2) Global $aBBTableData = _IETableWriteToArray($oBBTable) _ArrayDisplay($aBBTableData) DeleteCourseBegin() EndFunc ;==>SearchCourse ;~ OK, we logged in and we searched for a course. Lets delete it! Func DeleteCourseBegin() $iSearchIndex = _ArraySearch($aBBTableData, "Course ID", 0, 0, 0, 1, 1, 0) ;~ If the course was not found, do this. If $iSearchIndex = -1 Then MsgBox(4096, "Search Error", "Item not found") ;~ Now go back to the Excel sheet and search for the next one....? ;~ If the course was found, begin the deletion process. Else MsgBox(4096, "Search Success", $aBBTableData[$iSearchIndex][0] & " = " & $aBBTableData[$iSearchIndex][1]) DeleteCourseNow() EndIf EndFunc ;==>DeleteCourseBegin ;~ The course search was successful. Delete the course now. Func DeleteCourseNow() ;~ Click the checkbox located beside the course that has been found. Local $CheckBox = _IEGetObjByName($oIE, "ckbox") _IEAction($CheckBox, "click") _IELoadWait($oIE) ;~ Click the Delete button. _IELinkGetCollection($oIE) Local $oLinks = _IELinkGetCollection($oIE) For $oLink In $oLinks If $oLink.href = "javascript:validateRemove();" Then _IEAction($oLink, "click") ExitLoop EndIf Next ;~ Click the "Delete course, including all of its files" radio button. Local $RadioButton = _IEGetObjById($oIE, "removeAllFiles_t") _IEAction($RadioButton, "click") _IELoadWait($oIE) ;~ Click the "Submit" button Local $Submit = _IEGetObjByName($oIE, "bottom_Submit") _IEAction($Submit, "click") _IELoadWait($oIE) ;~ Now go back to the Excel sheet and search for the next one....? EndFunc ;==>DeleteCourseNow
-
Hey, so after searching the Forums, Google, YouTube and Other Forums, I found ImageSearch! AnyBody Not Shure what ImageSearch is, it is a pixelsearch that looks for a image file in the ImageSearch.au3 directory and then Looks for it on the Screen Great Stuff ! Here is a Little Example where i Search for a .png #include <ImageSearch.au3> $x = 0 $y = 0 $res = _imagesearcharea("GreenYellow.png",1,340,150,940,512,$x,$y,100) If $res = 1 Then MouseMove($x,$y,100) Else MsgBox(0,"404","Not Found") EndIfJust a quick explain on what happens in the function _imagesearcharea: _imagesearcharea("GreenYellow.png",1,340,150,940,512,$x,$y,100) _imagesearcharea("image_name" , a*,b*,b*,b*,b*,c*,c*,d*) a* = Chooses the Return Value for C*. 0 = top x,y Pixel 1 = Center of the Found image. b* = Coordinates for the Search Window(Top,Left,Right,Bottom) c* = The Return Variables (See a*) d* = Variaton between Image and Search. I'm not sure if the explanation was needed, i just like pretty Topics My actual problem : I want to make a do_until loop that keeps doing _Imagesearcharea until i drag the desktop icon in the circa Area. I could do this by just specifying the Search window. But that would be way to Easy Instead i want the Loop to Run until the icon is dragged "near" a predefined spot on one axis using one of the Variables from _Imagesearcharea. So lets say i want to ImageSearch until i drag it near the middle of the Screen Seen from the X axis. Until $x = 640But that is not "Near" ! That is exact ! I want it to Do_Until it is "close" to 640, so it should also stop searching when it is +20 or -20 from 640. I think i will do this with some advanced Operators ? Math has never been my Strength... Please Help
- 4 replies
-
- ImageSearch
- Do until
-
(and 1 more)
Tagged with: