SkysLastChance 10 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 Life's simple. You make choices and you don't look back. Share this post Link to post Share on other sites
water 2,369 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. 1 SkysLastChance reacted to this My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2020-10-10 - Version 1.5.2.1) - Download - General Help & Support - Example Scripts - WikiOutlookEX (NEW 2020-12-15 - Version 1.6.3.1) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2020-06-27 - Version 1.3.2.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - WikiTask Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - WikiTutorials:ADO - Wiki, WebDriver - Wiki Share this post Link to post Share on other sites
SkysLastChance 10 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) Life's simple. You make choices and you don't look back. Share this post Link to post Share on other sites
water 2,369 Posted September 11, 2013 Out of curiosity: Can you explain what your "Sky bot" is? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2020-10-10 - Version 1.5.2.1) - Download - General Help & Support - Example Scripts - WikiOutlookEX (NEW 2020-12-15 - Version 1.6.3.1) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2020-06-27 - Version 1.3.2.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - WikiTask Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - WikiTutorials:ADO - Wiki, WebDriver - Wiki Share this post Link to post Share on other sites
SkysLastChance 10 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") Life's simple. You make choices and you don't look back. Share this post Link to post Share on other sites
SkysLastChance 10 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 Life's simple. You make choices and you don't look back. Share this post Link to post Share on other sites
water 2,369 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 2020-10-10 - Version 1.5.2.1) - Download - General Help & Support - Example Scripts - WikiOutlookEX (NEW 2020-12-15 - Version 1.6.3.1) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2020-06-27 - Version 1.3.2.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - WikiTask Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - WikiTutorials:ADO - Wiki, WebDriver - Wiki Share this post Link to post Share on other sites