Applescript question about variables

I have a command in AppleScript that goes like this
                              set focus check box "/app/con[0]/ses[0]/wnd[0]/usr/chk[1,12]"
I would like to make the "12" a variable, and pass a new value by putting it in a loop
Something like
                              set focus check box "/app/con[0]/ses[0]/wnd[0]/usr/chk[1,x]"
Any suggestions to how to pass variable x in a string?
Thank you for your time

"/app/con[0]/ses[0]/wnd[0]/usr/chk[1," & x & "]"
Proof:
set x to 12
"/app/con[0]/ses[0]/wnd[0]/usr/chk[1," & x & "]" = "/app/con[0]/ses[0]/wnd[0]/usr/chk[1,12]" --> true
Message was edited by: Pierre L.

Similar Messages

  • Question about variable names

    k, so I have a for() loop that I want to take the value of String fs1 through String fs21 and add them in that order to a String fs. So, my question is, can you do this in a loop? you can do it in PHP, and that's what I'm accustom to.
    this is kinda what I want to make
    String fs = "";
    String fs1 = "foo";
    String fs21 = "bar";
    for(int i = 0; i<22;i++)
         fs+= (the variable "fs" plus the number of "i", so like fs1, fs2, fs3. . . fs21);
    System.out.println(fs);

    I think you want to use and array and be careful about using += that way.
    StringBuffer buffer = new StringBuffer();
    String[] fs = new String[2];
    String fs[0] = "foo";
    String fs[1] = "bar";
    for(int i = 0; i<22;i++)
         buffer.append(fs);
    return buffer.toString();

  • Question about variable declaration

    Hi all,
    I have a (in fact, two) question(s) about the declaration of variables inside of time-critical code, like render loops or similars.
    Does it really matter to use
    for (int k=0; k<1000; k++)
         for (int l=0; l<1000; l++)instead of
    int k;
    int l;
    for (k=0; k<1000; k++)
         for (l=0; l<1000; l++)concerning the speed of the app? What about doing this with non-basic types -> Objects, like to say Strings ?
    And are there any resources where I can find out more about that and other things like that ?
    Uhm, now it became three q's... Sorry to bother you ;-)
    Skippy

    whoo, maybe I got something totally wrong here.
    Does this mean that
    Image blah;
    for (int i=0; i<100; i++) blah = getImage("test"+i+".gif");will clean up a lot, because there are non-referenced Images and Strings?
    Hmm, anyone told me that
    for (int i = 0; i<100; i++)
    String test = "test"+i;
    System.out.println(test);
    }is disastrous code.
    Damn, ever thought to be a good Java programmer, but every day I get new thoughts I cannot solve these days...
    grmph
    Skippy

  • Question about variable scope

    Suppose theres a class that mixes colors.
    It has an constructor and two methods:
    public class ColorMix {
    //This is just an example but I've tried this and colors
    mix and show up correctly.
    public ColorMix() {
    cmColor = MixColors();
    } //e_constr
    private void mixColors() {
    //do something
    Color1 = createColors();
    Color2 = createColors();
    //etc
    private Color createColors() {
    //create some color-values
    //r, g and b ...
    Color anColor = new Color (r, g, b) //finally create color
    return anColor; //and return that color
    public Color cmColor;
    } // e_class_ColorMix
    My question is: Howcome and how the variable
    'anColor' is referred from the createColors-method to
    the mixColors-method?!? I thought that anColor would
    be out of scope, since its created in the createColors
    I've understood it would be erased once createColors
    is done with?!?
    Or did MixColors make it to the 'anColor' before garbage
    collector?
    Thanks,
    Jani

    I think you are mixing up variables and objects. A variable (like "anColor" in your example) is not the same as an object. A variable is just a reference to an object that exists somewhere in memory.
    Objects are eligible for garbage collection if the running program does not hold any reference to the object anymore.
    Your createColors() method creates a new object of type Color and stores a reference to it in the variable anColor. Then it returns the value of the variable (which is the reference to the Color object) to the calling method: mixColors. There you have another variable (Color1) which will hold the reference to the object.
    So the variable anColor goes out of scope at the end of method createColors(), but the program still has a reference to the object, stored in variable Color1.
    The object is still referenced by the program and will therefore not be garbage collected.
    I'd suggest you read the Java Tutorial: http://java.sun.com/docs/books/tutorial/java/index.html
    Jesper

  • Question about variables in TEXTCOLUMNS !!!HELP

    Hi friends,
    can somebody tell me if it is possible to put varaibles in textcolumns(VARCHAR2)
    like 'Das Fondsvolumen des Fonds betrdgt <Fondsvolumen>' (Fondsvolumen ist the variable--> which is a column of another table in the DB)
    into the database which will be evaluated when you query the column with the text????
    Is that possible and if yes how????
    thanxx
    Schobbi

    Schobbi,
    You could use a view for the
    selection part to replace
    your variables with the concrete
    values. Write a function that returns
    those values/the whole string and use
    it in this view, if you like.
    Hope this helps,
    Karsten

  • Question about Variables

    This is probably a fairly simple question, but I've never seen any documentation on it so I'm not sure of the answer.
    Let's say I have the following code:
    var myLoader:URLLoader;
    function someFunction(){
         myLoader = new URLLoader();
         myLoader.addEventListener(Event.COMPLETE, onComplete);
         myLoader.load(new URLRequest("something"));
         function onComplete(e:Event):void{
              //Some Code.
    function someOtherFunction(){
         myLoader = new URLLoader();
         myLoader.addEventListener(Event.COMPLETE, onComplete);
         myLoader.load(new URLRequest("somethingElse"));
         function onComplete(e:Event):void{
              //Some Code.
    My question is, would it be possible for these two URLLoaders to interfere with each other, for instance if they were executed at the same time--even though they're confined to different functions? Thanks for the help.

    that code is problematic.  you only have one reference for two (or more) urlloaders.
    if you only need one, use one:
    var myLoader:URLLoader=new URLLoader();
    function someFunction(){
         myLoader.addEventListener(Event.COMPLETE, onComplete);
         myLoader.load(new URLRequest("something"));
         function onComplete(e:Event):void{
              //Some Code.
    function someOtherFunction(){
         myLoader.addEventListener(Event.COMPLETE, onComplete);
         myLoader.load(new URLRequest("somethingElse"));
         function onComplete(e:Event):void{
              //Some Code.
    if you need more than 1, give them different references.

  • 1 simple question about variable

    I want to make a query. when I open this query, I want to use a variable, that when I open it, the weeknumber automatically is filled in. How can i do that?Does SAP deliverd this already?(SAP-exit)How can I make one?Do I have to use customer exit?

    Hi K,
    For achieving this you have to use a Customer Exit Variable with Default Value. Do you want to fill it with the same week every time or is it current week. If it is the same week everytime then default value will help.
    But if you want to use Current Week then you SAP Exit Variable "Current Calander Week - 0CWEEK". This variable denotes the current calendar week in format YYYYWW.
    Hope this helps.
    Bhargava

  • Very easy question about variables

    Can I convert float-variable to String-variable?

    Hi, a very easy way to convert almost anything is
    called "typecasting". It might sound difficult, but
    it isn't.
    You use it like this example
    > String outcome;
    Double input;
    input = 3.54789654587;
    Output = ""+input;
    That's not casting. It's implicit formatting.
    What it does is making an empty string and pasting
    your number behind it. VERY easy! You can do this
    with allmost every type of variables.What it's doing is creating a StringBuffer, appending an empty string to it, then appending the result of calling toString on the Double, which is itself a String. (Though things change a bit in jdk1.5.) It works because StringBuffer.append has versions for each primitive type, and toString exists for all Objects.
    One problem is that it's not efficient -- you're doing a lot of work behind the scenes to do something that can be done much more simply. But the bigger problem is that it's using operators in a roundabout way and with implicit results. So it's sort of a hack. "+" is the append operator for Strings (well it actually comes down to an implicit method call, or several). Putting the double on the right side of that also causes an implicit format. So you're implicitly formatting a value, and then appending it to nothing, to get a result. You're not actually meaning to append, you're meaning to format, but you're using an append operator.
    The more straightforward way to do it is simply to explicitly format it, using the methods already shown on this thread, or using java.text.DecimalFormat.

  • Question about variables inside methods

    I just want to be sure that I'm clear on something.
    I have a method that is called inside a class, the local variables
    get initialized with my initial values.
    When the method exits, those local variables get marked with
    a zero reference count and are available for GC when the garbage
    collector runs.
    Correct?
    Thanks.
    -brad w.

    when the method destroy,local variable destroy too .In the stack,when stack.pop(),the reference to the object still exists , though object has been removed.according to this , memory leak will appear .SO we should do something like this.
    Stack stack=new Stack(1000);
    for(int a=0;a<1000;a++)
    stack.push(new Integer(a));
    for(int a=0;a<1000;a++)
    System.out.println(stack.pop());
    public Object pop(){
    if(size==0)
    throw new EmptyStackException();
    Object object=elements[--size];
    elements[size]=null; //eliminate  the reference out of life
    return object;
    /code]
    affter that ,the garbage collector can do something what he want to do                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            

  • Question about variable copying, referencing and LinkedList constructors.

    Is there any advantage in this recommendation?
    "In general, do make sure that you copy mutable arguments and mutable return values when appropriate."
    Now, according to this suggestion:
    public ClassName(LinkedList<String> list)
         this.list = new LinkedList<String>(list);
    Instead of public className(LinkedList<String> list)
         this.list = list;
    }I am confused about the situation where using the copy constructor would be appropriate as opposed to the second method.
    Can someone please explain which would be an ideal situation to use a copy constructor and when to use mere assignment?

    fantastic_ray wrote:
    Is there any advantage in this recommendation?
    "In general, do make sure that you copy mutable arguments and mutable return values when appropriate."If you don't copy mutable arguments and return values, then when you change the state ("contents") of the object, it will be seen by both the original reference and the copy. Sometimes you may want this. Sometimes you may know that no change will occur. You have to judge what's appropriate for your use. In general, though, if there's a chance the elments' states may change, you'll want to copy them.
    >
    Now, according to this suggestion:
    public ClassName(LinkedList<String> list)
         this.list = new LinkedList<String>(list);
    Instead of public className(LinkedList<String> list)
         this.list = list;
    It depends. After you do new ClassName(list), if the code that created the ClassName object is going to keep using the list and you don't want any changes it makes to be seen by the new object and vice versa, then yes, you'd want to do the former.

  • A question about variables and where I should put them!

    Hi, I'm fairly new to java. I'm a first year computer scientist and I'm struggling with where I should put my variables.
    So far on the course I've been able to wing it as we have not been doing object orientated programming, it was more like programming in fortran!
    Anyway if you look at the code below, I need the variables 'speed', 'distance', 'time' and 'tottime', to be calculated in my seperate methods, but then called in my main part to be printed out; however I have no idea where I put them to get this to work!
    The program is by no means complete, it's still a work-in-progress, but I need to get this sorted before I continue.
    Thanks in advance
    /////  LogName: gxm07u
    /////  FullName:
    /////  CreationDate: 2007-11-07 09:30:07
    import java.io.*;
    public class travel {
        public static void printMenu()
             System.out.println("Travel Program\n\nn: Enter a journey\ns: Get complete journey stats\nd: Get Distance travelled stats\nq: quit");
        public static void RoadMenu()
             System.out.println("Type the road type:\nType m: Motorway\nType a: A road\nType b: B road\nType u: Urban road");
        public static void enterRoadType()
             char choice;
             choice = UserInput.readChar();
             switch(choice)
                  case 'm': //motorway
                  case 'M':
                       speed = 85;
                  break;
                  case 'a': // a road
                  case 'A':
                       speed = 70;
                  break;
                  case 'b': //b road
                  case 'B':
                       speed = 55;
                  break;
                  case 'u': // Urban road
                  case 'U':                                     
                       speed = 40;
                  break;     
        public static void enterDistance()
             System.out.println("Type the travel distance: ");
             distance = UserInput.readDouble();
        public static void calcTime()
             time = speed/distance; // time in hours
             tottime = tottime + time; //total time in hours         
        public static void main(String[] argv) {
              int speed = 0;
              double distance = 0;
              double time=0, tottime=0;
         } // end of main
    } // end class

    Your calcTime() can't see variables local to other methods you either need to make them global or pass them in as parameters. To make them global:
    public class travel {
         int speed = 0;
         double distance = 0;
         double time=0, tottime=0;
        public static void printMenu()also you're main method should create a instance of the class
        public static void main(String[] argv) {
    new travel();
    }BTW it's convention to make class names begin with a uppercase letter. Also, look at using the equalsIgnoreCase() for your switch statement as it could save you 4 cases.
    Hope this helps

  • Jsalonen, I have another question about variable.

    I am a beginner of java
    CpmmPortIdentifier.java, which come from sun's standard API ,but when I compiled it, javac give me an error message:
    incompatible types
    found : int
    required: boolean
    if(ret){
    but when I change ret as boolean,
    the compiler show me that
    found: boolean
    required : int
    I know ret could not be defined as boolean when it's appeared in switch(ret), how can I deal with it?
    I think I can use a different variable, but how ?
    here is the section of the program :
    ===================================
    int ret;
         if (ret) {
         maskOwnershipEvents = true;
         switch(ret) {
         case 0:
              fireOwnershipEvent(CommPortOwnershipListener.PORT_OWNED);
              break;
         case 1:
              fireOwnershipEvent(CommPortOwnershipListener.PORT_UNOWNED);
              break;
         case 2:
         fireOwnershipEvent(
                   CommPortOwnershipListener.PORT_OWNERSHIP_REQUESTED);
              break;
         maskOwnershipEvents = false;
    ===============================================

    CpmmPortIdentifier.java, which come from sun's standard APIDoesn't the Java Communications API come with compiled class files? I doubt you need to compile the source code.
    Sun's Java products often ship with incomplete source code that may not be compilable at some points. The distributed source code is not the code that was used to build the current version.

  • Noob Question about Variables

    Hello,
    I have an element called "element1" and inside it is another
    element called "element2"
    main
    └element1(contains variable "var")
    └element2
    note:both elements are movieclips, not buttons
    As shown in my diagram, variable "var" is set up inside
    element1's actionscript
    and I want to be able to control "var" from element2
    I could use _global. but I don't want to control all the
    variables named "var" in my file
    what should I do?

    _global is not in AS3, so you wouldn't be able to use it
    anyways. And var is a reserved term so you'd be hitting a wall
    there too. If element2 is contained within element1, then to affect
    the var in element1 from element2 you would use:
    MovieClip(this.parent).variable = whatever

  • Hi, I have quick question about use of USEBEAN tag in SP2. When I specify a scope of SESSION for the java bean, it does not keep the values that I set for variable in the bean persistent.Thanks,Sonny

     

    Make sure that your bean is implementing the serializable interface and that
    you are accessing the bean from the session with the same name.
    Bryan
    "Sandeep Suri" <[email protected]> wrote in message
    news:[email protected]..
    Hi, I have quick question about use of USEBEAN tag in SP2. When I
    specify a scope of SESSION for the java bean, it does not keep the
    values that I set for variable in the bean persistent.Thanks,Sonny
    Try our New Web Based Forum at http://softwareforum.sun.com
    Includes Access to our Product Knowledge Base!

  • Question about session variables and binding

    Hi All,
    I'm a newbie with Application Express. I've gone through several tutorials and a book, and now I'm actually getting started with apex. My first adventure is a tiny little form, where all you do is fill it out and it sends an email. Pretty simple.
    And, i have it working just fine - but I have a question about something I don't quite understand. Basically, I am generating the email text in a page process. And some of the form fields work fine if i reference them as *:ACCT_NAME*, but some give me the dreaded "not all variables bound" error. For the ones that give me the error, I can reference them like V('ACCT_NAME').
    So, as a newbie, I'm a little confused. When is it appropriate to use the V function, and when it is appropriate to use binding? Why would one of the fields work with binding but not another from the same form?
    Thanks for any clarification you can offer,
    Lisa

    Lisa,
    A bind variable is a place holder variable available in an environment.It is used quite frequently(outside Apex Context) in SQL and PLSQL scripts and especially in Dynamic SQL statements.Many times using a bind variable gives better performance. In the Apex environment,page items and many other variables related to the session are available as bind variables and hence their value can be referred in SQL,PLSQL contexts as :VARIABLE_NAME.
    Now V() function is an apex specific function which returns the value of an apex session variable outside the apex environment. So as Machaan pointed out, it is used in
    procedures and triggers that gets called from within an apex session. This is required since the bind variables themselves are not directly available in the SQL environment but their values from the corresponding session can be accessed by this apex built-in function.
    The length of any Bind variable name is limited to 30 characters, this is a limitation inherited from Oracle SQL itself and hence session variables(page or application items) whose name has a length which exceeds 30 characters cannot be used as the :ITEM_NAME format. In such cases you would have to use the v() method again. This might be happening in your case.

Maybe you are looking for

  • SharePoint Foundation 2013 - March 2014 Update Issue - Need help

    We've just applied the SharePoint Foundation 2013 March 2014 Update, it always requires that we run the SharePoint Products Configuration Wizard at the end of install, but this time it's getting stuck at step 9 of 10 (the profile sync service cannot

  • Xmonad: noBorders works improperly with smplayer

    I am using this xmonad.hs, which is essentially brisbin33's with a few minor adjustments. The issue I have is that while applications such as Comix work fine "maximized" (i. e. neither borders nor any bars), for both SMplayer and MPlayer only the rig

  • Duplicate Records in CFMAIL

    I think I have done this before but I cannot remember the code or command. Bascially, I want ot output records in cfmail, identical to the cfoutput I have on the screen. I use the exact same code for the cfmail but it is duplicating everything 100 ti

  • Service product configuration

    Hi Experts, I have requirement to update characteristics of service product configuration in a service order, could you please let me know if you have any idea about any function modules and how to use them and what parameters need to pass to them. I

  • Blackberry 9320 was reformatted

    My Blackberry 9320 was reformatted. Whenever I plug into the PC the software didn't appear and all my files and contacts were lost but all applications are still here in the application management. I can still use it now but I'm not sure if the OS is