5 Replies Latest reply on Nov 14, 2017 9:57 AM by hebgent

    Automate Snapshot in middle of run.

    hebgent

      I have a long method (60min) and would like to automate a snapshot and report at 15 minutes but continue the full 60 minute run and generate a report at the end of the run.  Can this be done or does anyone know of a better way to achieve this.

      Thanks

        • Re: Automate Snapshot in middle of run.
          valentinrusu
          Hello, I see there haven’t been any replies yet. It might help to post the type of software you have, and, equally importantly, its revision, most commonly found under Help (or a question mark icon) > About. 


            • Re: Automate Snapshot in middle of run.
              hebgent

              I'm using Openlab Rev C.01.05 [35], controlling a 6850.

               

              I've got it down to a 2 step process.

              1. I run the sample in the online mode.

              2. I run the user macro below in the offline mode.

                   SLEEP 900

                   OFFLINESNAPSHOT

                   OFFLINEDA_DOREPORT _METHPATH$, _METHFILE$, DADATAPATH$, DADATAFILE$

               

              Not the most elegant procedure but it works.

              I can't use the sleep command as a prerun macro because it halts all execution.

              I could use the shellexecute command to run a windows script to wait and then open the offline mode, snapshot, calculate and print a report but I'm not sure if I can execute a user macro in offline from a windows script.

              Any better ideas would be appreciated.

              Thanks

            • Re: Automate Snapshot in middle of run.
              hebgent

              After looking around a bit I decided to use DDE since openlab supports both as client and server. Below is what I've come up with.

              2 Macros: 1 is set as a prerun command in the method.  It checks is the offline is open and if not opens it.

              Then is sets up a DDE channel to the offline module and executes the macro in the offline module.

              The offline module waits the 900 seconds (15 minutes) takes a snapshot and uses the OfflineDA_DoReport macro to print the results.

              Then the offline closes itself.

              It's working in Openlab Rev C.01.05 [35] but also tested with Chemstation B.04.03 and the OfflineDA_DoReport command sometimes does not work. I'm unsure as to why that is.

              If anyone sees a problem with the code or a better/easier way to accomplish this don't hesitate to post.

              NAME    OnlineAutoSnapshot

               

                  IF IsOfflineRunning() = 0 THEN

                      ShellExecute "C:\GC28Offline.cmd"

                      Sleep 15

                  ENDIF

                  AppName$ = PrivateProfileString$("PCS,4", "_DDEOffLine", "C:\Windows\Chemstation.ini")

                  Channel = DDEInitiate (AppName$, "CPNOWAIT")

                  DDEExecute Channel, "OfflineAutoSnapshot"  

                  Sleep 2

                  DDETerminate Channel

              ENDMACRO

               

              NAME    OfflineAutoSnapshot

                  Sleep 900

                  OfflineSnapshot

                  OfflineDA_DoReport _METHPATH$, _METHFILE$, DADATAPATH$, DADATAFILE$

                  BYE

              ENDMACRO

              • Re: Automate Snapshot in middle of run.
                hebgent

                Here is what I finally settled on.  It works well enough for what I need it for. Tested on Chemstation B.04.03 & OpenLab C.01.05

                 

                NAME    OnlineAutoSnapshot

                    WHILE ACQSTATUS$ = "NOTREADY"

                        SLEEP 15

                    ENDWHILE

                 

                    IF IsOfflineRunning() = 0 THEN

                        ShellExecute "C:\GC24OFFLINE.cmd"

                        Sleep 15

                    ENDIF

                 

                    AppName$ = PrivateProfileString$("PCS,4", "_DDEOffLine", "C:\Windows\Chemstation.ini")

                    Channel = DDEInitiate (AppName$, "CPNOWAIT")

                    DDEExecute Channel, "OfflineAutoSnapshot"  

                    Sleep 2

                    DDETerminate Channel

                ENDMACRO

                 

                NAME    OfflineAutoSnapshot

                    SLEEP 120    !----INJECTION CYCLE

                    Sleep 900    !----15 minutes

                    OfflineSnapshot

                    SLEEP 10

                    MenuQuantify

                ENDMACRO

                • Re: Automate Snapshot in middle of run.
                  hebgent

                  There was 1 problem with the code I posted.  Because the offline macro was running in the same Cp as the offline instrument when it was waiting using the  Sleep command the user loses all control of the instrument.  The fix is to run the macro in a different Cp.  So changing ...

                  DDEExecute Channel, "OfflineAutoSnapshot"

                  to

                  DDEExecute Channel, "CpRequest AUTOSNAPSHOTPROCESS, OfflineAutoSnapshot"

                  and starting the process when the instrument is loaded or in a separate macro will fix this.

                   

                  I also added the code below to double check that the correct method is loaded.

                   

                  IF _methfile$ <> "METHODNAME.M" THEN

                          LoadMethod _methpath$,"METHODNAME.M"

                          SLEEP 5

                    ENDIF

                   

                  Attached is the last version assuming I find no other problems.