Jump to content

Failure of For LOOP


Recommended Posts

Hi Friends,

I created a script, which takes number of entries from the excel sheet as count and it will run the loop according to the count value.

Loop is running good.

Loop limits and all it's taking fine.

For example if the loop limit is $count = 50. while executing the script will automatically quit anywhere, once it crossed 30th iteration.

My doubt here is, Why its happening?

Is RAM size matters, or any junk memory is creating, or any thing i want to clear in starting or in between of the loop.

Give some idea about this friends...!

☺️Thanks...!

Link to comment
Share on other sites

Yup sure...!

For $j = 1 To $count

MouseMove(500,500)
Sleep(2000)
MouseClick("left",500,500)
Send ("{DOWN}")
Sleep(500)
MouseClick($MOUSE_CLICK_RIGHT)
Send ("p")
Sleep(500)

WinActivate("Properties")
WinWaitActive ("Properties")
Sleep(1000)

$hndl7 = WinGetHandle("Properties")
;Writing the report in Excel
Sleep(500)
;getting the required handles
$Part = ControlGetText($hndl7, "", "Edit3")

$Doc = ControlGetText($hndl7, "", "ComboBox2")

$Docu = ControlGetText($hndl7, "", "Edit34")

$Finish = ControlGetText($hndl7, "", "ComboBox24")

WinClose("Properties")

;writing them into excel
$eBook.Sheets(2).Select

_Excel_RangeWrite ( $eBook, $eBook.Activesheet, $Part ,  "B"&$a )

_Excel_RangeWrite ( $eBook, $eBook.Activesheet, $Doc ,  "C"&$a )

_Excel_RangeWrite ( $eBook, $eBook.Activesheet, $Docu ,  "E"&$a )

_Excel_RangeWrite ( $eBook, $eBook.Activesheet, $Finish ,  "F"&$a )



;clearing the variables used to store handles from properties
$Part = ""
$Doc = ""
$Docu = ""
$Finish = ""


$a = ($a + 1)
Next

 

Link to comment
Share on other sites

Link to comment
Share on other sites

Yeah i did that bro. Its running fine for less loop count. But for loop count more than 50, it'll stop after 40th count. My RAM is less. So there mignt be chance of system program manager's speed is not match with script's running speed. Thus I kept winwait and cursor status wait. Now working fine. B n touch my friend...!

Thanks!:)

Link to comment
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
 Share

  • Recently Browsing   0 members

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