How to save trace content or data content to .xml

  • Hi, Sorry for this very old question, (never answered?) :

    In this case, for example:

    trace(anything);

    How to make or update a file called "mytest.xml" with the text "anything" (or another created from krpano code) ?

    Thanks, greets,
    Fdo

    3 Mal editiert, zuletzt von Fernando (9. September 2018 um 15:40)

  • Hi,

    the krpano viewer is 'client-side-only' without any server-side-application.

    That means the viewer is only Javascript that runs in the browser of the user and only downloads files from there.

    For uploading on the other side a server-interface would be required that would receive and store the files.
    Implementing such is possible of course, but that's not part of krpano itself.

    Best regards,
    Klaus

  • Thanks very much Klaus, the idea was for offline use only. I would like a new krpano action for at least perform a copy to clipboard action from log window content. But this isnot entirely necessary:

    There a powerfull and free software for windows called "Autohotkey" that it can program key actions: paste, save... I used this software for easy the coding (programming key with actions...) and I´am almost sure that create any file and save it is possible.

    The idea is to program keys with "Autohotkey" for automate creation of .xml file:
    for example CTR+H for copy the krpano logwindow content into clipboard, open for example myhs.xml, paste the content and save the file.

    The main.xml of my project include myhs.xml...

    Greets,
    Fernando

    3 Mal editiert, zuletzt von Fernando (12. September 2018 um 14:26)

  • Hi,

    here a simple <action> that would copy any text to the clipboard:

    Code
    <action name="log_to_clipboard" type="Javascript"><![CDATA[
      var el = document.createElement('textarea');
      el.value = args[1];
      document.body.appendChild(el);
      el.select();
      document.execCommand('copy');
      document.body.removeChild(el);
    ]]></action>

    But due security restriction an 'user-interaction' would be necessary when calling this - e.g. by clicking a button:

    Code
    <layer name="testbutton" keep="true"
      type="text" padding="4 8" bgroundedge="1" bgshadow="0 1 4 0x000000 1"
      ondown="set(bgcolor, 0xDDDDDD);" onup="set(bgcolor, 0xFFFFFF);"
      html="Click to copy to clipboard" 
      align="center"
      onclick="log_to_clipboard('hello to clipboard from krpano...');"
      />

    Best regards,
    Klaus

  • Hi,

    here a simple that would copy any text to the clipboard:

    Code

    But due security restriction an 'user-interaction' would be necessary when calling this - e.g. by clicking a button:

    Code
    <layer name="testbutton" keep="true" 
      type="text" padding="4 8" bgroundedge="1" bgshadow="0 1 4 0x000000 1"
      ondown="set(bgcolor, 0xDDDDDD);" onup="set(bgcolor, 0xFFFFFF);"
      html="Click to copy to clipboard" 
      align="center"
      onclick="log_to_clipboard('hello to clipboard from krpano...');"
      />

    Best regards,
    Klaus</action>

    Hi Klaus,
    i've used your code and it worked but only for text. I tried to copy the value of a variable to the clipboard but could solve it. I fact I wanted to copy two variables.

    I get the toh and tov from the Mouse by clicking the button 1 and with clicking the button 2 I would like to copy the values.

    Here is the example

    <action name="keydown-bed">
    trace(keydown - keycode=,keycode);
    if (keycode == 49, addhotspot(newspot);
    set(hotspot[newspot].url,%FIRSTXML%spot.png);
    set(hotspot[newspot].ath,get(toh));
    set(hotspot[newspot].atv,get(tov));
    set(hotspot[newspot].scale,0.07);
    set(hotspot[newspot].zoom,true););
    if (keycode == 50, log_to_clipboard);
    </action>


    Thanks a lot
    Maxi

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!