SkysLastChance Posted September 11, 2013 Share Posted September 11, 2013 I was wondering if it is possible to make a input box that could change the number of rows? So instead of $aArray= _ExcelReadSheetToArray($oExcel,2,1,10,3,True) I was wondering If I could have a input box where I can change the number of row to a variable number each time I run the bot? Because sometimes I might have 10 row other times I might have 250... Sorry, If this is not the right place for this post. This is the first time I have posted Any help would be awesome. Thanks You miss 100% of the shots you don't take. -Wayne Gretzky -Michael Scott Link to comment Share on other sites More sharing options...
Solution water Posted September 11, 2013 Solution Share Posted September 11, 2013 Welcome to AutoIt and the forum! Use function InputBox to get the number from the user and assign it to a variable. Then pass the variable to _ExcelReadSheetToArray. Make sure to use function "Number" to convert the string returned by InputBox to a number. SkysLastChance 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
SkysLastChance Posted September 11, 2013 Author Share Posted September 11, 2013 Awesome, Thank you for the quick response! This is what I did $number = inputbox( "Sky Bot", "How many entires?") _ExcelReadSheetToArray($oExcel,2,1,$number,3,True) You miss 100% of the shots you don't take. -Wayne Gretzky -Michael Scott Link to comment Share on other sites More sharing options...
water Posted September 11, 2013 Share Posted September 11, 2013 Out of curiosity: Can you explain what your "Sky bot" is? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
SkysLastChance Posted September 11, 2013 Author Share Posted September 11, 2013 expandcollapse popup#include <File.au3> #include <Excel.au3> #include <Word.au3> #include <Array.Au3> #include <Clipboard.au3> $number = inputbox( "Sky Bot", "How many entires?") HotKeySet("{ESC}", "Terminate") Func Terminate() Exit 0 EndFunc Opt("SendKeyDelay", 80) Dim $oExcel, $sExcelFile, $ms Dim $fExcelVisible = 1 ;Change this to 0 for Production While ProcessExists("EXCEL.EXE") $ms = MsgBox(5,"","Process error. You have an Excel sheet open. You must close it in order to let this program work. Please close it now.") ;Retry=4 and Cancel=2 If $ms=2 Then Exit Sleep(250) WEnd $sExcelFile = FileOpenDialog("Choose/Create Excel File", @ScriptDir, "(*.xlsx)") ;Changed $oExcel to $sExcelFile If FileExists($sExcelFile) Then $oExcel = _ExcelBookOpen($sExcelFile,$fExcelVisible, False);this will open the chosen xls file. If IsObj($oExcel) Then ConsoleWrite("Excel book " & $sExcelFile & " has been opened." & @CRLF) Else $oExcel = _ExcelBookNew($fExcelVisible);this is here to create the xls file if it does not exist. EndIf $aArray= _ExcelReadSheetToArray($oExcel,2,1,$number,3,True) ; $iStartRow = 1, $iStartColumn = 1, $iRowCnt = 10, $iColCnt = 3, $iColShift = True as excel $rows = 1 Opt("WinTitleMatchMode", 1) Local $loop = 0 Run("notepad.exe") Do For $i = 1 to $aArray[0][0] ; if you change 1 it will start reading from that. $sR1 = $aArray[$i][0] ; Entry Number $sR2 = $aArray[$i][1] ; Weight $sR3 = $aArray[$i][2] ; Value WinWaitActive("Untitled - Notepad") send($sR1) send("{ENTER}") send($sR2) send("{ENTER}") send($sR3) send("{ENTER}") Next $loop = $loop + 1 Until $loop = $rows _ExcelBookClose($oExcel) ; close excel ProcessClose("Excel.exe") ; close excel MsgBox(0,"Sky Bot ","Total Number of Entries" &": "& $i - 1) ;ProcessClose("notepad.exe") ; close notepad ;send("!n") You miss 100% of the shots you don't take. -Wayne Gretzky -Michael Scott Link to comment Share on other sites More sharing options...
SkysLastChance Posted September 11, 2013 Author Share Posted September 11, 2013 (edited) It is not done yet. I am using notepad as a testing program, until I get it working how I want. I just basically need it to move information from excel into my program to store data. side question: I am probably going to look this up tomorrow, but If you know I would appreciate a response. How do I do Shift commands with the F keys. Such as Shift+F6. I know control is "^" ,but not sure on shift. Edit: Figured it out - Send ("{LSHIFT}+{F6}") Edited September 11, 2013 by SkysLastChance You miss 100% of the shots you don't take. -Wayne Gretzky -Michael Scott Link to comment Share on other sites More sharing options...
water Posted September 11, 2013 Share Posted September 11, 2013 Just as an information: You do not need to close Excel if it is already running. If the workbook you want to process is already open just use _ExcelBookAttach to connect to this workbook. If it fails (because the running Excel instance uses another workbook) use _ExcelBookOpen. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki 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