Applescript with multiple arguments

AFAIK, Terminal.app does not accept arguments. So, I need for AppleScript to accept some arguments, then open Terminal to run them. Something like this:
tell application "Terminal"
    activate
    set shell to do script arg1 arg2 arg3  in window 1
end tell
All I've been able to accomplish is:
tell application "Terminal"
    activate
    set shell to do script arg1 in window 1
end tell
Help please?

OK I have no idea how anyone is posting code now with this new ASC software but I can;t get it to work no matter what I do.
If I make two changes to your code I get the following output in the Terminal window, which seems to be what you want.
Last login: Thu Jul  3 07:59:35 on console
LIBMACLAPcaggiano  ~ %
LIBMACLAPcaggiano  ~ % /Applications/adbFire/adb  -s 192.168.1.196  shell
zsh: no such file or directory: /Applications/adbFire/adb
LIBMACLAPcaggiano  ~ %
The changes were (for testing)
set daddr to "192.168.1.196"
hardcoding in the ip address rather then getting it setting it from argv. I'm a bit confused you show a run handler, how is the script being called?
And second
set shell to do script "/Applications/adbFire/adb  -s" & space & daddr & space & " shell" in window 1
adding the -s right to the program string.
One last thing I run zsh not sure if that has any bearing here.
I suppose a screen shot is better then nothing
Actually you can pair down the command to
set shell to do script "/Applications/adbFire/adb  -s " & daddr & " shell" in window 1
no real need for the & space in there

Similar Messages

  • Cfexecute with multiple arguments

    Hello,
    I'm trying to encrypt a file with CFEXECUTE, using OpenSSL. When I run the code in the command prompt, it works fine and the new encrypted file appears in the correct folder. Also, I can run CFEXECUTE with OpenSSL with just one argument and it works fine. ie arguments="version". But the following does not return a value, nor does it create the new folder:
    <cfexecute name = "C:\Program Files (x86)\GnuWin32\bin\openssl"
        arguments = "aes-256-cbc -a -salt -in ""C:\Users\Dev2\Documents\My Stuff\OpenSSL\secrets.txt"" -out ""C:\Users\Dev2\Documents\My Stuff\OpenSSL\secrets2.txt"""
        variable = "result"
        timeout = "5">
    </cfexecute>
    <cfdump var="#result#">
    Any ideas?
    Pete

    BYW,
    This runs fine:
    <cfexecute name = "C:\Program Files (x86)\GnuWin32\bin\openssl"
        arguments = "list-standard-commands"
        variable = "result"
        timeout = "5">
    </cfexecute>
    <cfdump var="#result#">
    and so does this:
    <cfexecute name = "C:\Program Files (x86)\GnuWin32\bin\openssl"
        arguments = "version"
        variable = "result"
        timeout = "5">
    </cfexecute>
    <cfdump var="#result#">
    Maybe someone has a multiple argument example of CFEXECUTE that runs fine.
    I'd be interested to know.
    Pete

  • Implement Comparable with multiple arguments

    Is there a way of implementing Comparable<> with multiple different arguments to the Comparable generics?
    For example:
    public class Foo<K, V> implements Comparable<K>,
              Comparable<V>
    }The compiler complains with the error: "The interface Comparable cannot be implemented more than once with different arguments: Comparable<K> and Comparable<V>"
    Clearly, this cannot be done exactly like this, so I'm wondering if there is a different way of accomplishing the same functionality.
    Edited by: mgolowka on Apr 24, 2008 12:22 PM

    I'm working on creating a generic binary search tree. Currently I have this:
    public class BinarySearchTree<T extends Comparable<T>> implements Collection<T>
    }With the add() function, I can simply do add(T) that will use T's compareTo(T) method to find its place in the tree, however with the remove() and get() functions that I want to have would require an input of T, which isn't what I'm entirely looking for. I could change this to have a key/value pair so it's functionality is like a set, but I'm not sure if that's the best course of action. I could make it implement Map<K, V> to get that functionality...
    There is no time limit on this project as it is a part of a personal project.

  • Event Handlers which trigger functions with multiple arguments

    I am playing two video clips back to back. I have a few
    things which I need to do in between clips, so what I am doing for
    each is adding a handler for VideoEvent.COMPLETE, at which time i
    want to call a function which takes multiple arguments, like this:
    video.addEventListener(VideoEvent.COMPLETE,
    myFunction("1","2","3"));
    private function myFunction(var1:String, var2:String,
    var3:String):void
    video.removeEventListeners(VideoEvent.COMPLETE, myFunction);
    I've already figured out that getting rid of event handlers
    that trigger anonymous functions is impossible. Please don't tell
    me that it's impossible to remove them if functions require more
    than 0 arguments...

    "muskiemania" <[email protected]> wrote in
    message
    news:gc0pk0$jfb$[email protected]..
    >I am playing two video clips back to back. I have a few
    things which I need
    >to
    > do in between clips, so what I am doing for each is
    adding a handler for
    > VideoEvent.COMPLETE, at which time i want to call a
    function which takes
    > multiple arguments, like this:
    >
    > video.addEventListener(VideoEvent.COMPLETE,
    myFunction("1","2","3"));
    >
    > private function myFunction(var1:String, var2:String,
    var3:String):void
    > {
    > video.removeEventListeners(VideoEvent.COMPLETE,
    myFunction);
    > }
    >
    > I've already figured out that getting rid of event
    handlers that trigger
    > anonymous functions is impossible. Please don't tell me
    that it's
    > impossible to
    > remove them if functions require more than 0
    arguments...
    Any function that you add via addEventListener should expect
    exactly ONE
    argument, the event. And 99.958% of the time, you can take
    that event
    object and figure out exactly what you need to know.
    HTH;
    Amy

  • Call apt with multiple arguments

    Is it possible to call apt inside a java class and pass multiple .class files?
    For example:
    String[] args = new String[5];
    args[0] = "-nowarn";
    args[1] = "-XclassesAsDecls";
    args[2] = "-classpath";
    args[3] = System.getProperty("java.class.path");          
    args[4] = "packageName.FirstClass packageName.SecondClass";
    return Main.process(new MyAnnotationProcessorFactory(),args);Result of the above example is:
    error: Could not find class file for packageName.FirstClass packageName.SecondClass
    1 error

    The class path contains classes that we need.
    This example works:
    String[] args = new String[6];
    args[0] = "-nowarn";
    args[1] = "-XclassesAsDecls";
    args[2] = "-classpath";
    args[3] = System.getProperty("java.class.path");     
    args[4] = "packageName.FirstClass";
    args[5] = "packageName.SecondClass";
    return Main.process(new IapiAnnotationProcessorFactory(),args);I replaced args[4] = "packageName.FirstClass packageName.SecondClass"; with a
    args[4] = "packageName.FirstClass";
    args[5] = "packageName.SecondClass";

  • How to script an auto clicking program in AppleScript with multiple mouse locations

    I have no experience in scripting but I want to make an auto clicking program where it click in 3 different locations on the screen in a sequence. Is this possible with to do with apple scripts? I am using a MacBook Pro (15-inch, Mid 2012) OSX Yosemite.

    This is a python script wrapped in an Applescript.
    See the 3 mouseclick(x, y); commands near the end that clicks 3 positions on the menu bar.
    do shell script "
    python <<-END
    import sys
    import time
    from Quartz.CoreGraphics import *
    def mouseEvent(type, posx, posy):
            theEvent = CGEventCreateMouseEvent(None, type, (posx,posy), kCGMouseButtonLeft)
            CGEventPost(kCGHIDEventTap, theEvent)
    def mousemove(posx,posy):
            mouseEvent(kCGEventMouseMoved, posx,posy);
    def mouseclick(posx,posy):
            mouseEvent(kCGEventLeftMouseDown, posx,posy);
            mouseEvent(kCGEventLeftMouseUp, posx,posy);
    time.sleep(2);
    ourEvent = CGEventCreate(None);
    currentpos=CGEventGetLocation(ourEvent); # Save current mouse position
    mouseclick(5, 10);
    time.sleep(2);
    mouseclick(200, 10);
    time.sleep(2);
    mouseclick(300, 10);
    time.sleep(2);
    mousemove(int(currentpos.x),int(currentpos.y)); # Restore mouse position
    END

  • JNI callback funtion with multiple arguments

    Hi,
    Is it possible to return more than one argument in java callback function.
    for single arg return, I am using below function in my C code.
    jmethodID mid = (*env)->GetMethodID(env, cls, "callback", "(I)V");
    (*env)->CallVoidMethod(env, obj, mid, depth);
    what are the changes require to return more than one arg?
    Thanks in Advance
    Ashwani

    Is it possible to return more than one argument in java callback function.Of course. A 'callback function' is just a method like any other.
    what are the changes require to return more than one arg?1. Adjust the method declaration in the class you are calling.
    2. Compile the class.
    3. Run javap -s to see the new signature.
    4. Adjust the signature in GetMethod() accordingly in your code.
    5. Adjust the CallVoidMethod() call to pass the necessary parameters.

  • Call executable argument with multiple expressions

    I'm using the "call executable" step type in TS 4.2.  My normal command line works with windows [sflashldr com1 w 0 config.cfg binary.bin] where the bin file flashes my chip according to the cfg.  I think that this is a multiple argument expression... TestStand returns "cannot open file".
    How should the argument expression be configured?
    mcnearymw

    Hi mcnearymw,
    Is that the whole error message? If not it would be useful for us to see the entire error message.
    Also have you seen this White Paper? It might give you a better idea of how the Call Executable step works in TestStand. http://www.ni.com/tutorial/8847/en/ 
    Rachel M.
    Applications Engineer
    National Instruments

  • How to read multiple arguments separated with space in one line

    How to modify the
    public static void main (String[] args){
    }so that it can read multiple arguments separated with space in a single line?
    e.g.
    java myprogram username password host
    java myprogram2 ipaddress port
    Thx.

    public static void main (String[] args){
      int index = 0;
      for(String arg : args) {
        System.out.println("args["+(index++)+" = "+arg);
    }

  • Applescript list with multiple selections

    Hello guys, i have h big problem...
    i was trying the multiple selections part by the command list, but if i select 2- and more it does nothing (i'm using if x is y then *linebreake* else if ...)
    so i tried another way script:
    tell application "Finder"
      --get folders of me--
              set a to get name of folders of folder "Contents:Resources:Versionen" of (path to me) --in this folder i got folders named  {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"}--
              set b to choose from list a with prompt "Choose your Minecraft Version!" with multiple selections allowed
      --next step--
      count b
              set c to result
              repeat c times        --with this part i wanted to handle every selected folder as an individual to duplicate it somewere else
                        set ab to b * -1
      duplicate folder ab to folder (choose folder)
              end repeat
    end tell
    thanks for helping me

    The following script (tested under OS X 10.8.2) should do what you are asking for:
    tell application "Finder"
        set theSourceFolder to folder "Contents:Resources:Versionen" of (path to me)
        set theFolderNames to get name of folders of theSourceFolder
        set theChosenNames to choose from list theFolderNames with prompt "Choose your Minecraft Version!" with multiple selections allowed
        if result is false then return
        set theDestinationFolder to choose folder
        repeat with thisName in theChosenNames
            duplicate folder thisName of theSourceFolder to theDestinationFolder with replacing
        end repeat
    end tell
    Message was edited by: Pierre L.

  • Find and replace with multiple files and with a watch folder

    I am trying to create a watch folder that uses red_menace script to:
    1. Have a folder that receives multiple xml files that run the script one by one.
    2. then move the files to an output folder.
    I tried modifying the set TheFIle to choose file -- the original text file to:
    with multiple selections allowed
    But that doesn't seem to work. I know i'm missing a step. Any help is much appreciated!
    Thanks!
    The way i'd like to setup things is having an input folder on the desktop (or just have the application on the desktop and I can drag the files onto it), and let it do it's thing. Once it's done have it export the xml files into an output folder.
    Here's what i got so far:
    on open
    set TheFIle to choose file -- the original text file
    set TheFolder to ("Macintosh HD:Users:user1:Desktop:out") -- the folder for the output file
    set TheName to (GetUniqueName for TheFIle from TheFolder) -- the name for the output file
    set TheText to read TheFIle -- get the text to edit
    set Originals to {"KPCALDATE", "KPCALEVENT", "KPCALDAY", "KPCALBODY", "obituaries name", "" & return & "</cstyle></pstyle>" & return & "<pstyle name=\"obituaries text\"><cstyle>", "<pstyle name=\"obituaries text\"><cstyle name=\"Graphics Bold leadin\" font=\"ADV AGBook-Medium 2\">", "<pstyle name=\"Recipe Ingredients\"><cstyle>", " .com", " .net", " .org", " .edu", "www .", "www. ", "Ho- nolulu", "<pstyle name=\"kicker 12\"><cstyle allcaps=\"1\">fashion news</cstyle><cstyle allcaps=\"1\">" & return & "</cstyle></pstyle>" & return & "", "<component name=\"Headline 1\" type=\"Headline\">" & return & "<header>" & return & "<field name=\"Component name\" type=\"string\" value=\"Headline 1\"/>" & return & "<field name=\"Component type\" type=\"popup\" value=\"Headline\"/>" & return & "</header>" & return & "<body>" & return & "<pstyle name=\"hed STANDARD 36\"><cstyle>", "<pstyle name=\"obituaries text\"><cstyle allcaps=\"1\">", "<pstyle name=\"obituaries text\"><cstyle name=\"Graphics Bold leadin\">", "<pstyle name=\"tagline\"><cstyle>-", "-", "
    Per serving:", "<pstyle name=\"Titlebar - mini, red\"><cstyle allcaps=\"1\">NATION & World </cstyle><cstyle allcaps=\"1\">Report</cstyle><cstyle allcaps=\"1\">" & return & "</cstyle></pstyle>" & return & "", "</cstyle></pstyle>"} -- the terms that can be replaced
    set Replacements to {"subhed", "subhed", "subhed", "Normal", "obituaries text", ", ", "<pstyle name=\"obituaries text\"><cstyle name=\"Graphics Bold leadin\" font=\"ADV AGBook-Medium 2\">", "<pstyle name=\"Recipe Ingredients\"><cstyle>
    ", ".com", ".net", ".org", ".edu", "www.", "www.", "Honolulu", "", "<component name=\"Headline1\" type=\"Headline\">" & return & "<header>" & return & "<field name=\"Component name\" type=\"string\" value=\"Headline1\"/>" & return & "<field name=\"Component type\" type=\"popup\" value=\"Headline\"/>" & return & "</header>" & return & "<body>" & return & "<pstyle name=\"hed STANDARD 27\"><cstyle>", "<pstyle name=\"obituaries text\"><cstyle allcaps=\"1\">", "<pstyle name=\"obituaries text\"><cstyle name=\"Graphics Bold leadin\">", "<pstyle name=\"tagline\"><cstyle>—", " —", "
    Per serving:", "","" & return & "</cstyle></pstyle>"} -- the replacement terms
    repeat with AnItem from 1 to count Originals
    set TheText to (replaceText of TheText from (item AnItem of Originals) to (item AnItem of Replacements))
    end repeat
    try -- write a new output file
    tell application "Finder" to make new file at TheFolder with properties {name:TheName}
    set OpenFile to open for access (result as alias) with write permission
    write TheText to OpenFile starting at eof
    close access OpenFile
    on error errmess
    try
    log errmess
    close access OpenFile
    end try
    end try
    end open
    to GetUniqueName for SomeFile from SomeFolder
    check if SomeFile exists in SomeFolder, creating a new unique name if needed
    parameters - SomeFile [mixed]: a source file path
    SomeFolder [mixed]: a folder to check
    returns [text]: a unique file name and extension
    set {Counter, Divider} to {"00", "_"}
    -- get the name and extension
    set {name:TheName, name extension:TheExtension} to info for file (SomeFile as text)
    if TheExtension is missing value then set TheExtension to ""
    set TheName to text 1 thru -((count TheExtension) + 2) of TheName
    set NewName to TheName & "." & TheExtension
    tell application "System Events" to tell (get name of files of folder (SomeFolder as text))
    repeat while it contains NewName
    set Counter to text 2 thru -1 of ((100 + Counter + 1) as text) -- leading zero
    set NewName to TheName & Divider & Counter & "." & TheExtension
    end repeat
    end tell
    return NewName
    end GetUniqueName
    to EditItems of SomeItems given Title:TheTitle, Prompt:ThePrompt
    displays a dialog for multiple item edit (note that a return is used between each edit item)
    for each of the items in SomeItems, a line containing it's text is placed in the edit box
    the number of items returned are padded or truncated to match the number of items in SomeItems
    parameters - SomeItems [list]: a list of text items to edit
    TheTitle [boolean/text]: use a default or the given dialog title
    ThePrompt [boolean/text]: use a default or the given prompt text
    returns [list]: a list of the edited items, or {} if error
    set {TheItems, TheInput, TheCount} to {{}, {}, (count SomeItems)}
    if TheCount is less than 1 then return {} -- error
    if ThePrompt is in {true, false} then -- "with" or "without" Prompt
    if ThePrompt then
    set ThePrompt to "Edit the following items:" & return -- default
    else
    set ThePrompt to ""
    end if
    else -- fix up the given prompt a little
    set ThePrompt to ThePrompt & return
    end if
    if TheTitle is in {true, false} then if TheTitle then -- "with" or "without" Title
    set TheTitle to "Multiple Edit Dialog" -- default
    else
    set TheTitle to ""
    end if
    set {TempTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, return}
    set {SomeItems, AppleScript's text item delimiters} to {SomeItems as text, TempTID}
    set TheInput to paragraphs of text returned of (display dialog ThePrompt with title TheTitle default answer SomeItems)
    repeat with AnItem from 1 to TheCount -- pad/truncate entered items
    try
    set the end of TheItems to (item AnItem of TheInput)
    on error
    set the end of TheItems to ""
    end try
    end repeat
    return TheItems
    end EditItems
    to replaceText of SomeText from OldItem to NewItem
    replace all occurances of OldItem with NewItem
    parameters - SomeText [text]: the text containing the item(s) to change
    OldItem [text]: the item to be replaced
    NewItem [text]: the item to replace with
    returns [text]: the text with the item(s) replaced
    set SomeText to SomeText as Unicode text -- TID's are case insensitive with Unicode text
    set {TempTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, OldItem}
    set {ItemList, AppleScript's text item delimiters} to {text items of SomeText, NewItem}
    set {SomeText, AppleScript's text item delimiters} to {ItemList as text, TempTID}
    return SomeText
    end replaceText
    Message was edited by: gamebreakers

    When you use the open or adding folder items to handlers, you need to add the parameters for the file items passed to them.
    I'll go ahead and post the applet/droplet version of my original script from the previous topic for reference:
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px; height: 340px;
    color: #000000;
    background-color: #FFEE80;
    overflow: auto;"
    title="this text can be pasted into the Script Editor">
    -- search and replace multiple items applet/droplet/folder action
    -- the terms to replace - edit as needed
    property EditableItems : {¬
    "one", ¬
    "two", ¬
    "three", ¬
    "four", ¬
    "five", ¬
    "six", ¬
    "seven", ¬
    "eight", ¬
    "nine", ¬
    "ten", ¬
    "eleven", ¬
    "twelve", ¬
    "thirteen", ¬
    "fourteen", ¬
    "fifteen", ¬
    "sixteen", ¬
    "seventeen", ¬
    "eighteen", ¬
    "nineteen", ¬
    "twenty"}
    -- the folder for the output file(s) - change as needed
    property TheFolder : (path to desktop)
    property LastEditItems : EditableItems
    on run
    the applet/droplet was double-clicked
    open (choose file with multiple selections allowed)
    end run
    on open TheItems
    items were dropped onto the applet/droplet
    parameters - TheItems [list]: a list of the items (aliases) dropped
    returns nothing
    repeat with AnItem in TheItems
    ReplaceMultipleItems from AnItem
    end repeat
    end open
    on adding folder items to this_folder after receiving these_items
    folder action - items were added to a folder
    parameters - this_folder [alias]: the folder added to
    these_items [list]: a list if items (aliases) added
    returns nothing
    repeat with AnItem in these_items
    ReplaceMultipleItems from AnItem
    end repeat
    end adding folder items to
    to ReplaceMultipleItems from SomeFile
    replace multiple text items in SomeFile
    parameters - SomeFile [alias]: the file to replace items in
    returns nothing
    set TheName to (GetUniqueName for SomeFile from TheFolder) -- the name for the output file
    set TheText to read SomeFile -- get the text to edit
    set Originals to (choose from list EditableItems default items LastEditItems with prompt "Select the terms to replace:" with multiple selections allowed) -- the specific terms to replace
    set LastEditItems to Originals
    set Replacements to (EditItems of Originals with Title given Prompt:"Edit the following replacement terms:") -- the replacement terms
    repeat with AnItem from 1 to count Originals
    set TheText to (ReplaceText of TheText from (item AnItem of Originals) to (item AnItem of Replacements))
    end repeat
    try -- write a new output file
    tell application "Finder" to make new file at TheFolder with properties {name:TheName}
    set OpenFile to open for access (result as alias) with write permission
    write TheText to OpenFile starting at eof
    close access OpenFile
    on error errmess
    try
    log errmess
    close access OpenFile
    end try
    end try
    end ReplaceMultipleItems
    to GetUniqueName for SomeFile from SomeFolder
    check if SomeFile exists in SomeFolder, creating a new unique name if needed
    parameters - SomeFile [mixed]: a source file path
    SomeFolder [mixed]: a folder to check
    returns [text]: a unique file name and extension
    set {Counter, Divider} to {"00", "_"}
    -- get the name and extension
    set {name:TheName, name extension:TheExtension} to info for file (SomeFile as text)
    if TheExtension is in {missing value, ""} then
    set TheExtension to ""
    else
    set TheExtension to "." & TheExtension
    end if
    set {NewName, TheExtension} to {TheName, (ChangeCase of TheExtension to "upper")}
    set TheName to text 1 thru -((count TheExtension) + 1) of TheName
    tell application "System Events" to tell (get name of files of folder (SomeFolder as text))
    repeat while it contains NewName
    set Counter to text 2 thru -1 of ((100 + Counter + 1) as text) -- leading zero
    set NewName to TheName & Divider & Counter & TheExtension
    end repeat
    end tell
    return NewName
    end GetUniqueName
    to EditItems of SomeItems given Title:TheTitle, Prompt:ThePrompt
    displays a dialog for multiple item edit (note that a return is used between each edit item)
      for each of the items in SomeItems, a line containing it's text is placed in the edit box
        the number of items returned are padded or truncated to match the number of items in SomeItems
    parameters - SomeItems [list]: a list of text items to edit
    TheTitle [boolean/text]: use a default or the given dialog title
    ThePrompt [boolean/text]: use a default or the given prompt text
    returns [list]: a list of the edited items, or {} if error
    set {TheItems, TheInput, TheCount} to {{}, {}, (count SomeItems)}
    if TheCount is less than 1 then return {} -- error
    if ThePrompt is in {true, false} then -- "with" or "without" Prompt
    if ThePrompt then
    set ThePrompt to "Edit the following items:" & return -- default
    else
    set ThePrompt to ""
    end if
    else -- fix up the given prompt a little
    set ThePrompt to ThePrompt & return
    end if
    if TheTitle is in {true, false} then if TheTitle then -- "with" or "without" Title
    set TheTitle to "Multiple Edit Dialog" -- default
    else
    set TheTitle to ""
    end if
    set {TempTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, return}
    set {SomeItems, AppleScript's text item delimiters} to {SomeItems as text, TempTID}
    set TheInput to paragraphs of text returned of (display dialog ThePrompt with title TheTitle default answer SomeItems)
    repeat with AnItem from 1 to TheCount -- pad/truncate entered items
    try
    set the end of TheItems to (item AnItem of TheInput)
    on error
    set the end of TheItems to ""
    end try
    end repeat
    return TheItems
    end EditItems
    to ReplaceText of SomeText from OldItem to NewItem
    replace all occurances of OldItem with NewItem
    parameters - SomeText [text]: the text containing the item(s) to change
    OldItem [text]: the item to be replaced
    NewItem [text]: the item to replace with
    returns [text]: the text with the item(s) replaced
    set SomeText to SomeText as text
    if SomeText contains OldItem then
    set {TempTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, OldItem}
    try
    set {ItemList, AppleScript's text item delimiters} to {text items of SomeText, NewItem}
    set {SomeText, AppleScript's text item delimiters} to {ItemList as text, TempTID}
    on error ErrorMessage number ErrorNumber -- oops
    set AppleScript's text item delimiters to TempTID
    error ErrorMessage number ErrorNumber
    end try
    end if
    return SomeText
    end ReplaceText
    to ChangeCase of SomeText to CaseType
    changes the case or capitalization of SomeText to the specified CaseType using Python
    parameters - SomeText [text]: the text to change
    CaseType [text]: the type of case desired:
    "upper" = all uppercase text
    "lower" = all lowercase text
    "title" = uppercase character at start of each word, otherwise lowercase
    "capitalize" = capitalize the first character of the text, otherwise lowercase
    returns [text]: the changed text 
    set SomeText to SomeText as text
    if CaseType is not in {"upper", "lower", "title", "capitalize"} then return SomeText
    return (do shell script "/usr/bin/python -c \"import sys; print unicode(sys.argv[1], 'utf8')." & CaseType & "().encode('utf8')\" " & quoted form of SomeText)
    end ChangeCase
    </pre>
    Edit: how does the choose from list dialog handle those big strings? I'm guessing not very well - is that why you avoided using them?
    Message was edited by: red_menace

  • Counting rows with multiple criteria

    I know this is a silly beginner question, but is there an easy way to count the number of rows in a table which match criteria based on different columns (sort of a countif with multiple criteria). For example, if Column A in a table has "All, Some, None" responses and Column B has "Main, Off" responses, is there an easy way to count the number of rows in which Column A has All and Column B has Off?

    Neondiet wrote:
    From an intellectual and philosophical view I agree with you. But from a practical view what I really want to do is just use one application for my spreadsheet tasks, not jump back and forth because one sheet I share with MS Windows users, and another with Numbers users, and another with OS X users who don't have Numbers or Excel but do have NeoOffice. Maybe I have to settle for that though.
    Yeah... this kind of situation stinks. Its like needing to writing software that will run on both Macs and PCs.
    Anyway, I've followed the advise in this forum and resorted to using a hidden column with concatenated values to solve my own problem, though it does seem like a bit of a hack compared to managing a single formula in a single cell. Horses for courses I suppose.
    jaxjason has posted a very elegant pivot table like solution that utilizes this technique. See http://www.numberstemplates.com/forums/showthread.php?t=36
    Btw, from what I've read on the net to date, SUM (in Excel) with an array formula answers the original authors problem of counting occurrences of values, not SUMPRODUCT; which I believe sums up the contents of cells in a range, if cells in other ranges match specific criteria.
    Yes, if you use the '*' (as indicated above) then SUM() is sufficient though SUMPRODUCT() will work as it degenerates to SUM when there is only one argument. If you use two arrays as arguments (like: = SUMPRODUCT((A1:A4="All"), (B1:B4="Off")), then SUMPRODUCT() is necessary. Here's my understanding of how it works (I hope your able to follow my abuse of algebraic techniques):
    =SUM((A1:A4="All") * (B1:B4="Off"))
    expanding the array expressions...
    =SUM((A1="All", A2="All", A3="All", A4="All") * (B1="Off", B2="Off", B3="Off", B4="Off"))
    at this point Excel computes the equality expressions, for example...
    =SUM((TRUE, FALSE, TRUE, FALSE) * (TRUE, TRUE, FALSE, FALSE))
    expanding the array multiplication...
    =SUM((TRUE * TRUE, FALSE * TRUE, TRUE * FALSE, FALSE * FALSE))
    Excel, apparently, then, when forced to multiply Boolean values, maps TRUE -> 1 and FALSE -> 0...
    =SUM((1 * 1, 0 * 1, 1 * 0, 0 * 0))
    performing the multiplications...
    =SUM((1, 0, 0, 0))
    summing...
    =1 + 0 + 0 + 0
    resulting...
    =1
    I'm afraid, now, if I continue any further, Yvan will chastise me.

  • Send multiple argument to backend method

    Dear All,
    I am trying to send the multiple arguments to backend server method using Remote Object. At the backend I am using Weborb for .net
    private function initWebOrb(event:AppEvent):void
        weborbCallback = event.callback;
    var method:String = event.data.method as String;
    var data:Array  = event.parameterdata;
    var op:AbstractOperation = remoteDataObject.getOperation(method);
    op.addEventListener("result", getListResultHandler);
    op.addEventListener("fault", onerrorweborb);
    op.arguments =data;
    op.send();
    but It shows the error unable to find method with name "Testmethod"  and the given argument types  at Weborb.Util.MethodLookup..........
    I have also tried.
    private function initWebOrb(event:AppEvent):void
       weborbCallback = event.callback;
    var method:String = event.data.method as String;
    var data:Array  = event.parameterdata;
    var op:AbstractOperation = remoteDataObject.getOperation(method);
    op.addEventListener("result", getListResultHandler);
    op.addEventListener("fault", onerrorweborb);
    op.send(data);
    I also tried to send the data as object
    var data:Object  = event.parameterdata;
    Note: I change the argument type accordingly while dispatching this event.

    try this
    <%
    int parameter=0;
    %>
    <f:invoke var="${bpmobject}" methodName="oper" retAttName="op" retAttScope = "Page">           
                   <f:arg value=<%= parameter> type="int"/>
    </f:invoke>
    the name of bpmobject passed in the arguments form ...
    edit : http://download.oracle.com/docs/cd/E13154_01/bpm/docs65/taglib/f/arg.html
    Edited by: cealex on Jan 24, 2010 5:34 AM - :pass "parameter" Parameter :)

  • Split on multiple arguments

    I'd imagine this question has been asked lots of times already, but couldn't really find an answer when searching the forum, se here it goes:
    I want to split a string on multiple arguments instead of only one.
    The aim of it is to do some (quite simple) tokenizing, and I want to split on whitespace, dots, comma's, question mark and all. (in total I'd say about 8 characters)
    Read somewhere that this would be possible with the split function, but can't find how.
    Is there an easy way, or do I need some looping in which I first split on one character, after that on the other?

    Igor_Pavlove wrote:
    And the pattern class looks quite useful as well, need to look into that one as well.Well, it defines the split("[/s.,?!:;]") argument thing. The docs for split() refer to it in the "see also" part and by talking about regex.

  • SUMIFS + multiple arguments for a condition.

    Hello,
    I have a function looking like this :
    =SUMIFS(Test :: $J,Test :: $I,"="&$A5,Test :: $E,"="&C$3,Test :: $C,"="&355)+SUMIFS(Test :: $J,Test :: $I,"="&$A5,Test :: $E,"="&C$3,Test :: $C,"="&360)+SUMIFS(Test :: $J,Test :: $I,"="&$A5,Test :: $E,"="&C$3,Test :: $C,"="&432)
    and I would like to know if I can get it shorter, something like :
    =SUMIFS(Test :: $J,Test :: $I,"="&$A5,Test :: $E,"="&C$3,Test :: $C,"="&(355,360,432))
    I tried multiple syntaxes, but none seems to work =/ The idea is that my last condition is valid when Test::*C is equal to 355 or 360 or 432.
    Additionally, I know the formula works if written : "="&355, but can someone tell me what is the meaning of the "&" and why a simple "="355 returns a syntax error ?
    Thanks a lot !

    If you're running out of columns on your main table, there's no reason the OR formula can't be placed on the Test table.
    The problem with the proposed condition: Test :: $C,"="&OR(355,360,432)
    is that the cell in Test C will meet that condition only if ti contains the boolean value TRUE.
    OR(n,n,n), where n is any number, returns FALSE only if all of the numbers are zero, and returns TRUE if any of the three arguments is a non-zero number.
    As the cell addressed by Test::$C always contains a number, not a Boolean value, the comparison (the number in) Test::$C is equal to (the Boolean value) TRUE will never itself be TRUE. As that condition never returns a TRUE value, none of the values in column J will be included in the SUMIF total.
    That SUMIFS conditions cannot accept multiple arguments is not true. Here's a small example. The Formula is shown in the entry box, the result in the selected cell (in a footer row), and the rows included in the sum are highlighted in yellow.
    Regards,
    Barry

Maybe you are looking for

  • Harddrive still active at power off

    Hello everyone, I'm having an unusual problem with my HP Mini. When I go to shut down the laptop, it will proceed to run through the process with no problems until the end--the harddrive will start to spinup again right after POWER OFF is issued, and

  • Low ink warning disable 6700 all in one

    I would like to know how to disable the low ink warning which comes on everytime I print. I would like the printer to stop keeping track of ink levels. I have a MAC if that makes a differance. 

  • WLS - MQ Series over SSL - is it possible?

    Hello friends, Does anyone know if there is any way to connect WebLogic Server to WebSphere MQ through SSL? If so, please give me a hint how to do it. I'm using a Foreign JMS Provider to connect to MQ and that works fine without SSL. Thanks in advanc

  • Create XML from XSD

    Hi, Is it possible to create and populate XML from an XSD without knowing what the XSD elements are beforehand (all the examples appear to know what the input XSD will be, and therefore know what the set and get methods should be called)? Can a user

  • HT1386 how do i update my ios 5.1 to 6 on my ipod touch 4gen

    how do i update my ios 5.1.1 t0 6 on my ipod touch 4gen