Sign in to follow this  
Followers 0
MarkJenks

Great Plains - Check Links

3 posts in this topic

Great Plains V9, SQL

Does anyone have a script for running Check-Links/PA-Check-Links the could share with me?

I'm trying to put one together, but am having an issue with waiting for it to complete each check.

The problem is, it doesn't keep a window open, and doesn't give a message that it is complete when sending it to a file.

Suggestions??

Thanks!

-Mark

CODE
Opt("WinWaitDelay",100)

Opt("WinTitleMatchMode",4)

Opt("WinDetectHiddenText",1)

Opt("MouseCoordMode",0)

Dim $company,$counter,$companycounter

;This is how many companies we have

$companycounter = 31

;Open up Great Plain to the first company

Run('C:\GRPlains\GP\Dynamics.exe Dynamics.set')

WinWait("Welcome to Microsoft Dynamics GP","")

If Not WinActive("Welcome to Microsoft Dynamics GP","") Then WinActivate("Welcome to Microsoft Dynamics GP","")

WinWaitActive("Welcome to Microsoft Dynamics GP","")

Send("user{TAB}password{ENTER}")

WinWait("Company Login","")

If Not WinActive("Company Login","") Then WinActivate("Company Login","")

WinWaitActive("Company Login","")

;Arrow down to select first company

Send("{DOWN}{DOWN}{ENTER}")

;Wait for GP to finish starting up

sleep(15000)

for $company=1 to $companycounter

WinActivate("Microsoft Dynamics GP","")

WinWaitActive("Microsoft Dynamics GP","")

Send("{ALTDOWN}f{ALTUP}c")

WinWait("Company Login","")

If Not WinActive("Company Login","") Then WinActivate("Company Login","")

WinWaitActive("Company Login","")

;Arrow down to select a company

For $counter = 1 to $company

Send("{DOWN}")

Next

Send("{ENTER}")

WinActivate("Microsoft Dynamics GP","")

WinWaitActive("Microsoft Dynamics GP","")

;Wait for GP to finish starting up

sleep(45000)

;Select File-Maint-Check Links

Send("{ALTDOWN}f{ALTUP}m{ENTER}")

While ControlCommand("Microsoft Dynamics GP", "Check Links", "&All >>", "IsVisible", "") = 0

Sleep(250)

Wend

ControlClick ( "Microsoft Dynamics GP", "Check Links", "&All >>", "left")

ControlClick ( "Microsoft Dynamics GP", "Check Links", "OK", "left")

While ControlCommand("Report Destination", "", "OK", "IsVisible", "") = 0

Sleep(250)

Wend

Send("{SPACE}{TAB}{TAB}{SPACE}{TAB}")

Send("Company-CheckLinks-" & $company & ".txt")

Send("{TAB}{DOWN}{DOWN}{ENTER}")

;Wait for Progesss window to disappear

$wcounter = 0

While $wcounter <= 1000

If ControlCommand("Progress", "", "", "IsVisible", "") = 1 Then

Sleep(100)

$wcounter=0

Else

Sleep(100)

$wcounter = $wcounter + 1

EndIf

Wend

;Select File-Maint-PA Check links

Send("{ALTDOWN}f{ALTUP}m{DOWN}{DOWN}{DOWN}{DOWN}{ENTER}")

While ControlCommand("Microsoft Dynamics GP", "PA Check Links", "All >>", "IsVisible", "") = 0

Sleep(250)

Wend

ControlClick ( "Microsoft Dynamics GP", "PA Check Links", "All >>", "left")

ControlClick ( "Microsoft Dynamics GP", "PA Check Links", "OK", "left")

While ControlCommand("Report Destination", "", "OK", "IsVisible", "") = 0

Sleep(250)

Wend

Send("{SPACE}{TAB}{TAB}{SPACE}{TAB}")

Send("Company-CheckLinks-PA-" & $company & ".txt")

Send("{TAB}{DOWN}{DOWN}{ENTER}")

$wcounter = 0

While $wcounter <= 1000

If ControlCommand("Progress", "", "", "IsVisible", "") = 1 Then

Sleep(100)

$wcounter=0

Else

Sleep(100)

$wcounter = $wcounter + 1

EndIf

Wend

Next

WinActivate("Microsoft Dynamics GP","")

WinWaitActive("Microsoft Dynamics GP","")

Send("{ALTDOWN}f{ALTUP}x")

Share this post


Link to post
Share on other sites



My biggest problem seems to be here:

;Wait for Progesss window to disappear

$wcounter = 0

While $wcounter <= 1000

If ControlCommand("Progress", "", "", "IsVisible", "") = 1 Then

Sleep(100)

$wcounter=0

Else

Sleep(100)

$wcounter = $wcounter + 1

EndIf

Share this post


Link to post
Share on other sites

Go Figure. I figured it out, but right after I posted it. I am able to send to screen & to file at the same time. that way I have a window to watch for.

CODE
Opt("WinWaitDelay",100)

Opt("WinTitleMatchMode",4)

Opt("WinDetectHiddenText",1)

Opt("MouseCoordMode",0)

Dim $company,$counter,$companycounter

;This is how many companies we have

$companycounter = 31

;Open up Great Plain to the first company

Run('C:\GRPlains\GP\Dynamics.exe Dynamics.set')

WinWait("Welcome to Microsoft Dynamics GP","")

If Not WinActive("Welcome to Microsoft Dynamics GP","") Then WinActivate("Welcome to Microsoft Dynamics GP","")

WinWaitActive("Welcome to Microsoft Dynamics GP","")

;Log into GP

Send("user{TAB}password{ENTER}")

WinWait("Company Login","")

If Not WinActive("Company Login","") Then WinActivate("Company Login","")

WinWaitActive("Company Login","")

;Arrow down to select first company

Send("{DOWN}{DOWN}{ENTER}")

;Wait for GP to finish starting up

sleep(15000)

for $company=1 to $companycounter

WinActivate("Microsoft Dynamics GP","")

WinWaitActive("Microsoft Dynamics GP","")

Send("{ALTDOWN}f{ALTUP}c")

WinWait("Company Login","")

If Not WinActive("Company Login","") Then WinActivate("Company Login","")

WinWaitActive("Company Login","")

;Arrow down to select a company

For $counter = 1 to $company

Send("{DOWN}")

Next

Send("{ENTER}")

WinActivate("Microsoft Dynamics GP","")

WinWaitActive("Microsoft Dynamics GP","")

;Wait for GP to finish starting up

sleep(45000)

;Select File-Maint-Check Links

Send("{ALTDOWN}f{ALTUP}m{ENTER}")

While ControlCommand("Microsoft Dynamics GP", "Check Links", "&All >>", "IsVisible", "") = 0

Sleep(250)

Wend

ControlClick ( "Microsoft Dynamics GP", "Check Links", "&All >>", "left")

ControlClick ( "Microsoft Dynamics GP", "Check Links", "OK", "left")

While ControlCommand("Report Destination", "", "OK", "IsVisible", "") = 0

Sleep(250)

Wend

Send("{TAB}{TAB}{SPACE}{TAB}")

Send("Company-CheckLinks-" & $company & ".txt")

Send("{TAB}{DOWN}{DOWN}{TAB}{RIGHT}{ENTER}")

;Wait for Progesss window to disappear

While ControlCommand("Microsoft Dynamics GP", "Screen Output - File Maintenance Error Report", "Print", "IsVisible", "") = 0

Sleep(250)

Wend

;Close Window

Send("^{F4}")

;Select File-Maint-PA Check links

Send("{ALTDOWN}f{ALTUP}m{DOWN}{DOWN}{DOWN}{DOWN}{ENTER}")

While ControlCommand("Microsoft Dynamics GP", "PA Check Links", "All >>", "IsVisible", "") = 0

Sleep(250)

Wend

ControlClick ( "Microsoft Dynamics GP", "PA Check Links", "All >>", "left")

ControlClick ( "Microsoft Dynamics GP", "PA Check Links", "OK", "left")

While ControlCommand("Report Destination", "", "OK", "IsVisible", "") = 0

Sleep(250)

Wend

Send("{TAB}{TAB}{SPACE}{TAB}")

Send("Company-CheckLinks-PA-" & $company & ".txt")

Send("{TAB}{DOWN}{DOWN}{TAB}{RIGHT}{ENTER}")

;Wait for Progesss window to disappear

While ControlCommand("Microsoft Dynamics GP", "Screen Output - File Maintenance Error Report", "Print", "IsVisible", "") = 0

Sleep(250)

Wend

;Close Window

Sleep(2000)

Send("^{F4}")

Next

WinActivate("Microsoft Dynamics GP","")

WinWaitActive("Microsoft Dynamics GP","")

Send("{ALTDOWN}f{ALTUP}x")

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  
Followers 0