ANSHQ01 Posted December 29, 2023 Posted December 29, 2023 Hello Experts, This is my 1st post, I have watched YouTube Videos to train myself on Autoit. For simple task faced, it appears to be Rocket science for me. I am trying to copy cell content (Microsoft Office 2019) and paste it to another platform (control + tab) and hit enter. Observer the result and come back to Excel (control + tab) to select second cell A2 paste, and observer results... repeat this till I reach last row normally 15,000 to 16000 rows Currently I am doing manually and use Microsoft Edge. Any helpful guidance/codes will be appreciated. Cheers
Moderators Melba23 Posted December 29, 2023 Moderators Posted December 29, 2023 Moved to the appropriate AutoIt General Help and Support forum, as the Developer General Discussion forum very clearly states: Quote General development and scripting discussions. Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums. Moderation Team Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Danp2 Posted December 29, 2023 Posted December 29, 2023 Take a look at the function_Excel_RangeRead in the help file. Using it, you could read the contents of the Excel file into an array, which you could then process to avoid the flipping back and forth between applications. If you search the forum, then you should find some examples of this function. ANSHQ01 1 Latest Webdriver UDF Release Webdriver Wiki FAQs
Nine Posted December 29, 2023 Posted December 29, 2023 (edited) Usually, we ask members to make an effort to create a starting script, and help them from there. But since it is quite a challenging script for a novice, and it will sure help you in your job and we are in Chrismas time, here my gift for you : #include <Excel.au3> #include <Constants.au3> Global Const $START = 2 ; <========= starting row to begin reading from your excel sheet Global $oWorkBook = _Excel_BookAttach("Book1.xls", "filename") ; <==== your excel file name here If @error Then Exit MsgBox($MB_OK, "Error", "Excel sheet not loaded") Global $iLastRow = $oWorkbook.ActiveSheet.Usedrange.Rows.Count Global $aList = _Excel_RangeRead($oWorkBook, Default, "A" & $START & ":A" & $iLastRow) ; Read column A from START to end If @error or Not IsArray($aList) Then Exit MsgBox($MB_OK, "Error", "unable to read column from excel sheet") _ArrayDisplay($aList) ; Display content of column A HotKeySet("{PGDN}", CopyNextCell) ; PageDown to copy next cell into your other app HotKeySet("^+{END}", Terminate) ; ctrl-shift-end to exit your script While Sleep(100) WEnd Func Terminate() Exit EndFunc Func CopyNextCell() Local Static $iPos = 0 Local $hWnd = WinActivate("[CLASS:Notepad]") ; <======= "Your app title here" If Not $hWnd Then Exit MsgBox($MB_OK, "Error", "Application not loaded") WinWaitActive($hWnd) Send("^a{DEL}" & $aList[$iPos]) ;ControlSetText($hWnd, "", "Your control name here", $aList[$iPos]) ; LOT better but you need to find the control with au3info.exe $iPos += 1 If $iPos > $iLastRow - $START Then Exit MsgBox($MB_OK, "Warning", "Last row reached, exiting script") EndFunc You need to load both excel sheet and your application, modify script accordingly to fit excel file name and app title. _ArrayDisplay will show you the content of the column of your excel sheet Press PgDn key to copy each cell (one a time) into your app Edited December 29, 2023 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
ANSHQ01 Posted December 30, 2023 Author Posted December 30, 2023 Hi NINE, Thank you for your time and expertise. I am still getting acquainted to Script and your suggestions Thank you for wonderful Christmas Gift, Compliments of the Seasons Wish you happy new year... Best wishes... ,
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