Pass data between AutoPlay applications

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Desmond
    Indigo Rose Staff Member
    • Jul 2003
    • 710

    Pass data between AutoPlay applications

    Introduction:
    Occasionally I'm asked how to pass data between AutoPlay applications, or if it is even possible. The easiest way to do this is as follows.

    You will create two applications with the following settings/specifications:

    Application 1:
    This application will have a multi-line input object that the user will type in. Every time a key is pressed within this input object, the on key event will fire.

    Step 1:
    Create a multi-line input object

    Step 2:
    Place the following script on the on-key event of this input object:
    sText = Input.GetText("Input1");
    Registry.SetValue(HKEY_CURRENT_USER, "Software\\Temp_Comm_Local", "Value1", sText, REG_SZ);

    Step 3:
    Place the following code on the On Startup event of your project to clear out any existing value (just in case):
    Registry.SetValue(HKEY_CURRENT_USER, "Software\\Temp_Comm_Local", "Value1", "", REG_SZ);

    Step 4:
    Place the following code on the On Shutdown event of your project, to keep the registry clear:
    Registry.DeleteKey(HKEY_CURRENT_USER, "Software\\Temp_Comm_Local");



    Application 2:
    This application will have a paragraph object that will fill automatically with the text typed in the input object of project 1.

    Step 1:
    Create a paragraph object

    Step 2:
    Place the following script on the On Show event of the page:
    Page.StartTimer(1000);

    Step 3:
    Place the following script on the On Timer event of the page:
    sValue = Registry.GetValue(HKEY_CURRENT_USER, "Software\\Temp_Comm_Local", "Value1", true);
    Paragraph.SetText("Paragraph1", sValue);




    Expected Result:
    Whenever something is typed in the input object in application 1, it will appear one second later in the paragraph object of application 2. You can use this technique to pass any type of value between two autoplay applications.
    Attached Files
  • Stefan_M
    Indigo Rose Customer
    • Nov 2003
    • 315

    #2
    Another way is the Clipboard plugin.

    First Application copies the info to the Clipboard.

    Second Application scans the Clipboard.
    On Show
    Code:
    Page.StartTimer(1000);
    On Timer
    Code:
    --looks if text is available
    result = Clipboard.IsTextAvailable();
    if result then
    --read the text
    newtext = Clipboard.GetText();
      if String.Find(newtext, "from APMS5", 1, false)~=-1 then
      --only if the the text is from app1 write it to the input object
        newtext = String.Replace(newtext, "from APMS5", "", false);
        Input.SetText("Input1", newtext);
        --clear Clipboard
        Clipboard.CopyText("");
      end;
    end;
    Stefan_M
    Attached Files
    "With a rubber duck, one's never alone."

    Douglas Adams, The Hitchhiker's Guide to the Galaxy

    Comment

    • Intrigued
      Indigo Rose Customer
      • Dec 2003
      • 6138

      #3
      Originally posted by Stefan_M
      Another way is the Clipboard plugin.

      First Application copies the info to the Clipboard.

      Second Application scans the Clipboard.
      On Show
      Code:
      Page.StartTimer(1000);
      On Timer
      Code:
      --looks if text is available
      result = Clipboard.IsTextAvailable();
      if result then
      --read the text
      newtext = Clipboard.GetText();
        if String.Find(newtext, "from APMS5", 1, false)~=-1 then
        --only if the the text is from app1 write it to the input object
          newtext = String.Replace(newtext, "from APMS5", "", false);
          Input.SetText("Input1", newtext);
          --clear Clipboard
          Clipboard.CopyText("");
        end;
      end;
      Stefan_M
      The major problem I see with this solution is that there is a chance that the Clipboard data will be changed before the second AMS application can get at the other AMS application's sent (to the Clipboard) data.
      Intrigued

      Comment

      • Corey
        Indigo Rose Staff Alumni
        • Aug 2002
        • 9745

        #4
        I think my clipboard is protected by my antivirus or something... I can use my clipboard as normal but whenever a script tries to use it, something blocks it. That's why I don't rely on the clipboard plug-in in my projects. :yes

        Comment

        • yosik
          Indigo Rose Customer
          • Jun 2002
          • 1858

          #5
          I would add an action on closing the app to erase the registry entries.
          Good form, you know...

          Yossi

          Comment

          • Desmond
            Indigo Rose Staff Member
            • Jul 2003
            • 710

            #6
            Very true. Go online collaboration!

            Comment

            • bule
              Indigo Rose Customer
              • May 2005
              • 1116

              #7
              Registry is a better solution than clipboard plugin.
              Never know what life is gonna throw at you. ZubTech

              Comment

              • eric_darling
                Indigo Rose Customer
                • Jun 2002
                • 1805

                #8
                Actually, someone has pointed out before that not every computer will have access to the Registry (some overly cautious IS departments lock 3rd party apps from this luxury). So, perhaps writing and reading from a basic .txt file on the hard drive would be a best practice for sharing data between apps.
                Eric Darling
                eThree Media
                http://www.ethreemedia.com

                Comment

                • Corey
                  Indigo Rose Staff Alumni
                  • Aug 2002
                  • 9745

                  #9
                  I tend to use .txt files personally, so I agree, for many scenarios that's often the easiest way to go. :yes

                  Comment

                  • Jonas DK
                    Indigo Rose Customer
                    • Jul 2004
                    • 345

                    #10
                    what if it's a kind of teacher student envirement?

                    I have long had an Idea of building a teaching center that uses this precie feature. But I never could get it started.

                    The thing is I want to use 2 applications
                    Application 1 : The student
                    Application 2 : Teacher

                    The thing is that you can have multipel student at the same time.
                    for exampel doing math like a quiz on the student panel.

                    The student will have to put in there name before they can start, AMS then creates a text file with the students name then every student have a unique file for them. then when ever they answer a question the ansver is saved to the file.

                    In the teacher app. the teacher gets a list of all the students that are doing there program (a directory read into a table and listed) When he clicks on a students name he can then se what the question was and what the student answered.

                    Now here is the tricky part
                    The teacher then have the abillety to tick off the questions that are corrept or write notes to the student on where they went wrong. and grading the the test.

                    In the student application there should be a function to load old tests and then see the teachers notes.

                    It is a bit tricky but it must be posible to do you can create, read and write the txt files in your AMS app. and you can even have the app put the files in a special folder on a network drive that the students dont have access to but the app has permissions.

                    so I'm thinking this is duable but how!!!

                    I'm lost...

                    Comment

                    Working...
                    X