Ruby Script API or documentation

Hello,
can I use the full scope of ruby in the UI-Designer?
If not, is there any documentation of functionality (create new associations...etc.)?
Best regards,
Andreas

Hi,
the Ruby used in scripting ("SAP Ruby") is NOT a complete implementation of Ruby. It is just a scripting language with a syntax similar to Ruby.
Documentation of the UI designer and scripting is planned for FP2.6 but is not yet available.
For the time being we have some How tos in the following Wiki page 
[https://www.sme.sap.com/irj/sme/community/collaboration/wiki?path=/display/AMI/BestPracticefor+Implementations]
to show some working examples. If an example is missing, please let us know. We will then enhance the collection.
Regards,
Thomas
Backoffice Early Partner Program

Similar Messages

  • Scripting API overview?

    I've been looking throught the new scripting API included in 1.6 and am excited about it. I've been using BeanShell in one of my programs for a while, and would like to make it compliant with this new standard. However, there isn't a lot of documentation about this new API. Can anyone point me to an overview? Or am I pretty much figuring it out form the javadoc?
    Mark McKay

    Not forcibly the best for this purpose but still something:
    http://jcp.org/en/jsr/detail?id=223

  • Java 6 Scripting API vs Rhino

    Apologies if this isn't the right place for this question, but I can't see a more appropriate forum.
    I have some classes that use the Mozilla Rhino API for invoking javascript, and I was planning to upgrade this to use the new javax.script classes in Java 6. However, there's one particular feature that seems to be missing.
    In Rhino, you invoke JS functions through the Function class (See http://www.mozilla.org/rhino/apidocs/org/mozilla/javascript/Function.html). This has a method construct() which invokes a JS function that has been implemented as a constructor, and returns the new JS object.
    I can't find an equivalent method in the javax.script API. Am I missing something? Or was this feature deliberately left out because the new API is designed to be more general purpose, and support langauges that don't have constructors?
    Thanks,
    Alasdair

    If it was me I wouldn't get all excited just because it seems like the java API implements something that previously required a third party library.
    I know that when initially the logging api showed up I thought log4j would never be needed again. That was until I actually looked at what the logging api provided. It wasn't close. So sticking with log4j was and still is by far the better choice.
    Besides the actual API you might also note that as the first version that it is more likely to have bugs than a third party library that has been around for a while.

  • Problems with Java Scripting API

    Hello Everyone!
    Guys, I need help with Java scripting API. A problem is that I cannot understand how can I operate Java Object's fields and methods from the script language. I have chosen embedded javascript to work with. And I can get the fields and methods of in-box java classes (such as ArrayList for example), but I cannot work with methods and fields from my own classes!
    Here is an example:
    public class ScriptingExample {  
        class MyClass {  
            int myfield = 5;  
            int getInt() {return 7;}  
        public void runExample() {  
            ScriptEngineManager mgr = new ScriptEngineManager();  
            List<ScriptEngineFactory> factories = mgr.getEngineFactories();  
            ScriptEngineManager factory = new ScriptEngineManager();  
            ScriptEngine engine = factory.getEngineByName("JavaScript");  
            MyClass mc = new MyClass();  
            try{  
                engine.put("mc", mc);  
                engine.eval("print(mc.myfield); print(mc.getInt())"); // or engine.eval("print(mc.myfield)");
            } catch (Exception e) {e.printStackTrace();}  
    }  If I run the code with the commented part it prints "undefined" instead of "5".
    If I run the code as it is it prints error instead of "7":
    undefinedjavax.script.ScriptException: sun.org.mozilla.javascript.internal.EcmaError: TypeError: Cannot find function getInt. (<Unknown source>#1) in <Unknown source> at line number 1
    at com.sun.script.javascript.RhinoScriptEngine.eval(Unknown Source)
    at com.sun.script.javascript.RhinoScriptEngine.eval(Unknown Source)
    at javax.script.AbstractScriptEngine.eval(Unknown Source)
    at solutiondatabase.ScriptingExample.runExample(ScriptingExample.java:26)
    at solutiondatabase.Main.main(Main.java:49)
    How can I fix it?

    Guys,
    please let me raise this topic because several new questions emerged.
    (1) How can I get all the variables created inside my engine?
    There are two kinds of variables: first kind is Java obejcts put inside the engine and second kind is the variables created in my script, such as 'var a = 4;'. How can I list all the variables of that two kinds?
    (2) Is there is a way to make 'import static' to the engine? I dont want to write MyClass.MyEnum.MyEnumItem every time. Also, I cannot put the whole enum into the engine with engine.put("MyEnum", MyEnum); I can put only enum items separately: engine.put("MyEnum", MyEnum.EnumItemA);. Thats why I ask about static import.
    (3) How can I cast engine variables back to java variables inside my java code?
    Here is my example:
    package mypackage;
    import java.util.ArrayList;
    import java.util.List;
    import javax.script.ScriptEngine;
    import javax.script.ScriptEngineFactory;
    import javax.script.ScriptEngineManager;
    public class Main
         public static void main(String[] args) throws Exception 
              ScriptEngineManager mgr = new ScriptEngineManager();
              List<ScriptEngineFactory> factories = mgr.getEngineFactories();
              ScriptEngineManager factory = new ScriptEngineManager();
              ScriptEngine engine = factory.getEngineByName("JavaScript");
              ArrayList<Double> myList = new ArrayList<Double>();
              myList.add(5.0);                    
              engine.put("MyList", myList);     
              engine.eval("MyVar = MyList.get(0);");
              System.out.println((Double)engine.get("MyVar"));
    }The result is:
    Exception in thread "main" java.lang.ClassCastException: sun.org.mozilla.javascript.internal.NativeJavaObject cannot be cast to java.lang.Double
    +     at mypackage.Main.main(Main.java:28)+
    Is it possible to retrieve my Double java object from the engine?
    Edited by: Dmitry_MSK on Aug 6, 2010 1:56 AM

  • How to download JSF1.2 API and Documentation ?

    How to download JSF1.2 API and documentations to reference when we are in offline?
    Thanks
    Joe

    Just download Sun JSF 1.2? Unzip it and you'll find the API doc in /javadocs and the TLD doc in /tlddocs.
    http://javaserverfaces.deva.java.net

  • Scripting API: Com exception when calling Session.Record

    Hi,
    I'm communicating with SAP Scripting API Com-Object from my Net application.
    When the Scripting events are disable in server side (by setting sapgui/user_scripting_disable_recording=TRUE in the server profile see Note 692245) ans i try to set the GuiSession.Record property to true i recieve a COM exception.
    System.Runtime.InteropServices.COMException (0x80010105): The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT))
    at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
    at SAPFEWSELib.ISapSessionTarget.set_Record(Boolean )
    My question is - is this is the expected behavior? (I wouldn't expect exception when mode is disabled).
    Thanks,
    Dror.

    The problem is: i don't know how to check for the HTTP-Header, because
    my call
    <i>SOAPOutPayload = accessor.call(payload);</i>
    throws the mentioned exception, even though it works behind the scene.
    Is it possible to check for the HTTP-Response-Code in the catch block?
    We want to avoid an synchronous scenario because we don't need the result and the WebService is rather slow.

  • Ruby Script as FCS response

    I want to execute a ruby script as a FCS response attached with a poll watcher. But it is throwing following error again and again,
    response Asset MOS Registration script triggered by Watcher New Asset Watcher failed
    response failed to run command ruby /usr/local/bin/hw.rb with arguments { geobit }
    ERROR: E_COM
    Comnmand exited with status 1
    How can I execute a ruby script as FCS response. Please help?
    http://pk.linkedin.com/in/subhanmughal
    http://subhan-mughal.blogspot.com/

    There is nothing magical you need to do to call a Ruby script from FCSvr - it runs as any other command line script does.
    Make sure you are escaping the command line arguments properly, that the fcsvr process calling it has permissions to access the areas you may call in your script, and that paths are also set appropriately.

  • Ruby scripts & launchd

    I have writting a ruby script for use by launchd. The script runs fine on it on without launchd and been tested several times on several items. However, when loaded by launchd it gives an error and exits. Here is the launchd plist:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    <key>Label</key>
    <string>com.avicenna.webloc2url</string>
    <key>LowPriorityIO</key>
    <true/>
    <key>Program</key>
    <string>/Users/avicenna/Library/Scripts/webloc2url.rb</string>
    <key>ProgramArguments</key>
    <array>
    <string>webloc2url.rb</string>
    </array>
    <key>WatchPaths</key>
    <array>
    <string>/Users/avicenna/Downloads/Bookmarks</string>
    </array>
    </dict>
    </plist>
    and here is the syslog error:
    Nov 26 15:35:13 avicenna com. avicenna.webloc2url[17236]: nil
    Nov 26 15:35:38 avicenna com. avicenna.webloc2url[17243]: /Users/avicenna/Library/Scripts/webloc2url.rb:10
    Nov 26 15:35:38 avicenna com. avicenna.webloc2url[17243]: : private method `sub!' called for nil:NilClass (NoMethodError)
    Nov 26 15:35:38 avicenna com. avicenna.webloc2url[17243]: from /Users/avicenna/Library/Scripts/webloc2url.rb:4:in `each'
    Nov 26 15:35:38 avicenna com. avicenna.webloc2url[17243]: from /Users/avicenna/Library/Scripts/webloc2url.rb:4
    Nov 26 15:35:38 avicenna com. avicenna.webloc2url[17243]: nil
    Nov 26 15:35:38 avicenna com.apple.launchd[132] (com. avicenna.webloc2url[17243]): Exited with exit code: 1
    regarding the error:
    private method `sub!' called for nil:NilClass (NoMethodError)
    the stand alone script never complains about such an error, actually it does the substitution and prints what is expected. In fact, the script does the job well. So, this makes me think that there might be some limitation on the execution of ruby scripts by launchd? Or maybe the parameters I've put in the plist file are not correct or missing something?
    Any kind of help or hint would be appreciated.
    Thanks.

    jarik, thanks and sorry if I bothered you. I have made little changes in the script and I don't see any complains in the system.log anymore. Here is the script with the changes:
    #!/usr/bin/env ruby
    Dir.chdir("/Users/avicenna/Downloads/Bookmarks")
    d = Dir.new("/Users/avicenna/Downloads/Bookmarks/")
    d.each do |x|
    if x =~ /webloc/
    y = `strings '#{x}'/..namedfork/rsrc`.chomp.detect { |v| v =~ /http/ }
    webloc = File.open("#{x}", 'r+')
    webloc.puts "[InternetShortcut]\nURL" + y.sub!(/^./, '=')
    #puts y
    webloc.close
    oldFile = x
    newFile = x.sub(/webloc/, 'url')
    File.rename(oldFile, newFile)
    end
    end
    I've added the .chomp as you can notice and the substitution changed to '=' from the preceeding string instead of an empty ''. I hope this will fix it for good. And I don't know exactly what did that change anyway for launchd!
    Thanks again.

  • Thought I would share: Ruby script to control USB dart launchers

    Been hacking away at this for a bit and I'm calling this good for now   This script controls USB dart launchers like this guy:
    0a81:0701 Chesen Electronics Corp. USB Missile Launcher
    At the moment, it's coded to only control the above, but add your idVendor, idProduct, and movement codes to the ActionData hash and it should pick right up and work.
    Requires the libusb and curses gems.  Codepad: http://codepad.org/v9h3ziYw
    Enjoy!
    #!/usr/bin/env ruby
    Version = '0.1'
    abort("Usage: #{__FILE__} idVendor:idProduct") if ARGV.empty?
    require 'curses'
    require 'libusb'
    # Add your own idVendor, idProduct, and movement codes here!
    ActionData = {
    :idVendor => 0x0a81,
    :idProduct => 0x0701
    } => {
    :up => 0x02,
    :down => 0x01,
    :left => 0x04,
    :right => 0x08,
    :fire => 0x10,
    :stop => 0x20,
    class RocketLauncher
    attr_accessor :device
    def move(symbol)
    @usb.control_transfer(
    :bmRequestType => 0x21,
    :bRequest => 0x09,
    :wValue => 0x0000,
    :wIndex => 0x0000,
    :dataOut => ActionData[{
    :idVendor => device[:idVendor],
    :idProduct => device[:idProduct]
    }][symbol].chr
    end
    def start
    begin
    @usb = LIBUSB::Context.new.devices(
    :idVendor => device[:idVendor],
    :idProduct => device[:idProduct]
    ).first.open.claim_interface(0)
    rescue LIBUSB::ERROR_ACCESS
    abort("No permission to access USB device!")
    rescue LIBUSB::ERROR_BUSY
    abort("The USB device is busy!")
    rescue NoMethodError
    abort("Could not find USB device!")
    end
    Curses.noecho
    Curses.init_screen
    Curses.stdscr.keypad(true)
    Curses.timeout = 150
    Curses.addstr("USB Rocket Launcher Controller v#{Version} by Maxwell Pray")
    loop do
    Curses.setpos(2,0)
    case Curses.getch
    when Curses::Key::UP, 'w', 'W'
    Curses.addstr("Movement: Up!")
    self.move(:up)
    when Curses::Key::DOWN, 's', 'S'
    Curses.addstr("Movement: Down!")
    self.move(:down)
    when Curses::Key::LEFT, 'a', 'A'
    Curses.addstr("Movement: Left!")
    self.move(:left)
    when Curses::Key::RIGHT, 'd', 'D'
    Curses.addstr("Movement: Right!")
    self.move(:right)
    when Curses::Key::ENTER, 10, ' '
    Curses.addstr("Movement: Fire!")
    self.move(:fire)
    when 27, 'q', 'Q'
    exit
    else
    Curses.addstr("Waiting for key...")
    self.move(:stop)
    end
    Curses.clrtoeol
    end
    end
    end
    launcher = RocketLauncher.new
    device = ARGV[0].split(':').map { |id| id.to_i(base=16) }
    launcher.device = {
    :idVendor => device[0],
    :idProduct => device[1]
    launcher.start

    problem fixed with method
    detach_kernel_driver
    thx ^^
    but now there is no FIRE action with enter Action is active, but:
    :fire  => 0x10
    does nothing.
    Where i can find any info about this? Maybe it must be another for my device?

  • Scripting.encoder object documentation

    Greetings,
        I need to encode a vbscript (actually in a HTA). Someone has srcenc but it only runs on win xp.
       I have found a script which does the encoding which uses the "Scripting.encoder" object that works fine on windows 7.
       However, I cannot find any documentation on the properties and methods of this object. Does it exist anywhere?
    Thanks
    David Z

    Sorry all of these things are obsolete.
    In case you missed it,  this is the 21st century.
    ¯\_(ツ)_/¯
    and sarcasm is still the lowest form of wit....
    Funny how that object can still be used in Windows 8.1 Update 1.
    It is still the 21st century and HTAs are obsolete which is why you cannot easily fid documentation.
    What script ing options might there be?  How about the name of one of the script languages installed.  Perhaps "vbscript" or "jscript".
    In  way I was trying to shy you away from trying to use this as it does not work well on Vista and later systems. It has never worked correctly for HTAs.
    There are many third party tools which can obfuscate a script.  Look into these.
    Here is one obsolete blog on the encode:
    http://blogs.technet.com/b/heyscriptingguy/archive/2006/03/09/how-can-i-encode-scripts-within-an-hta.aspx
    The encoder control does not work well with HTAs.  Try it.  You will see that it fails in strange ways.
    Microsoft has not supported this control for almost 10 years.  Now that XP is gone it will disappear.  It currently will not workon mist implementations of Windows 8.1 and 2012.
    I first warned people about this control back in 2006.  The same people are now coming back wanting fixes that do not exists.
    Use PowerShell or XAML for GUIs.  They are not likely to be an issue fro the next few years.
    If you search for information ou will find that the information was pulled by Microsoft in about 2003.  No one should be attempting to use this control anymore and it has been included only for compatibility with no support.  If it work OK. 
    If not - too bad.
    The arguments are simple:
    Set se = CreateObject("Scripting.Encoder")
    se.EncodeScriptFile(strExt,byte_stream,cFlags,bstrDefaultLang)
    cFlags is 0 for all but "ASP"
    bstrDefaultLang is not needed
    strExt is the file extension for the language which is either "vbs". "js", "asp" or the extension of any installed scripting languages that support the  encoder.
    Search and you will find many examples along with discussions on the failures and some fixes.  You will see dozens of answers from me back to at least 2003.  I started using the script encode and control in about 1995 when it was first distributed
    with Visual Studio.  I still have the CDs with the SDK.  I will sell them to you if you really want documentation.  I will not even attempt to find the docs in that stack of about 30 CDs.
    Take my advice please.  Do not use obsolete software.  If you really want to I have licensed copies of Windows ME that you can have.  I even have an old TRS 80 - do you want to buy that?
    ¯\_(ツ)_/¯

  • Editing movie from script (API)

    Hi,
    I would like to know if there is an option to edit a clip by a pre-defined script, using premiere pro (i.e API).
    If not - do you know other options rather than premiere pro?
    Thanks,
    Roy Oron

    using premiere pro (i.e API).
    Thankfully, no.  Otherwise editing as a skilled and artistic profession would soon become obsolete.
    However, you can do it using TET (Traditional Editing Techniques).

  • [solved] ruby script do not work (in arch)

    Hi!
    I want to change my csv blinklist exported data to a html bookmarks format (to import it to delicious)
    I installed ruby, and used this script: http://rubenlaguna.com/wp/2010/01/03/mi … v-to-html/
    but it shows this error:
    $ ruby change.rub
    /usr/lib/ruby/1.9.1/csv.rb:1329:in `initialize': can't convert String into Integer (TypeError)
            from /usr/lib/ruby/1.9.1/csv.rb:1329:in `open'
            from /usr/lib/ruby/1.9.1/csv.rb:1329:in `open'
            from change.rub:18:in `block in <main>'
            from change.rub:6:in `open'
            from change.rub:6:in `<main>'
    the csv file looks like this:
    http://pastebin.ca/1737483
    any idea what is wrong?
    friends, that do not uses arch, tested it and it worked in their machines...
    Last edited by luuuciano (2010-01-04 19:15:35)

    Hi, the problem is that Arch Linux uses the newer Ruby 1.9.x version which is incompatible with that script. I have tried to fix the script for you, it seems to work but I don't even know what delicious is so you'll have to just try it and see
    http://pastebin.ca/1737706

  • OnCommand Unified Manager 6.1 and 6.2 API's Documentation

    One can use the APIs of OnCommand Unified Manager to develop third-party applications to monitor and manage NetApp storage systems. Also be used to manage and monitor storage systems by using the advanced functionality provided by the APIs of the applications included in the OnCommand Unified Manager server. The following table lists common management tasks and the corresponding API set that you can use:Tasks to be performedWhat to useStorage system health monitoringOnCommand APIsData protectionProtection capability APIsCommand-line tasks not covered by any other APIssh, rsh or telnet API classificationThis section provides guidelines on how to use the APIs for various operations related to the Unified Manager server and its components.The Unified Manager API’s are broadly classified into the following categories:Unified Manager APIsProtection capability APIsLaunch SDK_help.htm to get started with the OnCommand API Documentation.

    Do you have the API documentation for OCUM 6.3 (which is in RC at the moment)?

  • SAP GUI Scripting API is Disabled in the Server

    Hi,
    I used VB script to upload data into SAP, but in few SAP server scripting is disabled in the server so my codes are not working to upload data.
    Is there any alternative for this other than TX shuttle.
    Is there any HP software to load data to SAP, since i work in hp it will nice to get hp software.
    Thank you so much for your help!
    Reagrds
    Victor

    Hi,
    Follow this linke.
    http://www.synactive.de/download/sap%20gui%20scripting/sap%20gui%20scripting%20security%20settings.pdf
    Thanks
    Yusuf Hamdy

  • AddressBook API or documentation buggy?

    I started a simple utility application using Address Book api. I load the contacts from network and I was able to create person records and add to address book, but
    1. ABAddressBookHasUnsavedChanges returns false after all these
    2. I call ABAddressBookSave to save the new records.
    3. the built-in address book does not show any of the records added by my application, but the new records are searchable from that application.
    For 1), is that a bug? why does it return false even though i added 10+ records to it?
    For 3), why is new data searchable but not displayed in the default contacts app? is it because I have not set some important attributes of the records?
    thanks for any ideas on these.
    Wayne
    What could be wrong?
    Thanks,
    Wayne

    I have the same exact problem with ABAddresBookHasUnsavedChanges and can't seem to get the address book to save. Here is a link the the post I made that went unanswered thus far: http://discussions.apple.com/thread.jspa?threadID=1579184&tstart=0

Maybe you are looking for