Meditech If...Else...Then

Getting started -basics for starting with WinTask

Meditech If...Else...Then

Postby ms.maryw on Thu Apr 09, 2015 3:25 pm

Hello All,
I am new to scripting but have a very basic concept when it comes to using Wintask. I have attached a copy of the script I am currently using and sceenshots.

In Meditech Client Server 5.66 Registration Management Desktop in the cancel routine I need to preform the following steps:

1. In the name field Enter the patient account number
2. Press Y on the keyboard at the confirmation screen
3. In the Cancel Account field Enter Y
4. If Error window "There are outstanding issues in other applications for (account number)
5. Press "C"
6. Then press ESC key
7. Else Enter account number at first screen in name field.

The current script runs but when I get to the error message I have to press C step 5 and ESC step 6.

My problem is I do not know how to write and If..then..else statement.

Thank you for any help you are able to provide.

Mary
Attachments
Example Screens.pdf
Meditech Example Screens
(358.68 KB) Downloaded 1581 times
Cancel Accounts.src
Cancel Account Current Script
(3.11 KB) Downloaded 1563 times
ms.maryw
 
Posts: 9
Joined: Fri Jan 21, 2011 4:20 pm

Re: Meditech If...Else...Then

Postby TechSupport on Fri Apr 10, 2015 8:57 am

Hello,

You need to use the ExistW function:
If ExistW("window name of the Error window") = 1 then
'here click the Close button and any other action you want to do if the Error window is detected
EndIf

To find the window name of the Error window, when the error window is there, call Spy and spy that Error window, then paste the window name found by Spy.

Just before the If lines, add a small pause in order to give some time for the Error window to appear, Pause 1 is usually enough.

Regards.
WinTask Tech Support
TechSupport
 
Posts: 805
Joined: Thu Nov 16, 2006 9:58 am

Re: Meditech If...Else...Then

Postby ms.maryw on Fri Apr 10, 2015 2:58 pm

Thank you VERY MUCH!!! I am very happy this worked and it was such a simple solution.

Have a great weekend.

Mary
ms.maryw
 
Posts: 9
Joined: Fri Jan 21, 2011 4:20 pm

Re: Meditech If...Else...Then

Postby ms.maryw on Fri Apr 10, 2015 2:59 pm

Thank you VERY MUCH!!! I am very happy this worked and it was such a simple solution.

Have a great weekend.

Mary
ms.maryw
 
Posts: 9
Joined: Fri Jan 21, 2011 4:20 pm

Re: Meditech If...Else...Then

Postby ms.maryw on Fri Sep 25, 2015 5:24 pm

How may I apply the same logic to an image?

In BAR I am going into Process Account > Demographics > Edit
The Push Edits to Additional Accounts will sometimes appear.
I need to press Ok or F12 when this appears. If it does not appear I need to continue with my changes on the demographics page.

Entering the window name does not appear to be working because the process account window is always active.

Thank you
ms.maryw
 
Posts: 9
Joined: Fri Jan 21, 2011 4:20 pm

Re: Meditech If...Else...Then

Postby ms.maryw on Fri Sep 25, 2015 5:24 pm

How may I apply the same logic to an image?

In BAR I am going into Process Account > Demographics > Edit
The Push Edits to Additional Accounts will sometimes appear.
I need to press Ok or F12 when this appears. If it does not appear I need to continue with my changes on the demographics page.

Entering the window name does not appear to be working because the process account window is always active.

Thank you
ms.maryw
 
Posts: 9
Joined: Fri Jan 21, 2011 4:20 pm

Re: Meditech If...Else...Then

Postby TechSupport on Fri Sep 25, 2015 7:54 pm

Hello,

You can use the return code of ClickOnBitmap. If the return code is 0, the bitmap that you will have created telling that the bitmap appeared, the bitmap is there. if the return code is not zero, the bitmap is not there. And so same block If.. then... endif using this return code.

Best regards.
WinTask Tech Support
TechSupport
 
Posts: 805
Joined: Thu Nov 16, 2006 9:58 am

Re: Meditech If...Else...Then

Postby ms.maryw on Fri Sep 25, 2015 8:50 pm

Thank you for your reply.

Like this:

If UseWindow( "CSMAGIC.EXE|MGUIWin|Process Account - SFM (SJHS/SJHS.LIVE/SOCAL.LIVE) - Mary A",3 )= 0 then
ClickOnBitmap( "C:\Users\Mary\Desktop\Box Sync\Wintask\OK.bmp", left, single,
InArea( 801, 649, 34, 59 ) )

Else

UseWindow("CSMAGIC.EXE|Edit|Process Account - SFM (SJHS/SJHS.LIVE/SOCAL.LIVE) - Mary A|2",3)
SendKeys("<Enter>")

Endif
ms.maryw
 
Posts: 9
Joined: Fri Jan 21, 2011 4:20 pm

Re: Meditech If...Else...Then

Postby TechSupport on Sat Sep 26, 2015 2:43 pm

Hello,

You will need a UseWindow before the If in order to tell in which window the bitmap to click is, then:
ret=ClickOnBitmap( "C:\Users\Mary\Desktop\Box Sync\Wintask\OK.bmp", left, single,
InArea( 801, 649, 34, 59 ) )
If ret<>0 then
SendKeys("<Enter>")
EndIf

Which means click the OK.bmp bitmap. If the bitmap is not found, the return code is not 0, so press Enter if the OK.bmp bitmap is not found.

Best regards.
WinTask Tech Support
TechSupport
 
Posts: 805
Joined: Thu Nov 16, 2006 9:58 am

Re: Meditech If...Else...Then

Postby ms.maryw on Fri Oct 02, 2015 5:56 pm

Hello,

When the window with text Push Edits to Additional Accounts is seen F12 or OK needs to be clicked.
The script is not pressing OK

If this window is not seen and the window with the group name and number is seen the script needs to go to the field with the group name and delete then to the group number and delete.
This window name is the same as the window name above for Push Edits however the image is different. See attachment.

Ideally I would like to click the field with the group name and number and delete the value. Sometimes a value is not found and causes the script to error.
When pressing F12 after deleting the fields I want the account to return to the process account window and enter the next account. Sometimes after pressing F12 I receive a pop up window regarding subscriber or social security existing on another account which I press F12.

The script is not working correctly and now stops at the Push Edits screen.

Have a great weekend.
Attachments
Example Insurance Screen.docx
Example Screen
(208.54 KB) Downloaded 1421 times
ADM Delete MCR Group Name Number.src
ADM Delete MCR Group Name and NUmber
(4.59 KB) Downloaded 1493 times
ms.maryw
 
Posts: 9
Joined: Fri Jan 21, 2011 4:20 pm

Re: Meditech If...Else...Then

Postby ms.maryw on Fri Oct 02, 2015 5:57 pm

Hello,

When the window with text Push Edits to Additional Accounts is seen F12 or OK needs to be clicked.
The script is not pressing OK

If this window is not seen and the window with the group name and number is seen the script needs to go to the field with the group name and delete then to the group number and delete.
This window name is the same as the window name above for Push Edits however the image is different. See attachment.

Ideally I would like to click the field with the group name and number and delete the value. Sometimes a value is not found and causes the script to error.
When pressing F12 after deleting the fields I want the account to return to the process account window and enter the next account. Sometimes after pressing F12 I receive a pop up window regarding subscriber or social security existing on another account which I press F12.

The script is not working correctly and now stops at the Push Edits screen.

Have a great weekend.
ms.maryw
 
Posts: 9
Joined: Fri Jan 21, 2011 4:20 pm

Re: Meditech If...Else...Then

Postby TechSupport on Tue Oct 06, 2015 6:02 am

Hello,

So it seems that this part:
'Click OK
ret=ClickOnBitmap( "C:\Users\wagnerm\Desktop\Box Sync\Wintask\OK.bmp", left, single,
InArea( 1098, 912, 50, 84 ) )
If ret<>0 then
SendKeys("<Enter>")
EndIf
does not send Enter ?
As you have the condition on the return code of ClickonBitmap, it means that the bitmap has not been found.
You can regenerate the bitmap using ClickOnbitmap wizard to be sure that the bitmap is correctly defined, plus you can allow a no 100% accurrate recognition of the bitmap using
#BitmapPrecision=80
Don't put a value less than 80, any place on the screen would be accepted.

For your other questions, I cannot answer without testing the code on the application, especially as it's a Citrix automation, can you connect to http://www.wintask.com/support, with this tool, I can see your desktop and give advice directly.

Best regards.
WinTask Tech Support
TechSupport
 
Posts: 805
Joined: Thu Nov 16, 2006 9:58 am


Return to Getting started

Who is online

Users browsing this forum: No registered users and 2 guests

cron