Vikramjeet Posted January 23, 2021 Posted January 23, 2021 For $A1 = 12 To 11 + $Total For $B1 = 1 To ($oExcel.Application.Cells($A1,6).Value) ; This value is from the Excel file. It can be from 1 - 9. For $N1 = 7 To ??? ; This is based on the value of $B1 ((1 = 7, 2 = 17, 3 = 27, 4 = 37, 5 = 47) Send("-"& ($oExcel.Application.Cells($A1,$N1).Value) &"/"& ($oExcel.Application.Cells($A1,$N1+1).Value)) Sleep(400) Send("{ENTER}") Sleep(700) Next Next Next I am not able to figure how to loop $N1 as follows If the Value of $B1 = 1 then $N1 = 7 If the Value of $B1 = 2 then $N1 = 17 If the Value of $B1 = 3 then $N1 = 27 If the Value of $B1 = 4 then $N1 = 37 The value of $N1 comes from $B1 where 1 = 7, 2 = 17, 3 = 27, 4 = 37, 5 = 47) Thank You
seadoggie01 Posted January 23, 2021 Posted January 23, 2021 I think you want to drop the third loop and use this instead: $N1 = $B1 * 10 - 3 But I'd highly suggest looking into setting the formula/value of the cell instead of using Send. It's super effective All my code provided is Public Domain... but it may not work. Use it, change it, break it, whatever you want. Spoiler My Humble Contributions:Personal Function Documentation - A personal HelpFile for your functionsAcro.au3 UDF - Automating Acrobat ProToDo Finder - Find #ToDo: lines in your scriptsUI-SimpleWrappers UDF - Use UI Automation more Simply-erKeePass UDF - Automate KeePass, a password managerInputBoxes - Simple Input boxes for various variable types
Vikramjeet Posted January 23, 2021 Author Posted January 23, 2021 $step = 10 For $N1 = 7 To (10 X ($oExcel.Application.Cells($A1,2).Value)) Step $step How to indicate the loop 'To' value as 10 x value extracted from a specific excel cell, and start from 7 and then increase the loop in multiples - 7, (10X2) = 20, (10X3) = 30, (10X4) = 40. But because we start from 7 and step up by 10, the loop counter would go 7, 17, 27, 37.....
Dan_555 Posted January 23, 2021 Posted January 23, 2021 Hi, can you explain what you want to do ? When you say: Quote But because we start from 7 and step up by 10, the loop counter would go 7, 17, 27, 37..... Do you mean/want that the loop counter should go in 7, 17, 27 or do you want that the loop counter should go 7, 10, 20, 30, 40, 50 ? Some of my script sourcecode
Vikramjeet Posted January 23, 2021 Author Posted January 23, 2021 $iCount = ($oExcel.Application.Cells($A1,6).Value) $step = 10 For $N1 = 7 To 10 * $iCount Step $step Send("-"& ($oExcel.Application.Cells($A1,$N1).Value) &"/"& ($oExcel.Application.Cells($A1,$N1+1).Value)) Sleep(400) Send("{ENTER}") Sleep(700) Send("{ESC}") Sleep(300) Send ($oExcel.Application.Cells($A1,$N1+7).Value) Sleep(400) Send("{ENTER}") Sleep(700) Send("{ESC}") Sleep(300) I think we got it to work. 1- So I wanted the script to read the data from cell ($A1,6) to know how many times to loop. 2- If the value in cell ($A1,6) is 5, then the script will loop from 7 to 50 (10 X 5) 3- Because of the $Step, it will jump 10 numbers. That means it will go 7, 17 (7+10), 27 (17+10), 37 (27+10), 47 (37+10) 4- The loop will stop at 47 since 50 is the end of loop and next loop counter value will go over 50 5- $N1 starts from value 7 which make the script read cell value starting ($A1,7) Thank you for your help We did it 🙂
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