This has worked extremely well for us. This example is actually going
into MSM to get the preference cards.  It uses Workstation 3.x.  We are
moving from MSM to Meditech's ORM.  We are at this moment using the data
we scraped off in MSM  to script in the preference cards in ORM.  My
technique is probably very primitive, but it works well.  You smart guy
don't laugh.

 

Shirley Hammack

I.T.  Financial Analyst

Duncan Regional Hospital

580-251-8939

 

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Scott Ahlbrandt
Sent: Wednesday, August 20, 2008 1:08 PM
To: [email protected]
Subject: [Talk] Screen Scraping Meditech Magic 5.5

 

Does anyone have a example of a screen scraping script for Meditech
Magic that I can have to learn from?

 

 

 

 

Scott Ahlbrandt MCSA

Patient Accounting Systems Analyst

John C. Lincoln Health Network

250 East Dunlap 

Phoenix, Arizona 85020

602-870-6060 x1286

http://www.jcl.com

 

 

 

 
--------------------
If the reader of this message is not the intended recipient, or the
employee or agent responsible to deliver to the intended recipient, you
are hereby notified that any dissemination, distribution or copying of
this communication is strictly prohibited.  If you have received this
communication in error, please immediately forward the original message
back to the sender and delete your copy of the email.
"CONFIDENTIALITY NOTICE: This e-mail and any files transmitted with it are the 
property of DRH and/or its affiliates, are confidential, and are intended 
solely for the use of the individual or entity to whom this e-mail is 
addressed. If you are not one of the named recipient(s) or otherwise have 
reason to believe that you have received this message in error, please notify 
580.251.8773 and delete this message immediately from your computer. Any other 
use, retention, dissemination, forwarding, printing, or copying of this e-mail 
is strictly prohibited."

<<image001.gif>>

Public Sub GetPreferenceCards()
    Open "C:\BWS DATA\ACTIVE CARDS.TXT" For Input As #1
    Open "c:\bws data\CardData.txt" For Output As #2
    
    MyLiveLogin
    
    Enter "8"
    Pause "Selection@"
    Enter "2"
    Pause "@24,42"
    Enter "29"
    Pause "Selection@"
    Enter "1"
    
    Do While Not EOF(1)
        Pause "Preference Card@"
        Input #1, Mnemonic
        Mnemonic = Trim(Mnemonic)
        Enter Mnemonic
        Stable 0.2
        Surgeon = View(Row:=16, Col:=19, Length:=10)
        Key Chr(141)
        Pause "Defaults?"
        Key Chr(139)
        Pause "Format@"
        Enter "Y"
        Pause "[EMAIL PROTECTED],8"
        FillYMatrix
        
        
        
' Instruments
        Pause "Section@"
        SearchName = "Instruments"
        SearchYMatrix
        If FOUND Then
            Enter SearchNum
            Pause "(S)wap@"
            Enter "E"
            Pause "Title@"
            Enter
            Pause "Pick List@"
            Enter
            Pause "Card@"
            Enter
            Pause "@1,1"
            Wait 0.5
            For x = 1 To 32
                CardFaceI(x) = View(Row:=x, Col:=1, Length:=80)
            Next x
            For x = 32 To 1 Step -1
                LineChecker = CardFaceI(x)
                LineChecker = Trim(LineChecker)
                If Len(LineChecker) > 0 Then
                    LinesI = x
                    Exit For
                End If
                If x = 1 And Len(LineChecker) < 1 Then
                    LinesI = 0
                End If
            Next x
            Key Chr(27)
        Else
            LinesI = 0
        End If
        
'Flash/Steris
        Pause "Section@"
        SearchName = "Flash/Steris"
        SearchYMatrix
        If FOUND Then
            Enter SearchNum
            Pause "(S)wap@"
            Enter "E"
            Pause "Title@"
            Enter
            Pause "Pick List@"
            Enter
            Pause "Card@"
            Enter
            Pause "@1,1"
            Wait 0.5
            For x = 1 To 32
                CardFaceF(x) = View(Row:=x, Col:=1, Length:=80)
            Next x
            For x = 32 To 1 Step -1
                LineChecker = CardFaceF(x)
                LineChecker = Trim(LineChecker)
                If Len(LineChecker) > 0 Then
                    LinesF = x
                    Exit For
                End If
                If x = 1 And Len(LineChecker) < 1 Then
                    LinesF = 0
                End If
            Next x
            Key Chr(27)
        Else
            LinesF = 0
        End If
            
'Equipment
        Pause "Section@"
        SearchName = "Equipment"
        SearchYMatrix
        If FOUND Then
            Enter SearchNum
            Pause "(S)wap@"
            Enter "E"
            Stable 0.3
            If At("Title") Then
                Enter
            End If
            Stable 0.3
            If At("Pick List") Then
                Enter
            End If
            Stable 0.3
            If At("Card") Then
                Enter
            End If
            Stable 0.4
            T$ = View(Row:=3, Col:=2, Length:=9)
            If InStr(T$, "--------") > 0 Then
                Pause "@5,1"
                For x = 5 To 32
                    CardFaceE(x - 4) = View(Row:=x, Col:=1, Length:=80)
                Next x
                For x = 32 To 5 Step -1
                    LineChecker = CardFaceE(x - 4)
                    LineChecker = Trim(LineChecker)
                    If Len(LineChecker) > 0 Then
                        LinesE = x - 4
                        Exit For
                    End If
                    If x = 5 And Len(LineChecker) < 1 Then
                        LinesE = 0
                    End If
                Next x
                GoTo DoneWithEquipment
            End If
            Pause "@1,1"
            Wait 0.5
            For x = 1 To 32
                CardFaceE(x) = View(Row:=x, Col:=1, Length:=80)
            Next x
            For x = 32 To 1 Step -1
                LineChecker = CardFaceE(x)
                LineChecker = Trim(LineChecker)
                If Len(LineChecker) > 0 Then
                    LinesE = x
                    Exit For
                End If
                If x = 1 And Len(LineChecker) < 1 Then
                    LinesE = 0
                End If
            Next x
DoneWithEquipment:
            Key Chr(27)
        Else
            LinesE = 0
        End If
        
        
'Medications
        Pause "Section@"
        SearchName = "Medications"
        SearchYMatrix
        If FOUND Then
            Enter SearchNum
            Pause "(S)wap@"
            Enter "E"
            Stable 0.4
            If At("Title") Then
                Enter
            End If
            Stable 0.4
            If At("Pick List") Then
                Enter
            End If
            Stable 0.5
            If At("Card") Then
                Enter
            End If
            Stable 0.4
            T$ = View(Row:=3, Col:=2, Length:=9)
            If InStr(T$, "--------") > 0 Then
                Pause "@5,1"
                For x = 5 To 32
                    CardFaceM(x - 4) = View(Row:=x, Col:=1, Length:=80)
                Next x
                For x = 32 To 5 Step -1
                    LineChecker = CardFaceM(x - 4)
                    LineChecker = Trim(LineChecker)
                    If Len(LineChecker) > 0 Then
                        LinesM = x - 4
                        Exit For
                    End If
                    If x = 5 And Len(LineChecker) < 1 Then
                        LinesM = 0
                    End If
                Next x
                GoTo DoneWithMedications
            End If
            Pause "@1,1"
            
            Wait 0.5
            For x = 1 To 32
                CardFaceM(x) = View(Row:=x, Col:=1, Length:=80)
            Next x
            For x = 32 To 1 Step -1
                LineChecker = CardFaceM(x)
                LineChecker = Trim(LineChecker)
                If Len(LineChecker) > 0 Then
                    LinesM = x
                    Exit For
                End If
                If x = 1 And Len(LineChecker) < 1 Then
                    LinesM = 0
                End If
            Next x
DoneWithMedications:
            Key Chr(27)
        Else
            LinesM = 0
        End If
        
        
'Prep
        Pause "Section@"
        SearchName = "Prep"
        SearchYMatrix
        If FOUND Then
            Enter SearchNum
            Pause "(S)wap@"
            Enter "E"
            Stable 0.4
            If At("Title") Then
                Enter
            End If
            Stable 0.4
            If At("Pick List") Then
                Enter
            End If
            Stable 0.5
            If At("Card") Then
                Enter
            End If
            Stable 0.4
            T$ = View(Row:=3, Col:=2, Length:=9)
            If InStr(T$, "--------") > 0 Then
                Pause "@5,1"
                For x = 5 To 32
                    CardFaceP(x - 4) = View(Row:=x, Col:=1, Length:=80)
                Next x
                For x = 32 To 5 Step -1
                    LineChecker = CardFaceP(x - 4)
                    LineChecker = Trim(LineChecker)
                    If Len(LineChecker) > 0 Then
                        LinesP = x - 4
                        Exit For
                    End If
                    If x = 5 And Len(LineChecker) < 1 Then
                        LinesP = 0
                    End If
                Next x
                GoTo DoneWithPrep
            End If
            Pause "@1,1"
            Wait 0.5
            For x = 1 To 32
                CardFaceP(x) = View(Row:=x, Col:=1, Length:=80)
            Next x
            For x = 32 To 1 Step -1
                LineChecker = CardFaceP(x)
                LineChecker = Trim(LineChecker)
                If Len(LineChecker) > 0 Then
                    LinesP = x
                    Exit For
                End If
                If x = 1 And Len(LineChecker) < 1 Then
                    LinesP = 0
                End If
            Next x
DoneWithPrep:
            Key Chr(27)
        Else
            LinesP = 0
        End If
        
        
'Draping
        Pause "Section@"
        SearchName = "Draping"
        SearchYMatrix
        If FOUND Then
            Enter SearchNum
            Pause "(S)wap@"
            Enter "E"
            Stable 0.4
            If At("Title") Then
                Enter
            End If
            Stable 0.4
            If At("Pick List") Then
                Enter
            End If
            Stable 0.4
            If At("Card") Then
                Enter
            End If
            Stable 0.4
            T$ = View(Row:=3, Col:=2, Length:=9)
            If InStr(T$, "--------") > 0 Then
                Pause "@5,1"
                For x = 5 To 32
                    CardFaceDp(x - 4) = View(Row:=x, Col:=1, Length:=80)
                Next x
                For x = 32 To 5 Step -1
                    LineChecker = CardFaceDp(x - 4)
                    LineChecker = Trim(LineChecker)
                    If Len(LineChecker) > 0 Then
                        LinesDp = x - 4
                        Exit For
                    End If
                    If x = 5 And Len(LineChecker) < 1 Then
                        LinesDp = 0
                    End If
                Next x
                GoTo DoneWithDraping
            End If
            Pause "@1,1"
            Wait 0.5
            For x = 1 To 32
                CardFaceDp(x) = View(Row:=x, Col:=1, Length:=80)
            Next x
            For x = 32 To 1 Step -1
                LineChecker = CardFaceDp(x)
                LineChecker = Trim(LineChecker)
                If Len(LineChecker) > 0 Then
                    LinesDp = x
                    Exit For
                End If
                If x = 1 And Len(LineChecker) < 1 Then
                    LinesDp = 0
                End If
            Next x
DoneWithDraping:
            Key Chr(27)
        Else
            LinesDp = 0
        End If
        
        
'Dressings
        Pause "Section@"
        SearchName = "Dressings"
        SearchYMatrix
        If FOUND Then
            Enter SearchNum
            Pause "(S)wap@"
            Enter "E"
            Stable 0.4
            If At("Title") Then
                Enter
            End If
            Stable 0.4
            If At("Pick List") Then
                Enter
            End If
            Stable 0.4
            If At("Card") Then
                Enter
            End If
            Stable 0.4
            T$ = View(Row:=3, Col:=2, Length:=9)
            If InStr(T$, "--------") > 0 Then
                Pause "@5,1"
                For x = 5 To 32
                    CardFaceDs(x - 4) = View(Row:=x, Col:=1, Length:=80)
                Next x
                For x = 32 To 5 Step -1
                    LineChecker = CardFaceDs(x - 4)
                    LineChecker = Trim(LineChecker)
                    If Len(LineChecker) > 0 Then
                        LinesDs = x - 4
                        Exit For
                    End If
                    If x = 5 And Len(LineChecker) < 1 Then
                        LinesDs = 0
                    End If
                Next x
                GoTo DoneWithDressing
            End If
            Pause "@1,1"
            Wait 0.5
            For x = 1 To 32
                CardFaceDs(x) = View(Row:=x, Col:=1, Length:=80)
            Next x
            For x = 32 To 1 Step -1
                LineChecker = CardFaceDs(x)
                LineChecker = Trim(LineChecker)
                If Len(LineChecker) > 0 Then
                    LinesDs = x
                    Exit For
                End If
                If x = 1 And Len(LineChecker) < 1 Then
                    LinesDs = 0
                End If
            Next x
DoneWithDressing:
            Key Chr(27)
        Else
            LinesDs = 0
        End If
            
        
        
'Case Notes
        Pause "Section@"
        SearchName = "Case Notes"
        SearchYMatrix
        If FOUND Then
            Enter SearchNum
            Pause "(S)wap@"
            Enter "E"
            Pause "Title@"
            Enter
            Pause "Pick List@"
            Enter
            Pause "Card@"
            Enter
            Pause "@1,1"
            Wait 0.6
            For x = 1 To 32
                CardFaceCN(x) = View(Row:=x, Col:=1, Length:=80)
            Next x
            For x = 32 To 1 Step -1
                LineChecker = CardFaceCN(x)
                LineChecker = Trim(LineChecker)
                If Len(LineChecker) > 0 Then
                    LinesCN = x
                    Exit For
                End If
                If x = 1 And Len(LineChecker) < 1 Then
                    LinesCN = 0
                End If
            Next x
            Key Chr(27)
        Else
            LinesCN = 0
        End If
            
        
        Pause "Section@"
        
        Print #2, Mnemonic & Space(10 - Len(Mnemonic)) & Surgeon & Space(2)
        If LinesI > 0 Then
            For x = 1 To LinesI
                Print #2, Mnemonic & Space(10 - Len(Mnemonic)) & "Instruments " 
& "|" & CardFaceI(x)
            Next x
        End If
        If LinesF > 0 Then
            For x = 1 To LinesF
                Print #2, Mnemonic & Space(10 - Len(Mnemonic)) & "Flash/Steris" 
& "|" & CardFaceF(x)
            Next x
        End If
        If LinesE > 0 Then
            For x = 1 To LinesE
                Print #2, Mnemonic & Space(10 - Len(Mnemonic)) & "Equipment   " 
& "|" & CardFaceE(x)
            Next x
        End If
        If LinesM > 0 Then
            For x = 1 To LinesM
                Print #2, Mnemonic & Space(10 - Len(Mnemonic)) & "Medications " 
& "|" & CardFaceM(x)
            Next x
        End If
        If LinesP > 0 Then
            For x = 1 To LinesP
                Print #2, Mnemonic & Space(10 - Len(Mnemonic)) & "Prep        " 
& "|" & CardFaceP(x)
            Next x
        End If
        If LinesDp > 0 Then
            For x = 1 To LinesDp
                Print #2, Mnemonic & Space(10 - Len(Mnemonic)) & "Draping     " 
& "|" & CardFaceDp(x)
            Next x
        End If
        If LinesDs > 0 Then
            For x = 1 To LinesDs
                Print #2, Mnemonic & Space(10 - Len(Mnemonic)) & "Dressings   " 
& "|" & CardFaceDs(x)
            Next x
        End If
        If LinesCN > 0 Then
            For x = 1 To LinesCN
                Print #2, Mnemonic & Space(10 - Len(Mnemonic)) & "Case Notes  " 
& "|" & CardFaceCN(x)
            Next x
        End If
            
        Key Chr(27)
        Pause "Changes@"
        Enter "Y"
    Loop
    Close #1
    Close #2
    
    
    Pause "Preference Card@"
    Key Chr(27)
    Pause "Selection@"
    Key Chr(27)
    Pause "@24,42"
    Key Chr(27)
    Pause "Selection@"
    Key Chr(27)
    MyLogout

End Sub
Public Sub FillYMatrix()
    For y = 10 To 24
        SecNum = View(Row:=y, Col:=8, Length:=2)
        SecNum = Trim(SecNum)
        SecName = View(Row:=y, Col:=12, Length:=30)
        SecName = Trim(SecName)
        If InStr(SecName, "Case Notes") > 0 Then SecName = "Case Notes"
        YMatrix(y - 9, 1) = SecNum
        YMatrix(y - 9, 2) = SecName
    Next y
        
End Sub
Public Sub SearchYMatrix()
    FOUND = False
    For y = 1 To 15
        If YMatrix(y, 2) = SearchName Then
            FOUND = True
            SearchNum = y
            Exit For
        End If
    Next y
End Sub

Reply via email to