getmo96 Posted July 20, 2008 Share Posted July 20, 2008 (edited) I am helping a friend save time. She has to close 9000 + projects in SAP. She uses the same key strokes over and over again. The only thing changing is the project name.number. Here is what we have put together. The strokes are good we are just having issues with the looping. I tried the For command with the while but it end in a error. The error states we need a next.... Can someone shed some light? For $ProjectNum = 001206 To 002132 Step 1 While 1 Opt("WinWaitDelay", 100) Opt("WinTitleMatchMode", 4) Opt("WinDetectHiddenText", 1) Opt("MouseCoordMode", 0) WinWait("Project Builder: EUSMB.MBC.$ProjectNum", "") If Not WinActive("Project Builder: EUSMB.MBC.$ProjectNum", "") Then WinActivate("Project Builder: EUSMB.MBC.$ProjectNum", "") WinWaitActive("Project Builder: EUSMB.MBC.$ProjectNum", "") MouseMove(135, 3) MouseDown("left") MouseUp("left") Send("{CTRLDOWN}{F2}{CTRLUP}") Sleep(5000) MouseMove(95, 27) MouseDown("left") MouseUp("left") MouseMove(111, 69) MouseDown("left") MouseUp("left") MouseMove(309, 205) MouseDown("left") MouseUp("left") MouseMove(495, 205) MouseDown("left") MouseUp("left") Sleep(5000) MouseMove(32, 24) MouseDown("left") MouseUp("left") MouseMove(55, 69) MouseDown("left") MouseUp("left") WinWait("Open Project", "") If Not WinActive("Open Project", "") Then WinActivate("Open Project", "") WinWaitActive("Open Project", "") Send("EUSMB.MBC.$ProjectNum") MouseMove(21, 131) MouseDown("left") MouseUp("left") WinWait("Close the project and open another", "") If Not WinActive("Close the project and open another", "") Then WinActivate("Close the project and open another", "") WinWaitActive("Close the project and open another", "") MouseClick("left", 72, 148, 2) Sleep(4000) WEnd Edited July 20, 2008 by getmo96 Link to comment Share on other sites More sharing options...
feoinc Posted July 20, 2008 Share Posted July 20, 2008 I am helping a friend save time. She has to close 9000 + projects in SAP. She uses the same key strokes over and over again. The only thing changing is the project name.number. Here is what we have put together. The strokes are good we are just having issues with the looping. I tried the For command with the while but it end in a error. The error states we need a next.... Can someone shed some light?For $ProjectNum = 001206 To 002132 Step 1; While 1 Opt("WinWaitDelay", 100) Opt("WinTitleMatchMode", 4) Opt("WinDetectHiddenText", 1) Opt("MouseCoordMode", 0) WinWait("Project Builder: EUSMB.MBC.$ProjectNum", "") If Not WinActive("Project Builder: EUSMB.MBC.$ProjectNum", "") Then WinActivate("Project Builder: EUSMB.MBC.$ProjectNum", "") WinWaitActive("Project Builder: EUSMB.MBC.$ProjectNum", "") MouseMove(135, 3) MouseDown("left") MouseUp("left") Send("{CTRLDOWN}{F2}{CTRLUP}") Sleep(5000) MouseMove(95, 27) MouseDown("left") MouseUp("left") MouseMove(111, 69) MouseDown("left") MouseUp("left") MouseMove(309, 205) MouseDown("left") MouseUp("left") MouseMove(495, 205) MouseDown("left") MouseUp("left") Sleep(5000) MouseMove(32, 24) MouseDown("left") MouseUp("left") MouseMove(55, 69) MouseDown("left") MouseUp("left") WinWait("Open Project", "") If Not WinActive("Open Project", "") Then WinActivate("Open Project", "") WinWaitActive("Open Project", "") Send("EUSMB.MBC.$ProjectNum") MouseMove(21, 131) MouseDown("left") MouseUp("left") WinWait("Close the project and open another", "") If Not WinActive("Close the project and open another", "") Then WinActivate("Close the project and open another", "") WinWaitActive("Close the project and open another", "") MouseClick("left", 72, 148, 2) Sleep(4000); WEndNext Link to comment Share on other sites More sharing options...
Cha0sBG Posted July 20, 2008 Share Posted July 20, 2008 expandcollapse popupFor $ProjectNum = 001206 To 002132 Step 1 While 1 Opt("WinWaitDelay", 100) Opt("WinTitleMatchMode", 4) Opt("WinDetectHiddenText", 1) Opt("MouseCoordMode", 0) WinWait("Project Builder: EUSMB.MBC.$ProjectNum", "") If Not WinActive("Project Builder: EUSMB.MBC.$ProjectNum", "") Then WinActivate("Project Builder: EUSMB.MBC.$ProjectNum", "") WinWaitActive("Project Builder: EUSMB.MBC.$ProjectNum", "") MouseMove(135, 3) MouseDown("left") MouseUp("left") Send("{CTRLDOWN}{F2}{CTRLUP}") Sleep(5000) MouseMove(95, 27) MouseDown("left") MouseUp("left") MouseMove(111, 69) MouseDown("left") MouseUp("left") MouseMove(309, 205) MouseDown("left") MouseUp("left") MouseMove(495, 205) MouseDown("left") MouseUp("left") Sleep(5000) MouseMove(32, 24) MouseDown("left") MouseUp("left") MouseMove(55, 69) MouseDown("left") MouseUp("left") WinWait("Open Project", "") If Not WinActive("Open Project", "") Then WinActivate("Open Project", "") WinWaitActive("Open Project", "") Send("EUSMB.MBC.$ProjectNum") MouseMove(21, 131) MouseDown("left") MouseUp("left") WinWait("Close the project and open another", "") If Not WinActive("Close the project and open another", "") Then WinActivate("Close the project and open another", "") WinWaitActive("Close the project and open another", "") MouseClick("left", 72, 148, 2) Sleep(4000) ContinueLoop WEnd Hope This Will Work For you muttley Have Questions About GUI (Graphical User Interface) ? Post Them Here :GUI Help And Support ForumHave Questions About General AutoIt ? Post Them Here : General Help And Support ForumNew To AutoIt ? Be Shure To Check Out The FaQ's (Frequently Asked Questions) Or FaQ ¹ There You May Find Great Help That Will Guide You True The Wonderful Programming Language AutoItOthere Good Place To Get Some Knolage Of AutoIt Is The Example Script ForumNotice A Bug ? Please Go And Report it At Bug Report Section And Help The Devolepers Of AutoIt Update And Fix The Programming LanguageWant To Thank The People For This Great Forum And Programming Language ? Then DonateWhen You Found The Answer Your Looking For Please Add [Resolved] To The Thread's Name That Will Show Otheres That You Have Found What Your Looking For And They Whount Have To Enter The Thread. Link to comment Share on other sites More sharing options...
mariano Posted July 20, 2008 Share Posted July 20, 2008 Sure it needs a "next", put it at the end of the script. One more thing... I have not a running autoit at hand right know but I think that you can not use "If" without the closing "EndIf". Cheers. Link to comment Share on other sites More sharing options...
Cha0sBG Posted July 20, 2008 Share Posted July 20, 2008 if u have Wend i think it dousnt need but try my example aswell and tell me if it works for u Have Questions About GUI (Graphical User Interface) ? Post Them Here :GUI Help And Support ForumHave Questions About General AutoIt ? Post Them Here : General Help And Support ForumNew To AutoIt ? Be Shure To Check Out The FaQ's (Frequently Asked Questions) Or FaQ ¹ There You May Find Great Help That Will Guide You True The Wonderful Programming Language AutoItOthere Good Place To Get Some Knolage Of AutoIt Is The Example Script ForumNotice A Bug ? Please Go And Report it At Bug Report Section And Help The Devolepers Of AutoIt Update And Fix The Programming LanguageWant To Thank The People For This Great Forum And Programming Language ? Then DonateWhen You Found The Answer Your Looking For Please Add [Resolved] To The Thread's Name That Will Show Otheres That You Have Found What Your Looking For And They Whount Have To Enter The Thread. Link to comment Share on other sites More sharing options...
DW1 Posted July 20, 2008 Share Posted July 20, 2008 you don't need an endif as long as the condition and action are on the same single line AutoIt3 Online Help 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