Jump to content

Please project help


Recommended Posts

I have posted this twice, but I think I am just doing it in the wrong place so I will do it here and hope someone can assist me.

I have been working in a project for a little over 2 years and for the most part things I have had to do have been short and I could do them manually. But I  have been given a task that If I do it manually it is going to take for ever unless I can find a way to automate the process, so enters Autoit. Here is the process I need to automate:

1. I have an Excel workbook, the first worksheet is called "Index" that has a list of text, column "A" has 2000 rows each with a unique entry.

2. I have worksheets, 2000 of them, and each tab is named to match each cell in the in the Index worksheet this is all in the same workbook.

3. I need to copy the first cell

4. Paste that text into a different program in a search window.

5. Press enter

6. Select the results

7. Press ctrl + a to copy everything in the results window

8. Take the results back to Excel to the matching worksheet and paste it in column A, row 1

9. Loop through this until it has gone to each cell in the Index work sheet.

Any help that someone could provide me would be greatly appreciated. As you can see doing this manually will take me forever, well maybe not forever but a very long time. Thank you to anyone that could assist with a script that would do this for me. By the way, I have tried the Autoit recorder but I can not figure out how to loop through the process and I know enough to realize that is not a good way to do this.

Dave

Link to comment
Share on other sites

  • Moderators

As JFish pointed out, your previous thread showed not an ounce of effort on your part. Water pointed you to the Excel UDF, which will easily do what you want it to. I will go further by saying you need to look at these functions in the help file:

  • _ExcelBookOpen to open the book you want
  • _ExcelReadArray to read column A into an array
  • For...In...Next loop, to loop through the array
  • Send or ControlSend to send the array element to your external program

Now, how about you put forth some effort and show us something :)

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Excellent! Just what I needed a starting place. Thank you so much. I will start the script and if, more like when, I get stuck I will let you know and get a little more direction. Thank you for your assistance!

Link to comment
Share on other sites

Okay guys, I tried the _EXCEL_BOOKOPEN, thought I would start there seemed like as good a place as any to start anyway, and never could get the excel book to open. I guess my skill set is just barren when it comes to writing code. My forte is ancient languages. I can remember when I finished six years of formal study in Ancient Greek and a person would ask me to help with some tricky thing, seemed simple to me after the formal study. At the time, my attitude was if you want to know it then learn it after all that is what I had to do. Some twenty seven years later I have come to the realization, some people just don’t have it and they are not going to get it and it isn't my life’s goal to make people Greek Scholars. If any of you need help with something in Ancient Greek, I am your guy and I won’t insist on you learning Greek, I will just help you with what it is you need. Thanks for your direction and help I appreciate it. I am off to doing A LOT of manual work in the project.

Dave

Link to comment
Share on other sites

JohnOne,

I used:

  

_Excel_BookOpen (&oExcel, $sFilePath (C:UsersDaveDocumentsExcelGreek Morph codes for macro")

Below this is a red box with:

error: syntax error

in yellow is "warning: $sFilePath: possibly used before declaration

error: $sFilePath: undeclared global variable.

error: oExcel(): undefined function.

error: c(): undefined function.

Link to comment
Share on other sites

This is the help file example. You should do yourself a favour and learn how to use it...

; Open an existing workbook and returns its object identifier.

#include <Excel.au3>
#include <MsgBoxConstants.au3>

Local $sFilePath1 = @ScriptDir & "\Test.xls" ;This file should already exist
Local $oExcel = _ExcelBookOpen($sFilePath1)

If @error = 1 Then
    MsgBox($MB_SYSTEMMODAL, "Error!", "Unable to Create the Excel Object")
    Exit
ElseIf @error = 2 Then
    MsgBox($MB_SYSTEMMODAL, "Error!", "File does not exist - Shame on you!")
    Exit
EndIf

'?do=embed' frameborder='0' data-embedContent>>

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

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...