Scripting Context - Does not work as invocable?

Hi
I am using the Java Scripting implementation, in my case Rhino, and actually I am very happy with it. Nearly everything runs as expected. But there is one thing regarding Context per Script, actually bindings because of variables per script.
I had a look at http://java.sun.com/javase/6/docs/technotes/guides/scripting/programmer_guide/index.html#scopes and if I do it like that everything works fine. Now, I have a script with several functions and I want to invoke specific functions. Again I take that example and extend it to something like:
engine.eval("function printSomething() {println(x);}", newContext);
In my "small world^^'" this should do the same, but I have to invoke printSomething:
Invocable inv = (Invocable)engine;
inv.invokeFunction("printSomething");
If I do so, I get a
java.lang.NoSuchMethodException: no such method: printSomething
What am I getting wrong? I want to do the same as in the example, provide another Script with another Context (specifically Bindings), but as soon as I invoke the function, it says the function is not available even if it is very much visible.
If I remove the
newContext
from
eval()
it works, but does not have the other Binding.
How can I make that happen?
I hope this is the right forum and someone can "light me up" where I just see darkness right now.
Many thanks in advance

Your script needs something from the default context.
When you create a new context it will not work anymore.
Just get hold of the original context (or a copy of it) and add your bindings
and pass that.
Something like [http://forums.sun.com/thread.jspa?messageID=10978511#10978511]

Similar Messages

  • Color Context does not work properly

    Hi,
    I'm using MII 12.1
    ColorContext does not work properly with Lights and Multilights. I did not test other grids.
    For every match it shows black colored lights.
    Is there a way to solve this problem?
    Thanks.

    Cemil,
    There was a bug in the early versions of 12.1 for color contexting.  Color context changes were made in the display template were not being saved.  I would strongly urge you to upgrade to SP5 patch 1.  However, if you want a very crude way to test if your contexting is working the way you want it to:
    1. Export your display template
    2. Find the color context section of the xml and change the settings to the desired color coding
    3. Import your modified display template
    4. Test
    I do not recommend this as a short term or long term solution.  It is a hack and should be recognized as such.  But it will allow to test your configured display template's behavior.
    Regards,
    Mike

  • Script Editor does not work. Panel blue and empty.

    Hi
    I installed Oracle Database XE yesterday on
    Acer TravelMate C300, Microsoft XP SP2 Tablet Edition
    and ..
    I cannot read SQL scripts
    I cannot access to the editing panel of Scripts Editor when I want to create a new script.
    I used System and HR login.
    The panel is blue and empty.
    Thank you for any information
    Best regards
    JRD120

    I cannot read SQL scriptsWhere you want to read SQL scripts?
    I cannot access to the editing panel of Scripts
    Editor when I want to create a new script.About which "Scripts Editor" you talking about? From TOAD?
    The panel is blue and empty.Panel??

  • Always Script Editor ... Alt Gr key does not work

    Hi,
    With IE6 in SQL Script Editor
    Alt Gr Key does not work.
    For instance, I cannot type ||
    In fact it's a copy-paste from SQL command (which works well)
    Note Script Editor does not work with Firefox.
    Thank you for any information
    Regards
    JRD120

    You might try this:
    Remove any USB device except mouse/keyboard
    Perform a PRAM-reset (hold ALT-CMD-P-R until you've heard the starting chime 3 times)

  • Script that worked in CS does not work in CS4 - multiple open page, print , pdf export and close

    I had a script that worked great for me in Indesign CS. But now does not work in CS4. Anyone knows what needs to be done to make it work again ?
    When I drop folder with indesign files on top of this script:
    1. opens first page
    2. turns specific layer on
    3. prints using preset
    4. exports using preset
    5. close without saving
    6. next page
    Anyone who can give me solution or idea how this should work is greatly appreciated.
    on open sourceFolders
    repeat with sourceFolder in sourceFolders
    tell application "Finder"
    try
    -- If you would like to include subfolders, you say - every file of entire contents of folder…
    set idFiles to (every file of folder sourceFolder whose file type is "IDd5") as alias list
    on error -- work around bug if there is only one file
    set idFiles to (every file of folder sourceFolder whose file type is "IDd5") as alias as list
    end try
    end tell
    if idFiles is not {} then
    tell application "Adobe InDesign CS4"
    set user interaction level to never interact
    repeat with i from 1 to count of idFiles
    open item i of idFiles
    tell document 1
    try
    set visible of layer "ImagesTag_Layer" to true
    end try
    set myPreset to "letter size" -- name of print style to use
    with timeout of 700 seconds
    print using myPreset without print dialog
    end timeout
    set myPreset1 to "pdf preset name" -- name of pdf export style to use
    set myName to the name -- name includes .indd should remove at some point          
    with timeout of 700 seconds
    export format PDF type to "users:temp:Desktop:pdf:" & myName & ".pdf" using myPreset1 without showing options -- set path here format ComputerName:Folder1:Folder2:......:FileName.pdf
    end timeout
    close without saving
    end tell
    end repeat
    set user interaction level to interact with all
    end tell
    end if
    return 10 -- try again in 10 seconds
    end repeat
    end open

    (Disclaimer: me not an AS guy!)
    First thing I noticed is the interaction level is set off. If you comment out this line
    set user interaction level to never interact
    you might be able to pinpoint the exact error -- ID will display a standard "failed" dialog, hopefully showing the line that it fails on.
    A quick question: the script assumes two presets in your InDesign: one for print ("letter size") and one for PDFs ("pdf preset name"):
    set myPreset to "letter size" -- name of print style to use
    set myPreset1 to "pdf preset name" -- name of pdf export style to use 
    Do these actually exist in your CS4, with the same (non)capitalization and spaces?

  • SAP GUI Scripting Wizzard Windows7 does not work

    Dear Experts,
    I am quite a novice when it comes to SAP GUI scripting (let alone any other development), therefore my question might be rather stupid. After my PC was migrated from XP to Windows 7 it is no longer possible to use the SAP GUI scripting wizzard. When you select it from the menue, simply nothing happens.
    Does anyone have an idea what I need to do to have this useful tool back on my PC?
    We are running SAP GUi 7.1
    Thanks for your help
    Theo

      Here is SAP GUI wizard replacement tool...its in auto IT - enjoy
    http://www.autoitscript.com/forum/topic/149540-sapwizardudf/
    I had the tech guys here install ,  the latest GUI patch level 15,
    and the script development tools not working issue has been fixed
    They (SAP?) removed the 'script development tools' menu option!?
    I have not installed the MS hotfix, but
    My question is,  it true the 'Script development tools' is gone?
    Other methods
    a) This (free) non SAP solution seems to work however...any other ideas?
    Scripting Tracker Lite
    http://scn.sap.com/docs/DOC-32728
    b) The Activate GuiXT tool in SAP GUI also does give you some clues in the element window
    and could be an alternative way , to get control names.
    eg a radio button is R[P_CONTROL_ID] when it should be radP_CONTROL_ID
    c) The SAP script recording and playback ,  to a vbs script will give you the control names also, if you edit the script.
    You must of course have GUI scripting on in rz11
    I can't read this note https://service.sap.com/sap/support/notes/1633639 - need a password!

  • In the context of restoring a drive from a backup, i copied /etc/sudoers from my backup. Now it does not work due to the permissions not being correct (even though it was copied via sudo cp -rp)

    In the context of restoring a drive from a backup, i copied /etc/sudoers from my backup. Now it does not work due to the permissions not being correct (even though it was copied via sudo cp -rp)

    Most likely you have Office 2004 which are PPC-only applications and will not work in Lion. Upgrade to Office 2011. Other alternatives are:
    Apple's iWork suite (Pages, Numbers, and Keynote.)
    Open Office (Office 2007-like suite compatible with OS X.)
    NeoOffice (similar to Open Office.)
    LibreOffice (a new direction for the Open Office suite.)

  • Adobe Story does not work. I cannot even share a script with a collaborator.

    Adobe Story does not work. I cannot even share a script with a collaborator.

    Moved to Adobe Story Forum.

  • The context menu does not work

    Hello Everyone,
    I have a problem when I try to use  the context menu.
    Just it does not work using control key and click, for example when I select a folder and I want to apply a color
    for the folder the context menu does not work.
    Thank you if anyone has an idea of how can I restore the normal function.
    Adrian

    /Library/Preferences/com.apple.finder.plist 

  • How do I set Firefox 10.0.2 to be default browser in Windows 7, using a script or setup switch. "Firefox.exe -setDefaultBrowser" does NOT work.

    I want to set Firefox as default browser for all my users.
    I can do this by opening Firefox and go to Tools --> Options --> Advanced and hit the "Check now" button. That works fine, but I need to accomplish this automatically.
    Running setup with the -setDefaultBrowser switch does NOT work. Running "firefox.exe -silent -SetDefaultBrowser" after setup does NOT work.
    Is this even possible? Or are we stuck with IE?

    Thank you for your reply, however it really does not work for me.
    I have Firefox installed, as well as Internet Explorer 9. If I check "Default Programs --> Set Default Programs" in Windows 7 it states that Internet Explorer is default.
    If I create a shortcut on my desktop that points to "www.mozilla.org" for example, and double-click that shortcut, it will open in Internet Explorer.
    I now run "%ProgramFiles%\Mozilla Firefox\Firefox.exe -silent -setDefaultBrowser" with administrative privileges.
    I look again in "Default programs" and i still says IE is default browser. If I click on my shortcut it still opens in IE.
    If I change the setting manually from within Firefox it works fine.
    Please help, I really can't make this work.

  • DARI (Arabic) script does not work in WORD 2004

    When I change to AFGHAN DARI in MS WORD I can type the characters (although as other discussions have shown KEYBOARD viewer does not work) BUT they are not joined properly in the words.
    i.e. the same form of the character is used whether it is at the start, middle or end of the word. PATHETIC - how would you like to write all English in UPPERCASE??
    MS WORD does the correct thing on Windows XP
    Does anyone have any ideas - apart from throwing this new MacBook away?
    Any Word processors for the MAC that work properly?
    Please HELP!!

    Does anyone have any ideas - apart from throwing this new MacBook away?
    Yes, throw Word away. MS Office for Mac has no support for Arabic, Hebrew, Devanagari, etc.
    All other word processors (except Appleworks) have better support for Arabic than Word does. Mellel is the best. See this note:
    http://homepage.mac.com/thgewecke/TypingArabic.html

  • Invocation of Application Process does not work in 3.1?

    Hi
    I invoke APPLICATION PROCESS successfully in APEX 3.0 (for RSS, WAP, Google Site Map file generation). See http://www.mujnotes.cz/pls/htmldb/f?p=9774:::APPLICATION_PROCESS=TEST
    The same code does not work in APEX 3.1 (apex.oracle.com environment). The introductionary application page is shown instead of process result, see http://apex.oracle.com/pls/otn/f?p=9774:::APPLICATION_PROCESS=TEST.
    The processes have "No Authorisation Required" set.
    Do you have any glue what's the problem?
    Thanks
    Roman

    Scott
    it uses user authentication scheme. It works well for a common login into application.
    Authentication Function CALL:
    return user_auth
    Authentication Function DEFINITION:
    create or replace function user_auth (p_username in VARCHAR2, p_password in VARCHAR2)
                             return BOOLEAN
                             is
                             l_password varchar2(4000);
                             l_stored_password varchar2(4000);
                             l_count number;
                             begin
    dedicated application table is used to store and check user name and password
                             end;
    Roman

  • VPD context_sentisitive policy does not works as expected

    Hi,
    I'm trying to implement CONTEXT_SENSITIVE RLS policies:
    http://docs.oracle.com/database/121/ARPLS/d_rls.htm#ARPLS67721
    Server re-evaluates the policy function at statement execution time if it detects context changes since the last use of the cursor. For session pooling where multiple clients share a database session, the middle tier must reset context during client switches. Note that the server does not cache the value returned by the function for this policy type; it always executes the policy function on statement parsing. Applies to only one object.
    What I have discovered so far:
    1. policy function executed each time when query executed from SQL*Plus. Independently of context changes.
    2. policy function executed only once when query executed from PL/SQL.
    3.  When we have a PL/SQL procedure like this:
    begin
    <query>
    <change context>
    <query>
    end;
    Additionally, query (cursor) is not present in PL/SQL cursor cache, then
    policy functions executed only once when first query executed.
    So wrong results are possible when application context changed in a way that policy function returned predicate also changed.
    4. JDBC: policy function executed each time when query is executed. Policy function executed only once when I enabled statement caching:
    OracleDataSource ods =  new OracleDataSource();
    // skip
    ods.setConnectionCachingEnabled( true );
    ods.setImplicitCachingEnabled( true );
    Properties cacheProps = new Properties();
    cacheProps.put( "InitialLimit", "1" );
    cacheProps.put( "MinLimit", "1" );
    cacheProps.put( "MaxLimit", "5" );
    cacheProps.put( "MaxStatementsLimit", "50" );
    ods.setConnectionCacheProperties( cacheProps );
    5. Queries with RLS policies are not cached in the session cursor cache. For example, if we executed same query multiple times in SQL*Plus - then this query will be not cached.
    2 and 3 (PLSQL) relates to PL/SQL cursor cache.
    As a result, when we disable PL/SQL cursor cache (setting session_cached_cursors=0), then policy function executed each time in PL/SQL.
    What I have observed, it is not agreed with documentation on context_sensitive policies (I provided a link above):
    Server re-evaluates the policy function at statement execution time if it detects context changes since the last use of the cursor.
    Signature of DBMS_RLS.ADD_POLICY procedure was changed in 12c with additional arguments: NAMESPACE, ATTRIBUTE.
    I tried to use them with no luck, results are the same.
    In my opinion statements below are contradict to each other:
    1. Server re-evaluates the policy function at statement execution time if it detects context changes since the last use of the cursor.
    2. it always executes the policy function on statement parsing.
    First, documentation says that the policy function evaluates at statement execution time.
    Second, documentation says that the policy function executes on statement parsing.
    I have used Oracle Database 12.1.0.2 for testing.
    I provided a script that I have used in my tests:
    rls_policy.txt - creates test schema and policy
    rls_sqlplus.txt - runs simple select against query with RLS policy
    rls_plsql.txt - more complex example, runs some anonymous blocks with queries against table with RLS policy.
    In my opinion, context_sensitive policies does not works as described in the documentation.
    Is it a bug or I'm missing something?
    Please advice.
    Best regards,
    Mikhail.

    Thanks Scott. May i know why i should never use user policies for denying access?
    From my readings on some articles, there is no way to deny users permission in sharepoint after granting domain users with read access other than the web application user policy in our case (with certain reason, we need this group to be granted with
    read access but we would like to restrict small amount of users from seeing the page)

  • SCVMM 2012, Conntect via conosle does not work when logged in with specified credentials

    Hi all
    I have a problem with the SCVMM 2012 console. When I start the console I select the "Specify credentials" option and then I enter my admin credentials. Afterward the console opens
    and everything works except the "Connect via Console" function.
    When I try to connect to a VM I get the following message:
    Virtual Machine Manager lost the connection to the virtual machine for one of the following reasons: Another connection was established to the console of this machine. The virtual machine has been shut down or put into the saved state. The user credentials
    provided do not have the necessary privilege to connect (0x0003, 0x0300)
    It seems that the Virtual Machine Viewer runs not under the admin credentials which I enter at the beginning and therefore the console cannot connect.
    Has someone the same issue ? Is it by design that the console connection does not work with specified credentials or is a sort of a bug or error ?
    Thx
    J0fe

    Being new to SCVMM, I've just come across this issue myself, though I came to a different (not necessarily better, but good enough for me) resolution.
    I have a somewhat convoluted but not abnormal configuration where the SCVMM server lives in a separate untrusted forest to that which the Hyper-V Server hosts live.
    As people have noted in this and other threads, the VirtualMachineViewer.exe process launches in the same security context with which you logged onto your pc. While the VmmAdminUI.exe process also runs in the same security context,
    the network logon it issues makes use of the credentials provided at the SCVMM MMC's logon screen, which VirtualMachineViewer.exe does not.
    I elected to use Credential Manager to resolve this issue.
    In Credential Manager, I created a "Windows Credential" entry where the hostname matched the FQDN of the hostname that appears within SCVMM as the virtual host entry. Using an IP does not match if you've used an FQDN in the SCVMM
    registration, and vice versa. If you used an IP for the host in SCVMM, then you need to supply that IP as the hostname in Credential Manager, and likewise if you used a FQDN.
    This solution isn't perfect as it requires you to manage numerous Credential Manager entries (one per host), but that still appealed to me far more than one per guest. If I had a larger environment, I'd script the account configuration
    given it only needs to happen once per host, rather than on an ongoing basis of once per guest as some of the above approaches would require.
    I haven't tested the different combinations to verify the least permissions required. For the time being I've gone with the model of using a non-privileged domain user account (to avoid managing multiple identities and passwords)
    which I added to the local Administrators group of each Hyper-V Server host. This stuck me as being a sound enough compromise between rigid security and ease-of-administration (given the per host arrangement in Credential Manager).
    With the account correctly specified in Credential Manager, I'm able to move on past the 0x0003 error and successfully use the remote function.
    If I was to point out an upside to this, it would be that this approach would allow me to remote Hyper-V servers in untrusted forests (including workgroups), which is something I couldn't do if the VirtualMachineViewer.exe process
    did in fact use my SCVMM credentials alone. Ultimately, that's something you have to come to terms with yourself, though.
    Cheers,
    Lain
    Thanks a bunch Lain, this helped! I'd still consider this a bug, however, and not a workable solution for a large number of servers/admins... But for now this does the trick, thanks!

  • Powershell Script Send-zip not working when running in cmd

    I found there is powershell send-zip script available in technet.  I tested it and found that it works when the script is running under powershell env, but when it is calling in cmd env, I can see the zip file, but there is nothing in it.  If
    I add the "-noexit" switch it runs normally.  Anyone have ideas what might be happening?
    The orig codes is as following:
    function global:SEND-ZIP ($zipfilename, $filename) { 
    # The $zipHeader variable contains all the data that needs to sit on the top of the 
    # Binary file for a standard .ZIP file
    $zipHeader=[char]80 + [char]75 + [char]5 + [char]6 + [char]0 + [char]0 + [char]0 + [char]0 + [char]0 + [char]0 + [char]0 + [char]0 + [char]0 + [char]0 + [char]0 + [char]0 + [char]0 + [char]0 + [char]0 + [char]0 + [char]0 + [char]0
    # Check to see if the Zip file exists, if not create a blank one
    If ( (TEST-PATH $zipfilename) -eq $FALSE ) { Add-Content $zipfilename -value $zipHeader }
    # Create an instance to Windows Explorer's Shell comObject
    $ExplorerShell=NEW-OBJECT -comobject 'Shell.Application'
    # Send whatever file / Folder is specified in $filename to the Zipped folder $zipfilename
    $SendToZip=$ExplorerShell.Namespace($zipfilename.tostring()).CopyHere($filename.ToString())
    SEND-ZIP C:\abc\a.ZIP C:\a\a.bak

    I've had the same problem with similar code found on another web site.
    The reason the zip file ends up being empty is that the temporary $ExplorerShell object you created is deleted when the send-zip function returns,
    and any incomplete copy operation that may still be ongoing at that time is aborted. (The copy operation is asynchronous, and continues after the CopyHere() function returns.)
    To work around this, you need to add a delay loop before you return, waiting for the copied object to appear in the zip.
    (Note that adding a fixed delay, like I've seen on other web sites, does not work: Small files appear almost immediately, whereas large file or worse still large subdirectory trees can take a long time to appear.)
    Try changing the end of your routine to something like...
    # Create an instance to Windows Explorer's Shell comObject 
    $ExplorerShell=NEW-OBJECT -comobject 'Shell.Application' 
    # Open the zip file object
    $zipFile = $ExplorerShell.Namespace($zipfilename.tostring())
    # Count how many objects were in the zip file initially
    $count = $zipFile.Items().Count
    # Send whatever file / Folder is specified in $filename to the Zipped folder $zipfilename 
    $SendToZip=$zipFile.CopyHere($filename.ToString())
    # Wait until the file / folder appears in the zip file
    $count += 1 # We expect one more object to be there eventually
    while ($zipFile.Items().Count -lt $count) {
        Write-Debug "$filename not in the zip file yet. Sleeping 100ms"
        Start-Sleep -milliseconds 100
    # Return deletes the $zipFile object, and aborts incomplete copy operations.

Maybe you are looking for

  • How to hanlde breaked large messages in sender JMS adapter

    Hi, I have been asked like 'how can we handle breaked large messages in sender JMS adapter?'and lets say I am getting some messages as it is and some are breaked into small segements for the mesaages that are large.... do we need to use module,if so

  • 3d for 3d tv

    I use sony vegas for my native side by side 3d footage. I can add numbers,letters,words easly for the pop out effect that can be burned to blu-ray and played back on a 3d tv but sony vegas is pretty limited on 3d add ons. Very time comsuming to move

  • How to properly use SC ??

    I need to create a service that calls a local .EXE.      binpath = "c:\windows\MGH\parentboot.exe" I have tried about 20 different ways to run this SC command and even when it does create the service I can never start it.  We are on Winodws 7 x86. Ho

  • Business packages for SAP Portal 7.3

    Hi, as far as I know at the moment there are no business packages existing for SAP Portal 7.3. Is this correct? If yes, how are the different business packages scheduled? Bye, Timo

  • Update a delivery with empty HU

    Hai guys, My delivery has 1 pallet and 4 hu's with 1 material each in them. I need to update this delivery with 4 more empty HU's.(it is manadatory  for each pallet to have 8 hus) i am creating everything programticaly... now i created hus with fm  C