Jump to content

Recommended Posts

Hi is there a move next function or a way to loop so that the next item in a record is selected? I'm not sure where to start looking in order to find them. I want to click a text link and then do my macros, which I'm already finished with and then make it move to the next record. This is on a web browser it looks like this. The link is a date. I believe the page uses javascript Theres also a button for the bottom and I want it to do a whole date range 1/1/2016 - 7/1/2018

Activity Menu Edited.png

Share this post


Link to post
Share on other sites
25 minutes ago, jdelaney said:

Try functions like:

_GUICtrlListView_GetItem
_GUICtrlListView_*

 

Thanks will look into this. How can I make it import the list from the webpage?

 

23 minutes ago, Earthshine said:

read faq 31 and pick the method of browser control 

I already know how to control a browser somewhat. I need to figure out how to make the script decide how to do things on its own. Can I use IUI to accomplish this? The links do not appear to have elements to use.

I cant find any unique properties with simplespy. Using the simple spy output selects only the first link for each date.

 

Edited by milkmoron

Share this post


Link to post
Share on other sites

Oh, that's a browser...good information to include on your post.

_IE*

look into all the ie functions.  You'll have to do loops through your DOM objects.  No one here will be able to help you without the page source of the surrounding objects.

Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

My problem is that the links do not have elements and cant be clicked by _IE functions unless I use the date but there are some entries with the same date so i cant use that. Should I use OCR to do this?

Share this post


Link to post
Share on other sites

OCR would be ugly.  Again, can't help without the page source.

The basics is you loop through each row, find a record by some data within the row, and then get that row's link.

Such as, get the table, get the rows (notice plural), loop through rows for specific td with specific text, get the td for your link, get the link.

 

I've been able to select table data by doing a click on the row (tr node), but have automated other apps where you have to click an edit button on the row...it all depends on how your application works.  Worst case scenario, get the x/y coords and send a mouseclick at it...last resort, only.

Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

Try to click the rows first, and see if that works for you..._ieaction with 'focus' will probably help too.

You are already able to loop through the records in your script, right?

 

I'd prefer you post the source here if necessary...scrub any sensitive data...you only need to include the source for one or two records.

Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites
2 minutes ago, jdelaney said:

Try to click the rows first, and see if that works for you..._ieaction with 'focus' will probably help too.

You are already able to loop through the records in your script, right?

 

I'd prefer you post the source here if necessary...scrub any sensitive data...you only need to include the source for one or two records.

I'm not sure where to find the source for the records. The page source is extremely messy and long.

Share this post


Link to post
Share on other sites

There are browser 'spy' tools that you can select, and click on the page...it will auto navigate you to the source.

send F12 at any browser to see the spy tool (top left button of the new panel that displays).

Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites
<body class="   ext-webkit ext-chrome viewport x-border-layout-ct" id="ext-gen41" style="width: 988px;"><div id="south-region-container" class=" viewport-panels x-border-panel" style="left: 18px; top: 719px; width: 952px; height: 30px;"><div id="footercontainer" class="">

This is what shows up. It looks like this is for the whole page though. When I hover over the code the whole screen is highlighted

Thats the whole html

EDIT: Removed Source

Edited by milkmoron

Share this post


Link to post
Share on other sites

oh, it's like an applet inside the browser...You'll have to wait on someone else to help you with that.


IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

Instead of the ugly OCR approach, can't you just use the Export all tab of the applet then process the outcome according to your needs?


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites
17 hours ago, jchd said:

Instead of the ugly OCR approach, can't you just use the Export all tab of the applet then process the outcome according to your needs?

Doesn't really help because their are multiple instances of the same date and the export all doesn't give anything to make each link unique. I can't think of a way to use export all. It also doesnt show all of the details in the export. So I'd still need to go into the links to get all the info. Whats so ugly about OCR?

Is there something like a controlfind fuction that returns the position of the text you search for?

Im trying this to search for dates but nothing shows up

ControlFocus ("Customer Center", "", "")

Local $iPosition = StringInStr("(.*/.*/.*)", "(.*/.*/.*/)")
MsgBox($MB_SYSTEMMODAL, "", "The search date first appears at position: " & $iPosition)

 

Edited by milkmoron

Share this post


Link to post
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

  • Similar Content

    • By Skeletor
      Hi All,
      I want to make my progress bar progress with the amount of File lines read. 
      How would I do this correctly. So far the code below can sometimes run in the middle of the progress bar and state completed.. and other times it can run into the 200%. 
       
      ;======================================================================== ProgressOn("TITLE", "ACTION") ;======================================================================== For $count = 1 To _FileCountLines($FileRead) Step 1 $string = FileReadLine($FileRead, $count) $value1 = $input[1] $value2 = $input[2] $value3 = $input[3] $value4 = $input[4] $TM = FileWrite("C:\temp\test.txt", $value1 & " " & $value2 & " " & $value3 & " " & $value4 & @CRLF) ProgressSet($count, $count & "%") Next ;======================================================================== ; PROGRESS BAR OFF ;======================================================================== ProgressSet(_FileCountLines($FileRead), "Completed!") Sleep(750) ProgressOff() ;========================================================================  
    • By TheGreatMomo
      Here is the script for the variable I want to find:
      Local $oSunHrsTD = _IETagNameGetCollection($oFrameobj, "span").item(138)
      The Item(138) for the span elemets is a dynamic number based on the index of all span objects on the webpage I am trying to send inputs to. 
      Based on the span.item(#) the corresponding InnerText for that element is the value that I want to get. Which I use the following script:
      Local $oSunHrs = $oSunHrsTD.InnerText
      Global $otime = _IECreate ("https://somewebsite.banana") _IELoadWait($otime) Local $oFrameobj = _IEFrameGetObjByName($otime, "gsft_main") Local $oLinks = _IETagNameGetCollection($oFrameobj, "a") For $oLink In $oLinks If $oLink.ClassName = "linked formlink" Then _IEAction($oLink, "click") ExitLoop EndIf Next _IEloadWait($oFrameobj) Local $oMonHrsTD = _IETagNameGetCollection($oFrameobj, "span").item(139) Local $oMonHrs = $oMonHrsTD.InnerText _IELoadWait($oFrameobj) Local $oFrameobj = _IEFrameGetObjByName($otime, "gsft_main") Local $oMonHrs = _IETagNameGetCollection($oFrameobj, "SPAN") For $oMonHr In $oMonHrs If $oMonHr.ClassName = "aggregate_value" Then If $oMonHr.innertext >= "8" Then Local $oMonAdjHr = (8 - $oMonHR.Innertext) ConsoleWrite( $oMonHrs &@CRLF ) MsgBox (0, "Adjusted Value", $oMonAdjHr) ExitLoop EndIf EndIf Next  
      Where I get confused is how I find Item(#) if all I have is the InnerText. Since the InnerText is static and the Item# is dynamic:
      $oSunHrsTD = _IETagNameGetCollection($oFrameobj, "span").item( "x").InnerText = ("sometext")
      How can i get the X value??
       
    • By Vikramjeet
      $oExcel = ObjCreate("Excel.Application") $oExcel.Visible = 0 #include <MsgBoxConstants.au3> #Include <File.au3> Global $arlines WinActivate("MyApplication") ;Activate My Application Local $hWnd = WinWaitActive("MyApplication", "", 5) ;Wait for My Application for 5 seconds $oExcel.Application.WorkBooks.Open("C:\Users\Charlie\Desktop\Data.xlsx") ;Open Excel file 'Data.xlsx' local $iCell = $oExcel.Application.Cells(31,1).Value ;Read the value from cell A31 $file = @ScriptDir & "\Capture.log" If $hWnd Then For $a = 1 to $iCell ;STEP 1 Send("G*L") Send($oExcel.Application.Cells($a,1).Value) Send("/XUSR") Sleep(1000) Send("{ENTER}") Sleep(2000) ;===> Once the script has sent the above formats to 'MyApplication, A log file (Capture.log) is generated. What do I add as a link so the script moves to ;the following steps _FileReadToArray ($file, $arlines) For $i = $arlines [0] To 1 Step - 1 ; Script starts reading the log file from bottom up If $arlines [$i] = "‡NOT VALID" Then ;===> If I find the word '‡NOT VALID', then I want the script to go to STEP 1 in loop Else ;====> Else I want the script to do the following steps Send("MB") ; Continue sending formats to 'MyApplication' Send("{ENTER}") Sleep(2000) $iNum = StringRegExp(FileRead($file), "(?sm).*^\h*(\d{1,3})", 1)[0] ; Read number at a certain location in Capture.log file ConsoleWrite($iNum & @CRLF) EndIf ;====> Use the captured $iNum in the loop below. What do I add to proceed to the following steps For $i = 1 To $iNum Send("SET"& $i &"/USR") Sleep(500) Send("{ENTER}") Sleep(1000) ;====> Go back to STEP 1 $oExcel.Application.Quit I am a beginner and need help with If, then, else jump to specific loop in the script. Can I please get help with my script where I have multiple loops. I need to link the steps and also break the sequence and jump to specific loop if a certain condition is found in one loop. 
    • By Skeletor
      Hi Guys,
      Is it possible to get a variable on your For..Next loop? 
       
      Local $Lines1 = _FileCountLines(C:\temp\test.txt) Local $linesToCount2 = $Lines1 + 2 $var = Number($linesToCount2) For $count = 1 To _FileCountLines($FileRead2) Step 1 For $i = $var To $count Next ;Code does stuff here Next Somehow my code doesn't work even though I thought I could convert the variable to a Integer / Number.
      This code I posted above does not move to the next value.
      But the code below does... why is that?
      For $count = 1 To _FileCountLines($FileRead2) Step 1 For $i = 2 To $count Next ;Code does stuff here Next  
      Why is the For loop resetting itself?
      Is it because the program does not cache the variable and needs to keep on acquiring this variable each time?
      If so , how would you make this variable static?

       
    • By MrCheese
      hi all,
      Dumb question, but say I have a loop:
      dim $i Do     sleep(1000)          if $i = ; how do i do a function that enters this IF statement every 10 loops?         ; do stuff every 10     EndIf      Until $i = 100  
      - what commands in the if statement do I need to use to make it pass, and on every 10th loop, it enters the if statement. ?
       
      Thanks
×
×
  • Create New...