Jump to content
Sign in to follow this  
getmo96

Looping Problem SAP

Recommended Posts

getmo96

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 by getmo96

Share this post


Link to post
Share on other sites
feoinc

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

Next

Share this post


Link to post
Share on other sites
Cha0sBG

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

Share this post


Link to post
Share on other sites
mariano

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.

Share this post


Link to post
Share on other sites
Cha0sBG

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.

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.