Setting variable in script to result returned in another script

I have two scripts.
Using a default answer dialog, the first script returns a result consisting of one word.
The second script begins with "set myWord to . . . ."
Is there a straightforward way of completing the myWord command with
"text returned of result," where the result is in the first script?
I've looked through the forum and the answer is probably there, but I'm not certain.

Okay, I give up (but not for lack of trying).
First, I get nowhere in the second script unless I use "load script file" in place of "load script"
More problematic: as a first script I'm using this as a test script:
property firstScript_myWord : [but I don't know what to put here, I've decided]
on run
tell application "Finder"
display dialog "What is your name?" default answer ""
end tell
set firstScript_myWord to text returned of result
end run
The display dialog part works as expected, and the result listed is the text returned of the result, i.e., the name entered in response to the dialog box. The Event Log is appropriate EXCEPT it doesn't show anything about setting "firstScript_myWord"
After running the first script, if I run the second script I get a variety of results -- seemingly dependent on whether the first script has been run more than once. This may be consistent with the persistence of declaring a property.
I do expect the first script to be run many more times than once, with different names (or words, or whatever) entered -- and what I was looking for was a second script whose myWord would be set each time to any new "text returned of result" in the first script. But, if there has been no change in myWord, I do need the last myWord to persist through reboots, etc.
Another approach would be to save the "text returned of result" in the first script to a file, and the last entry in that file could be used to set myWord in the second script -- but I haven't figured out whether this is possible (or how to do it).
What you provided has been helpful, and it's almost certainly something I'm not doing right preventing me from making it work.

Similar Messages

  • [Solved] Trying to set environment variables in script

    I'm trying to create a script that will pass environment variables that will stay valid after the script exits.
    The problem with this is that (by design?) when executing a script it opens a child environment, and inherits the environmental variables from the parent.
    The issue is that the child cannot interact with the parent's environment so setting variables like:
    export http_proxy='http://server:port'
    wont stay valid once the script exits. I've verified this by trying to echo the variable once the script completes, and i receive an empty reply.
    The only work around I have for this is to include this within a bash profile, however I cant just keep adding scripts into my bash profile, because that seems counter-intuitive.
    Is there any way to do what I'm trying to do? Or am I just grabbing at straws here?
    below is my code for my script, perhaps I've done something wrong...
    proxy=x.x.x.x
    port=#
    username=domain\\username
    password=userpassword
    export http_proxy='http://$username\:$password@$proxy\:$port'
    export ftp_proxy='ftp://$username\:$password@$proxy\:$port'
    exit
    Last edited by isolatedvirus (2011-10-04 10:58:52)

    One thing to note is that you should specify the sourced file by its path so it includes a slash, quoting bash(1):
    source filename [arguments]
    Read and execute commands from filename in the current shell environment
    and return the exit status of the last command executed from filename.
    If filename does not contain a slash, file names in PATH are used to find
    the directory containing filename. The file searched for in PATH need
    not be executable. When bash is not in posix mode, the current directory
    is searched if no file is found in PATH. If the sourcepath option to the
    shopt builtin command is turned off, the PATH is not searched
    So if sourcepath is set (as by default), you can end up sourcing the wrong file, e.g.
    source file
    (DON'T do it!)
    will really source /usr/bin/file, even if you have 'file' in current directory.
    Instead, always specify the path,
    source ./file
    Keep this in mind or you're in for a big surprise.
    Last edited by lolilolicon (2011-10-04 11:33:48)

  • How to call a set variable?

    Greetings,
    I am creating an apple script that runs a netstat command to grab an IP address. This works.
    The "Set Value of Variable" (called XX) shows the IP address that netstat runs.
    The next apple script activates "Terminal" just fine.
    Within Terminal, I want to tell it to "telnet" to the IP address from the Set Variable and this is where I am stuck. How do I tell it what "XX" is?
    Thanks,

    If it is the only input item in the input (previous actions can contribute to the input), your statement would be something like:
    set DG to item 1 of the input
    If you are only using the variable in your second AppleScript action, you can also just combine them:
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px;
    color: #000000;
    background-color: #FFEE80;
    overflow: auto;"
    title="this text can be pasted into an Automator 'Run AppleScript' action">
    on run {input, parameters}
    set DG to (do shell script "netstat -nr | grep -w 'default' | awk '{print $2}'")
    tell application "Terminal"
    activate
    do script "telnet " & DG
    end tell
    return input -- pass on the input
    end run
    </pre>

  • Hide / Remove Content Search Webpart when no results returned

    Hi SharePoint friends
    I'm looking to find a way to hide the whole Content Search webpart (including the webpart title and border area) if there are no results coming back from the query.
    What I tried
    1. There is this property: "ShouldHideControlWhenEmpty" but it doesn't do anything when there are no results. The webpart is still visible. Webpart has a the Title and the Border around it so when
    there are no results the title and the border show up with no results. Like I said I want to hide the whole thing in that case.
    2. Wrote a jQuery script that searches for the text "There are no results" message (which comes from the webpart when there are no results) and hides the webpart. However, there is a short flicker once the page loads because the webpart first gets
    rendered for a split second and then disappears by virtue of my jQuery script - which is not great UI experience.
    3. So I thought I could extend the OOTB ContentBySearchWebPart and get a hold of some kind property that would get me the result count. If the results count is 0 simply I would hide the webpart server side. I looked
    at the documentation online - nothing I could find that I could leverage.
    Help? Thanks!

    Hi,
    To hide the whole Content Search Web Part when there is no result returned, a workaround can be like this:
    In the “Web Part Properties” panel, set checked the “Don't show anything when there are no results”, set the Chrome Type as “None”:
    By doing this, the whole web part will disappear when there is no result returned.
    Thanks
    Patrick Liang
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support,
    contact [email protected]
    Patrick Liang
    TechNet Community Support

  • Using Spry Data Set Variable in Recordset

    I have a page that contains a spry data set and a recordset. The recordset uses one of the variables from the spry data set to filter its results. how do I apply the spry data set variable to the recordset?

    I believe passing this the variable through the URL requires you to update the page, right?
    Yes
    Is there anyway to grab the spry data set variable direct and apply it to your recordset filter?
    The SpryDataSet variable can only be used on the clientside (JavaScript) so you will have to get your recordset using JS.
    A page refresh can be set in motion if you add {useCache: false, loadInterval: 500} to your dataset to then set an observer to your dataset to invoke the page refreash function.
    Gramps

  • OBIEE 10g - Can I use logical SQL to set variable?

    I am trying to set value of a session variable in the Advanced tab Prefix box of a request.
    Assigment of absolute value like this is working good:
    SET VARIABLE MYVAR=1;
    Can I set the variable using logical SQL? Something like:
    SET VARIABLE MYVAR = (SELECT table1.col1 from catname where table1.col2=1)
    Thanks in advance.

    Hi,
    You can create a session variable or dynamic variable in the RPD and try using it in here at the Advanced Tab prefix.
    But still check yourself if you need multiple values returning in the SQL statement.
    Hope this is helpful/ useful.
    Regards
    MuRam

  • Can't set public Object in HTTPService result listener

    Hello.
    I am using a data object class.  The class is based on a class that contains the HTTPService calls.  I want to return the event.results to the local instance of the class by setting a public Object = the results Object. However, the public object is null after the HTTPService event result listener function is finished.
    It is easier to see than to describe:
    In the main application. i make an instace of my activity class:
    myactivity:activity = new activity() ;
    now, I invoke the getdata method:
    myactivity.getdata() ;
    The getdata() method fails at runtime, because it tries to reference the results object.
    See the base class and the activity class below.
    BASECLASS: (just the main parts are listed here):
    public class transferObject
            public var baseurl:String ;
            public var dbresult:Object =new Object();
            public var service:HTTPService ;
            public function transferObject()
            geturl("ghost") ;
            public function geturl(db:String) : void
                    baseurl = "https://xyzzy/" ;
            public function getHttpService(methodname:String):void {
                    service = new HTTPService();
                    service.url = this.baseurl + methodname;
                    service.channelSet ;
                    service.method = "POST";
                    service.addEventListener("result", httpResult );
                    service.addEventListener("fault", httpFault);
                    service.send();
               public function httpResult(event:ResultEvent):void {
                    dbresult = event.result ;
    //DBRESULT IS THE OBJECT I WANT TO REFERENCE IN THE DERIVED CLASS
                 //Do something with the result.
                public function httpFault(event:FaultEvent):void {
                    var faultstring:String = event.fault.faultString;
                    Alert.show('Error sending data: '+faultstring+' '+event.fault);
    HERE IS THE DERIVED CLASS:
    package dataObjects
        public class activity extends transferObject
        import mx.controls.Alert ;   
    [Bindable]
    public var event_id:String ;
    [Bindable]
    public var description:String ;
           public function activity()
                super();
            public function getdata():void
                getHttpService("eventually.sendtest") ;
              this.event_id = dbresult.result.activities.activity.getItemAt(0).event_id ;
    ----> THE LINE ABOVE FAILS AT RUN TIME BECAUSE THE DBRESULT OBJECT IS NULL
    THANK YOU FOR ANYHELP YOU CAN PROVIDE

    Sorry, but parameters of a ServeletRequest can not be modified. Look at the javadocs on ServeletRequest and you will see that "getParameterMap" returns an immutable Map. JSF is simply wrapping that method call with their own "getRequestMap" method. Setting an attribute, request.setAttribute(name, object), is how you pass things using the request to servlets, jsps, etc. on down the line. Just get the attribute instead of the parameter where you need it. Set your "parameter" in the attributes, down the line, check the attribute first, if it exists, use it, otherwise look for the parameter.

  • CFCs setting variables

    I am getting a bit confused with cfcs using cfreturn and
    cfinvoke please be patient!
    1.Setting variables in cfc
    In this example cfc I make a query. The cfreturn tag does
    <cfreturn expression /> as I understand it. I don´t
    understand how you define the expression - can you return
    arguments, any column I like in variables? How do I do that?
    <cfcomponent><cffunction><cfargument
    name="user">
    <cfquery name="checkuser">
    select col1, col2, col3, col4, col5, col6
    from user
    where .....=....
    </cfquery>
    <cfreturn checkuser.col1>
    2. Calling cfc:
    In cfinvoke you call a variable using returnvariable="". Is
    it true that the variable doesn´t have to have the same name
    as in the method that the cfinvoke tag is calling? What does return
    variable call? How do I define what it calls?

    In any cffunction, inside or outside a cfc, if you are going
    to return a value, you use the cfreturn tag. You can return
    constants like true, 1, "Dan is so smart", or variables. What you
    return has to be consistent with the returntype attribute of your
    cffunction tag.
    When you invoke a variable, you can use any name you want as
    the return variable. In theory, you don't even know any variable
    names inside the function. The return variable does not call
    anything. It accepts what the function returns.
    It is the cfinvoke tag that calls something. You control what
    it calls with it's attributes.
    Further details are in the cfml reference manual.

  • Message tracking max results returned

    Hi All,
    On message tracking page the predefined max rsults returned value only have 3 options 250, 500 and 1000. May i know how can i increase query setting more than 1000 results return.
    Regards,
    Rock

    Hi Rock,
    You cannot increase the query to more than 1000, but you can change your other parameters.  For example, you could change the date scope until you get down to under 1000 results. 
    You will have to run multiple queries to pull all the data you're looking for, but unless/until they change the maximum results this will give you a workaround.
    Thanks,
    Rachel

  • Calling functions / setting variables in loaded SWF

    You know how you can create a Movieclip object, add a
    function or variable to it, then call that function or change that
    variable from within the SWF that includes it? I wanna be able to
    do that, only with SWFs that are loaded at run time.
    My "main" SWF is simply a menu-type thing. The user clicks a
    button in my MAIN.SWF, and the MAIN.SWF then loads the SWF that's
    associated with that button, using the AS 3.0 prescribed
    Loader()-URLRequest()-addChild() method that everyone always asks
    about.
    This works great. But now I've got some custom objects and
    such (ie., not just strings) within my MAIN.SWF that I'd like to be
    able to share with the loaded SWFs. Preferably, I'd like to use an
    accessor-type function (ie.,
    LoadedSWF.GiveMeTheCoolObject(MyCoolObject);), though at this point
    I'm willing to hack into the object itself (ie.,
    LoadedSWF.CoolObject.CoolField = MyCoolObject.CoolField;) if that's
    what it takes.
    I've tried just calling the functions and setting the fields,
    but the AS 3.0 compiler doesn't care for that sort of nonsense on
    it's generically-defined objects. Notice also that, at run time, a
    call to LoadedSWF.hasOwnObject("GiveMeTheCoolObject") returns true.
    So my big-brained colleagues, what's the magic?
    In advance, thanks for the help!
    Scott

    Kglad,
    quote:
    Originally posted by:
    kglad
    from that error message it appears your function is expecting
    a member of the MyCoolObject class, correct?
    and MyCoolObject is not an instance of that class. so, you
    need to fix that. ie, create a member of that class and use that
    class member as the function parameter.
    Heh, that's what the error message says all right. But the
    object actually IS a MyCoolObject class object. I stared at this
    thing for hours, and MyCoolObject IS an instance of that class. I
    tried various casting combinations (including casting it to an
    Object and passing that) but had no luck whatsoever.
    So I googled this particular runtime error message ("Error
    #1034: Type Coercion failed: cannot convert ") and found a ton of
    links to other people having a similar issue. Typically, the
    problem was just as you said, someone passing a button as a string,
    that kinda thing. But one guy had a problem with an object he
    derived from the Event class. After hours spent trying to get it to
    work, he tried overriding the base class' clone() method and got it
    to work:
    http://www.asserttrue.com/articles/2006/10/14/custom-events-in-actionscript-3-0
    As for my project, I took a long hard look at the overall
    architecture of my project and decided that it was best if all the
    "real work" took place in the MAIN.SWF file. This approach would
    solve a couple of other problems, and it just makes sense in a
    "separate the display from the data" mentality.
    So (and this is the interesting part) I changed the API for
    the LOADED.SWF to accept String pairs (ie.,
    LoadedSWF.AddToDisplay(Name:String, Data:String) ) instead of
    accepting MyCoolObj. Ran it, and Viola, now we're working without
    any run time exceptions. After that glorious moment, I created a
    couple of other APIs that just accepted base classes (one an int
    type, the other a function type) and was happily on my way.
    From this, I gather that passing non-base class (ie, derived
    class) objects to loaded MovieClips via custom function APIs is...
    maybe not as straightforward as we'd expect. In the grand scheme of
    things though, not a big deal: As far as I'm concerned AS3 rocks.
    Again Kglad, thanks for all the help: Your input on how to do
    this was the big push that I needed to get over the last technical
    hurdle of this project.
    To those who are reading this topic for the "how do I call
    functions and/or set variables in a loaded SWF?"
    The short answer is to cast the loaded SWF's content object
    as a MovieClip and then call the function or alter the variable:
    //Load the SWF (you've seen this code a million times)
    var LoadedSWFObj:Loader = new Loader();
    var MyURL:URLRequest = new URLRequest("LoadThisSWF.SWF");
    LoadedSWFObj.load(MyURL);
    //This is within your Event.COMPLETE handler:
    //Cast it as a MovieClip object and work with that.
    var LoadedSWF:MovieClip = LoadedSWFObj.content as MovieClip;
    // or another way to cast it is:
    var LoadedSWF:MovieClip = MovieClip(LoadedSWFObj.content);
    //Call yer function:
    LoadedSWF.CallMe();

  • How to limit the number of search results returned by oracle text

    Hello All,
    I am running an oracle text search which returned the following error to my java program.
    ORA-20000: Oracle Text error:
    DRG-51030: wildcard query expansion resulted in too many terms
    #### ORA-29902: Fehler bei der Ausführung von Routine ODCIIndexStart()
    ORA-20000: Oracle Text error:
    DRG-51030: wildcard query expansion resulted in too many terms
    java.sql.SQLException: ORA-29902: Fehler bei der Ausführung von Routine ODCIIndexStart()
    ORA-20000: Oracle Text error:
    DRG-51030: wildcard query expansion resulted in too many terms
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:169)
    When i looked up the net, one suggestion that was given is to narrow the wildcard query, which i cannot in my search page. Hence I am left with the only alternative of limiting the number of results returned by oracle text search query.
    Please let me know how to limit the number of search results returned by oracle text so that this error can be avoided.
    Thanks in advance
    krk

    Hi,
    If not set explicitly, the default value for WILDCARD_MAXTERMS is 5000. This is set as a wordlist preference. This means that if your wildcard query matches more than 5000 terms the message is returned. Exceeding that would give the user a lot to sift through.
    My suggestion: trap the error and return a meaningful message to the user indicating that the search needs to be refined. Although it is possible to increase the number of terms before hitting maxterms (increase wildcard_maxterms preference value for your wordlist), 5000 records is generally too much for a user to deal with anyway. The search is not a good one since it is not restricting rows adequately. If it happens frequently, get the query log and see the terms that are being searched that generate this message. It may be necessary to add one or more words to a stoplist if they are too generic.
    Example: The word mortgage might be a great search term for a local business directory. It might be a terrible search term for a national directory of mortgage lenders though (since 99% of them have the term in their name). In the case of the national directory, that term would be a candidate for inclusion in the stoplist.
    Also remember that full terms do not need a wildcard. Search for "car %" is not necessary and will give you the error you mentioned. A search for "car" will yield the results you need even if it is only part of a bigger sentence because everything is based on the token. You may already know all of this, but without an example query I figured I'd mention it to be sure.
    As for limiting the results - the best way to do that is to allow the user to limit the results through their query. This will ensure accurate and more meaningful results for them.
    -Ron

  • Set variable value from a query - is it possible?

    Hi all,
    I need to use a 'precalculated' value in my report measures' calculations.
    Is it possible to set a variable value as a result of a query?
    Thanks in advance,
    Alex

    Hi,
    In my report, I need to calculate one of the columns as a [certain measure] / [result of another query]
    I didn't succeed to include the [result of another query] as a column in my report's request, but it would be very easy to calculate this [result of another query] separately.
    The [result of another query] value is same for all the rows of my report.
    What I'm trying to do is to run a query before my report (e.q. in the Prefix section), set a variable = [result of another query] and then use this variable in the column calculation of the report.
    Is this possible?
    Thanks,
    Alex

  • Set Variable column in the Column page?

    Hi,
    I try to do this exercise but I facing some understanding problem, please guide me.
    This is BIEE example to do Oracle BI publisher and Dashboard.
    1. Create a dashboard prompt for the region and state to filter the BI publisher report results on the dashboard.
    a. In Answers, open Region and State Prompt.
    b. In the Set Variable column, select None from the drop-down list
    c. Save the prompt in the My Sales folder as Region and state Prompt – No Variable.
    My question from step a and b, I did not see any “Region and State Prompt” in Answers. Then clik Subject Areas – SupplierSales, then assign Region, and State. Then I try to make Set Variable column None. But I did not see where is Set Variable column in the Column page. May be I am doing wrong.
    Please guide me to complete this.
    Thanks,
    Jo.

    BindingContext bindingctx = BindingContext.getCurrent();
    BindingContainer bindings = bindingctx.getCurrentBindingsEntry();
    DCBindingContainer bindingsImpl = (DCBindingContainer)bindings;
    DCIteratorBinding dciter = bindingsImpl.findIteratorBinding("prv_supvo1Iterator");
    ViewObject vo = dciter.getViewObject();
    vo.setNamedWhereClauseParam("BDIVN", divn);
    vo.executeQuery();
    where BDIVN is our bind variable.

  • Create document set using ECMA Script

    Hi,
    I want to create a document set in SharePoint 2010 document library where i have already included document set content type.
    Is there any way to create a document set using ECMA Script?? If yes, then please provide the sample code for this...
    Thanks.
    -Prashant

    Hi Prashant,
    Although this post is aimed at SP 2013 and the App model, it should give you the object model references you need to complete your goal:
    http://blogs.msdn.com/b/mittals/archive/2013/04/03/how-to-create-a-document-set-in-sharepoint-2013-using-javascript-client-side-object-model-jsom.aspx
    In particular the following function should be of use:
    function CreateDocumentSet() {
    var ctx = new SP.ClientContext("http://yourSharePointSite");
    var parentFolder;
    var newDocSetName = $('#txtGetDocumentSetName').val();
    var docSetContentTypeID = "0x0120D520";
    var web = ctx.get_web();
    var list = web.get_lists().getByTitle('DocSetLibrary');
    ctx.load(list);
    parentFolder = list.get_rootFolder();
    ctx.load(parentFolder);
    var docsetContentType = web.get_contentTypes().getById(docSetContentTypeID);
    ctx.load(docsetContentType);
    ctx.executeQueryAsync(function () {
    var isCreated = SP.DocumentSet.DocumentSet.create(ctx, parentFolder, newDocSetName, docsetContentType.get_id());
    ctx.executeQueryAsync(SuccessHandler('Document Set creation successful'), FailureHandler("Document Set creation failed"));
    }, FailureHandler("Folder loading failed"));
    ctx.add_requestSucceeded(function () {
    $('#txtGetDocumentSetName').val('');
    alert('Request Succeeded');
    ctx.add_requestFailed(function (sender, args) {
    alert('Request failed: ' + args.get_message());
    // Failure Message Handler
    function FailureHandler(message) {
    return function (sender, args) {
    alert(message + ": " + args.get_message());
    // Success Message Handler
    function SuccessHandler(message) {
    return function () {
    alert(message);
    Keith Tuomi | Twitter: @itgroove_keith | Blog:
    http://yalla.itgroove.net
    Please click "Propose As Answer" if a post solves the problem or "Vote As Helpful" if a post has been useful to you.

  • Doubt in printing variables in script

    Hi Experts,
    I am having small doubt.
    1).I need to write one condition for sales org 'US11' and divisions '20' or '40'. So the below logic is correct or not.
    if vbdkr-vkorg = 'US11' and and vbdkr-vtweg = '20' or vbdkr-vtweg = '40'.
    select........
    endif.
    2). i need th print these variables in script. can i use the logic like this.
    if &vbdkr-vkorg& = 'US11' and and &vbdkr-vtweg& = '20' or &vbdkr-vtweg& = '40'.
    &zkbetr1/ zpery1&
    else.
    &zkbetr/ zpery& (This is for sales org other than US11)
    endif.
    Thanks & Regards,
    Ramana.

    Hi,
    I think your condition would be more apt if you code this way:
    IF vbdkr-vkorg EQ 'US11' AND ( vbdkr-vtweg EQ '20' OR vbdkr-vtweg EQ '40' ).
    ENDIF.
    Also, look at putting the code into a subroutine called from your driver or subroutine program and then returning the value. The "logic" for determining the value to be printed can then be performed within the subroutine rather than the SAP script.
    Cheers,
    Aditya

Maybe you are looking for