Zombie1982 Posted September 11, 2008 Share Posted September 11, 2008 Good evening, Basically I've been working on a small automation to make my life eaiser... now I've come across something thats not really a problem, but more of a curiosity. I've got a function that I'm going to have to copy/paste to repeat 16 times, as I'm grabbing one line from an excel spreadsheet and pasting it into another application. Below is a example of part of my script. expandcollapse popupFunc FillSecondRow() Sleep(500); waits 1/2 a second WinActivate("Microsoft Excel - Confirm pay sheets"); Selects the excel window If WinActive("Microsoft Excel - Confirm pay sheets") = 0 Then; Checks to see if claim is there or not (0 means NO) MsgBox(48, "Massive Error", "Claim Sheet failed to open"); Shows the error Exit; Stops the script EndIf; Ends the if statment Send("^{HOME}"); sets the excel cell to A1 again ;$ExcelGrab = _ExcelReadSheetToArray($oExcel, 14, 4, 20, 9); row, colum, number of rows, number of colums to be read $ExcelGrab = _ExcelReadArray($oExcel, 14, 3, 10, 0); row, colum, number of cells, direction(0=right) ;_ArrayDisplay($ExcelGrab); Displays array for testing _ArrayToClip($ExcelGrab,1,1); sends the work item to the clipboard WinActivate("[TITLE:Labor Claiming]"); Selects winodw Send("{F4}"); brings up add work item Sleep(500); waits 1/2 a second Send("^v"); pastes work item into claim Send("{ENTER}"); Enters the work item Sleep(1000) Send("{ENTER}"); Searches for work item Sleep(3000) Send("{ENTER}"); Adds work item Sleep(1000) Send("{TAB}"); Moves to OK Sleep(1000) Send("{ENTER}"); Clicks ok Sleep(3000); waits 3 seconds MouseClick("LEFT", 655, 225, 0); Clicks the middle of the screen Send("^{HOME}"); sets the excel cell to A1 again Send("{DOWN}"); drives down to the second row Send("{F3}"); selects activitys Sleep(500); waits 1/2 a second Send("{TAB 2}"); Gets into selecting the activites Send("{DOWN 7}"); drives down to AH Helpdesk Send("^{TAB}"); Tabs once Send("^{TAB}"); Tabs twice Send("{ENTER}"); enters work item _ArrayToClip($ExcelGrab,3,3); sends saturday item to the clipboard Send("{TAB 8}"); tabs to saturday Send("{SPACE}^v"); pastes saturday Send("{TAB}"); Tabs to Sunday _ArrayToClip($ExcelGrab,4,4); sends sunday item to the clipboard Send("{SPACE}^v"); pastes sunday Send("{TAB}"); Tabs to Monday _ArrayToClip($ExcelGrab,5,5); sends monday item to the clipboard Send("{SPACE}^v"); pastes monday Send("{TAB}"); tabs to tuesday _ArrayToClip($ExcelGrab,6,6); sends tuesday item to the clipboard Send("{SPACE}^v"); pastes tuesday Send("{TAB}"); tabs to wed _ArrayToClip($ExcelGrab,7,7); sends wed item to the clipboard Send("{SPACE}^v"); pastes wed Send("{TAB}"); tabs to thurs _ArrayToClip($ExcelGrab,8,8); sends thurs item to the clipboard Send("{SPACE}^v"); pastes thurs Send("{TAB}"); tabs to fri _ArrayToClip($ExcelGrab,9,9); sends fri item to the clipboard Send("{SPACE}^v"); pastes fri Send("{TAB}"); tabs to total EndFunc Its basically only the "$ExcelGrab = _ExcelReadArray($oExcel, 14, 3, 10, 0); row, colum, number of cells, direction(0=right)" that changes in each instance. There is no big drama if this can't be done... as I said, I'm more curious. Thanks in advance. Link to comment Share on other sites More sharing options...
James Posted September 11, 2008 Share Posted September 11, 2008 Look at a For Next loop Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Zombie1982 Posted September 11, 2008 Author Share Posted September 11, 2008 Look at a For Next loop >_<Thanks man! I'll investigate that as soon as I can 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