Accessing Global variable which is in another script file

Hi,
I have 2 scripts as File1.scpt and File2.scpt in desktop. I am in need of having the common global variable 'GG'.
File1.scpt has only the following code
*global GG*
*Set GG to "I am global"*
File2.scpt has
+set file1 to (load script file "Macintosh HD:Users:mowri:Desktop:File1.scpt")+
+display dialog m+ -- not working -- Error message: "The variable m is not defined"
+display dialog m+ of file1 - not working -- Error message: "Can't make m into type string"
It will be great help if you can clarify about my mistakes in this?
Regards
Mowri

Another solution, shorter than the previous one:
File1.scpt
set GG to "I am global"
File2.scpt
set file1 to (load script file "Macintosh HD:Users:mowri:Desktop:File1.scpt")
run file1
display dialog GG
Ref.: [Handlers in Script Applications - run Handlers|http://developer.apple.com/mac/library/documentation/AppleScript/Conce ptual/AppleScriptLangGuide/conceptual/ASLRabout_handlers.html#//appleref/doc/uid/TP40000983-CH206-SW14]
Message was edited by: Pierre L.

Similar Messages

  • How can I access global variables in a loaded Applescript?

    How can I access global variables in a loaded script, in Xcode, ApplescriptObjC? Basically, I have a global variable defined in my parent script using "property", and I need to modify objects connected to those variables inside of a loaded script.
    Example:
    Parent script:
    script AppDelegate
    property myTextField : missing value
    //linked to a text field object
    tell myScript to myAwesomeHandler_()
    end script
    Loaded script:
    on myAwesomeHandler_()
    myTextField's setStringValue_("The new Xcode is so glitchy ugh")
    //changes value of linked text field of parent script
    end myAwesomeHandler_
    The problem is, the variable is undefined in the Loaded script, and I need it to have the same value as the parent script, and I don't want to pass the variable through the Handler. Any ideas?

    I think want you are looking to do will need to be done in two steps. Because myTextField needs to be a property for the ObjectiveC part of the code you cannot turn it into a global.
    However if you make a temporary variable global assign the string to it in the handler then set myTextField off of it.
    global myTextFieldGlobal
    script AppDelegate 
    property myTextField : missing value 
    //linked to a text field object 
    tell myScript to myAwesomeHandler_() 
    myTextField's setStringValue_(myTextFieldGlobal)
    end script 
    on myAwesomeHandler_() 
    set myTextFieldGlobal to "The new Xcode is so glitchy ugh"
    //changes value of linked text field of parent script 
    end myAwesomeHandler_ 
    I know you stated you did not want the handler to return a value but I have to ask why? Global's, imo, are not a good idea and really should be used as a last resort.
    One other possibility is to pass a reference to the property to the handler. Not sure if that works in AS of if that would satisfy our requirement of not passing the variable through the handler
    <edit>
    Another though have you tried to define the property outside the script?  That is
    property myTextField : missing value
    script AppDelegate
    Not sure if that will work.
    You might also want to have a look at Scope of Properties and Variables Declared in a Script Object

  • Call function in LabView from a DLL, then access global variable from DLL

    I have created a DLL in LabWindows with a function and a structure.  I want to call the function from within LabView and then access the global structure.  I am able to call the function from the DLL with a "Call Library Function Node" and can access the return value, but I cannot figure out how to access the global structure.  The structure is declared in the DLL header file with __declspec(dllimport) struct parameters.
    Is there any way of accessing this structure without using the Network Variable Library?
    Solved!
    Go to Solution.

    dblok wrote:
    When you say "access to" or "the address of" the global variable, do you mean to pass the variable as an argument to the function call in the DLL?  If so, then I was not really sure how to pass a cluster from LabView by using the "Call Library Function Node".
    Yes, that's exactly right.  I would include a pair of helper functions in the DLL to read and write the global variable.  Alternatively you might write separate helper functions for each field inside the global structure, depending on the number of fields and whether you want to do any validation on the values.
    You can pass a cluster by reference to a function that expects a struct by setting the parameter to Adapt to Type, so long as the cluster does not contain any variable-length elements (strings or arrays).  The cluster needs to match the struct exactly, and sometimes that involves adding extra padding bytes to make the alignment work.  Variable-length elements in LabVIEW need to be converted to clusters containing the same number of elements as the struct definition (for example, if your struct contains char name[12], you would create a cluster of 8 U8 values, and you could use String to Array of Bytes followed by Array to Cluster to convert a LabVIEW string into that format).  If the struct contains pointers it gets more complicated, and it may be easier to write functions in the DLL to access those specific elements individually.
    If you can't get this working or need help, post your code and an explanation of the error or problem you're seeing.
    EDIT: it is also possible to include a single function in the DLL that returns the address of the global variable, which LabVIEW can then use to access and modify the data, but that's more complicated and likely to lead to crashes if you don't get the memory addressing exactly right.

  • Access global variable in fpga from rt-target

    Hi All,
    I have a realtime PC with NI-FPGA 7852R.
    Generally I used programmatic front panel communication to access variables from FPGA to rt-system since I need the data for control and not for data logging.
    The thing is, I bumped into a tutorial and suggested me to use global variables to save resources of your FPGA. My question is, is it possible to access global variable that belongs to FPGA from rt-system? As far as I tried, this does not seem possible.
    Thanks,
    Auralius

    Could you point us towards this tutorial?
    Chris
    Certified LabVIEW Architect
    Certified TestStand Architect

  • Having a global variable which can be accessed by PCUI application?

    Hi there,
    Is it possible for us to have global variables that are available to use by the PCUI application during runtime??
    Thanks,
    Josh

    In the standard code SAP creates singleton classes i.e. only one instance of this class is possible. When you ever you try to create same instance is returned.
    <P>
    Like this you can have all your global variables in this class and can be accessed from other MAC's.
    <P
    In the class you need to have method GET_INSTANCE  as static method which will return the instance and have CONSTRUCTOR method. You need to make sure that same instance is returned. But i am  not sure what will be the code insidde these methods.
    Cheers, Raj

  • How to create and access Global variable in Microsoft Lightswitch(VB)?

    How to create an integer datatype Global variable in Microsoft Lightswitch 2011(VB) and access it in pre-process query to set value? Can it be accessed and set like Me.Application.<MyGlobalVariable> = 999
    Thnx.
    jajjaar123

    If you want to create integer datatype Global variable in lightswitch, you can refer to (Eric Erhardt) blog
    Create and Use Global Values In a Query

  • Accessing global variables in a BAdI

    How can we access the global variables of a program from a BAdI ?The BAdI does not have that particular variable as a part of it's importing/exporting parameter.The BAdI gets triggered at a particular point in the program.The name of the BAdI is /SAPAPO/SDP_SELECTOR and the transaction is /SAPAPO/SDP94(Demand Planning: APO).
    Thanks,
    Savitha

    Hi,
        Try to export the variable to memory id or use database memory id.
    Like this.
    Export l_vbeln to memory id 'ZTEST'.
    you can give any name instead of ZTEST.
    or u can export to database memory id
    EXPORT tab = lt_vbkd
      TO DATABASE indx(V1)
      FROM ls_indx ID 'ZTEST'.
    Regards,
    Niyaz

  • Global variable are not assigned to other files

    Hello
    I have defined & assigning some values to Global files in one of the project files, But the same i am not able to read in other files of the same project.
    i have defined as  'extern int  x ' in one file  & also called in other file by defining 'extern int  x'
    let me know if you more info needed
    Hussain

    Hello
    I am trying to implement this in my program .. but assigning the Global variable is not working 
    NOTE: I am using LABWINDOWS CVI 5. (Old version)
    /////***Test 1 contents****///
    extern ViInt32 A= 0;   // Assigning  ‘0’  to Global variables 
    extern ViInt32 B= 0;
    extern ViInt32 C= 0;
    extern ViInt32 D= 0;
    if (revision = =1)
    A=Confirm Popup (“Verifiy”,"Does this unit also have hardware A”);
    ///*** end of Test 1 ***//
    If I am trying the access above global variable to Test 5 or some other test program within same project
    /////***Test 5 contents****///
    If (A)
    printf (“the Hardware mod is REV A”);
    Else
    Printf(“NO Hardware mod find”);
    //*** end of Test 5 ***//
    Now the query is whichever option (YES OR NO) in the confirm POPUP in Test 1. I am getting the output: “NO Hardware mod find”
    The reason is the Global Variable is not passing.  

  • How can I use a sound file on one slide, which fades to another sound file on the next?

    I am trying to make a slide show that begins with a certain sound file, which then I hope to fade out to the second slide which uses a different sound file, I've followed Apple's online tutorials, but what happens is I get two sound files playing simultaneously. Also, I'd like to add sounds files to different individual slides throughout the presentation, which I want to play independently from the entire slide show's sound track. I have programmed the slides to change automatically. Is there any way I can have multiple sound files on multiple slides all playing independently, without playing over the top of the previous sound file? I imagine this is a simply task, so my apologies if this is the case. Thanks in advance for any help!
    kind regards,

    Getting sound to work right in Keynote requires a basic understanding that:
    1. Sound played during slide transitions (from one slide to the next) must be placed in the Document Inspector > Audio > Soundtrack Well - there can only be one audio file and it plays across all slides
    2. Additional sounds files can be placed on individual slides as sound objects - each object can have build-in and build-out assignments, but sound files need at least a Build-In > Start Audio (done in the Build Inspector) - each object, wether a shape, image, sound or movie can have discrete start timing such that the start of one sound object can be delayed X seconds after the previous event. This can be used to avoid overlapping starts or playing. If you know the length of each sound file object, you can adjust the start to occur after the end of a previous sound using the Build Inspector. Click on the More Options Button to display the event build-order list and click on the event to reveal how the build starts and add any delays to start there.
    3. Keynote does not have a Fade Feature - any fade-in or fade-out (sound up/sound down) of audio files must be done to the sound file using third party applications and then brought into Keynote. If you'd like to join the crowd wishing Apple might add this feature in the future, you can provide feedback to Apple here:
    http://www.apple.com/feedback/
    4. If you need an audio file to play across a few slides and another audio file to play across another few slides, break the presentation into seperate documents, place the audio in the soundtrack well for each document and then add a hyperlink object to connect to the next Keynote document in the series. Note: all files must be "opened" in the background and ready to play or else the next file will attempt to start but stall just when you don't need it to.
    Hope this helps.

  • I need to check a value of variable which is in my php file in my adobe air application.

    please help

    The point of syncing is to have the same photos in albums as those on your computer. Being able to delete photos from a synced folder destroys the sync. If you want to be able to delete photos on your iPad then do not sync photos from your computer. Also the Photos app on an iPad is just one app. There are many other photo organizing and editing app in the App Store. Use the app the best suits your needs.

  • How to Set multiple Global Variables without using Controls or Indicators

    I have to set many Global Variables (i.e. declare and initialize them) in a subVI in order to pass them to various other subVI's. The only way I know how to do it in LabView is to create a Globals.vi on which you create a control or indicator for EACH Global Variable. That's fine if you have only a few variables. But I have close to a hundred Global Variables (which come from a configuration file for a large program) and clearly it is impractical and cumbersome to create a control for each global variable. In Agilent Vee, there is a simple function called "Set Variable" that sets the data value of a global variable. Then in other module, you simply use the "Get Variable" function to get back the v
    ariable and its value.
    In LabView you can use the "Invoke Node / Set Control Value" and "Get Control Value" properties to achieve the same thing. But as mentioned above, you need to create a control for each global variable and that is a big pain in my case, with many global variables. Furthermore, the global variables are read from a Configuration Text File to this VI. Is there a way to do it without using the control? Thank you in advance for any help.

    Actually you could create the same sort of facility in LV. All you have to do is create a LV2-style global that behaves as follows:
    To write a value to it, you supply a value name and the value. These pieces of data are save internally in seperate arrays.
    To read a value, you supply a value name. The VI looks up this name in the value name array to return an index into the value array. Output the value you find.
    Frankly though, it sounds like what you really need is not hundreds of globals, but a good way to manage configuration data.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Global Variable Access in OWB.

    Hi All,
    OWB Client 9.0.2.56.0
    OWB Repository 9.0.2.0.0
    Is it possble to have variables whose values can be accessed and updated across mappings?
    eg global variables which can be referred/modified in any mappings
    Thanks in Advance.
    Regards,
    Vidyanand

    To implement this, you could persist a value in a temporary table from a certain mapping and then read the value from another mapping that uses that value as an input parameter (if they run sequentially from a process flow, for example).
    Regards:
    Igor

  • Accessing Var from main Nib/Class - [global variables]

    I'm sure this is a simple solution and the problem is I'm just not thinking right. I just started programming in Objective C but have come a long way in the past 2 weeks. Pretty extensive knowledge in C# and some java.
    Anyways, I've been creating an app and have streams working, CFNetwork working, network services discovery working and a tab bar with a custom View controller linking to one of the tab-bar buttons.
    So when you click on one of the tab bar items it opens a new nib file. That nib loads a table view. When nib loads it hits a method which starts looking for network services and updates the table when it finds some.
    Now the idea is is to have a selector on the cell and when you choose the service it adds same variable info, ip and port, back to a global variable which can be used through the entire app and all extra loaded nib files.
    Out of all this, I don't know how to access global variables....prob should be the simplest thing to do out of all I've done. I have ideas of how it should be done but don't know how to access it.
    Idea would be:
    MainWindowNib has NSString var that is public with a getter setter. But how can I access that MainWindowNib var from a SecondView.nib file/class. There a way to get the parent of the secondView.Nib? I have no clue.
    Any help would be great!
    Thanks!

    I'm still a bit confused how you access that method.
    Main.nib class : UIApplication
    NSString *port
    SetupView.nib : NSViewController
    view
    -TableView added to view
    -Seperate NSObject for TableViewDelegates
    -When item selcted, pass NSString to [main port]
    How do I get a pointer to port. I don't really understand how to do this with objective C.
    In C# I would be something like: [Not exact syntax but u get the idea]
    public Main : Form
    public string port{get;set;}
    Main()
    sView SeconddForm = new SecondForm(this);
    public SecondForm : Form
    SecondView(Main main)
    main.Port = "8080";
    Message was edited by: Clarke76
    Message was edited by: Clarke76

  • Global Variables in Flash CS4 (AS3) ?

    Hi,
    I  have another problem with my new project and I am looking to get answers for these two question:
    1.) Is there a way to define a global variable which can be accessed inside and movie clip or button? (where do you define it? is it changeable? can you pass it in by reference?)
    2.) If i have my main stage with some actionscript and a movie clip which has also some action script, IN WHICH ORDER does it execute?
    Thank you in advance for any help and tips!

    Thank you this is what i needed I got it to work now!
    But I do still have one last question on this topic.
    This is the Code:
    //this is in a file Actionscript File called glo.as
    package{
         public class glo{
              public static var widthOfSlider:Number = 5;
    // This code is in scene 1 > my_mc
    import glo;
    trace(glo.widthOfSlider);
    //This code is in scene 1 > my_mc > myNext_mc
    import glo;
    var numOfCovers = 6;
    var temp = glo.widthOfSlider;
    trace(glo.widthOfSlider);
    this.addEventListener(Event.ENTER_FRAME, centerB);
    function centerB(event:Event):void{
         for(var i = 0; i < numOfCovers ; i++ ){
              this["cover_btn_"+String(i)].y = 0;
              this["cover_btn_"+String(i)].x = temp;
              temp += this["cover_btn_"+String(i)].width + 5;
         glo.widthOfSlider = temp;
         trace(glo.widthOfSlider);
         this.removeEventListener(Event.ENTER_FRAME, centerB);
    When I run this I get the following output:
    5
    5
    5
    725.45
    725.45
    The first "5" is from the trace(glo.widthOfSlider); in scene 1 > my_mc
    The next two "5"'s are from the trace(glo.widthOfSlider); in scene 1 > my_mc > myNext_mc
    Is there a way so that I can first execute the code in scene 1 > my_mc > myNext_mc before the code in scene 1 > my_mc ?
    I am trying to get 725.45 through the trace(glo.widthOfSlider); in scene 1 > my_mc

  • Global Variables passing from standard form for use on custom form

    Hi,
    I'm trying to grab a value from a standard form, and pass it to a new custom form, which I am opening automatically from the standard form via personalizations. Is anyone aware of a way to send a value from one form to another? I was going to try using a global variable, which it looks like you can set through personalization. I tried doing it by passing the value as a form parameter, which works if I hard code a value, but it doesn't work if I refer to a value from the standard form.

    in your E-Business-environment may exist some special codings, which you have to think of, when passing parameters through the application.
    Copy the question to your EBS-Forum. They know ways using personalization and passing parameters

Maybe you are looking for

  • Sending a file from R/3 to Enterprise portal Knowledge Managemen repository

    hi all, I have a requirement to place a PDF file (may be any file need not be only PDF ) generated from an RFC, on to the portal KM. Is there any way to do this? Please revert back with any queries if you have...... I know a way to do this but this t

  • Function f3 works in strange way with external monitor

    The Fn F3 seems to send the screen from the laptop to an external monitor, Pressing the Fn f3 again takes the screen in the external monitor back to laptop. Here is where the problem begins, If pressed again as before, it does not work properly. It s

  • Knowledge on Transaction log ?

    Hi All, I have couple of questions? Question-1: I need to know will running import/export wizard increase the T-log growth? OR will running simple select statement increase the T-log. To my little knowledge data modification (insert, update, or delet

  • Alternative to Apogee Duet?

    I think I'm ready to move on from Duet. It sounds great, but I just seem to spend too much time listening to static. I'm sure there's an answer to this and I usually can get things working very nicely in the end- but not for long. I would really pref

  • Quick Edit Adjustments not working PSE 13

    In PSE 13, I use quick edits Adjustments.  While putting the cursor over the options (ex.  Smart Fix at 87) it shows on the image but if you click it to say apply, it doesn't apply.  You can't hit "auto" or toggle the switches; the adjustment just ne