Filter by Variable - Embedded Applescript in Automator

I'm trying to make a workflow which when run will: Search my Downloads folder for .ash and .txt files, then search for files with the same name (and extension) in another folder (and its subfolders) called "New Location", and then move the new files from Downloads to the same place in "New Location" as the old files, replacing them.
*Currently my workflow looks like:*
•Get Value of Variable: Downloads folder
•Get Folder Contents
•Filter Finder Items +(for items with extension .txt or .ash)+
•Run Applescript 1 +(outputs first .txt or .ash file in Downloads folder)+
•Set Value of Variable: "File Name" +(Name of the new file. Could be the file itself if I need it to be)+
•Run Applescript 2 +(outputs file in "New Location" with same name as newly downloaded File)+
•Set Value of Variable: "The File" +(The file to be replaced)+
•Run Applescript 3 +(returns folder containing file in "New Location", may be "New Location" or one of its subfolders)+
•Set Value of Variable: "Container Folder"
•Get Value of Variable: "The File"
•Move Finder Items: To "Container Folder"
*Applescript 1*
on run {input, parameters}
set theFile to item 1 of (input)
theFile
end run
*Applescript 2*
on run {input, parameters}
set theFile to item 1 of (input)
tell application "Finder" to set filename to (name of theFile) as text
filename
end run
*Applescript 3*
Having trouble with this one. It needs to get the contents of "New Location", including the contents of its subfolders, but not the folders themselves, then filter those items to find the one (and there will only be one) with the same name as the downloaded file, and finally pass that on to the next action as a file (as opposed to text).
I originally tried using Get Specified Finder Items and then Filter Finder Items, but I can't filter by a variable. Which is what led me to try an embedded Applescript. Unfortunately I have no scripting experience, beyond what I picked up on the fly. The scripts above are bits and pieces I snipped and edited from other scripts I found on the web.
Thanks for your help!
Message was edited by: Boxes are Cool

Only one problem, I duplicated an ash file to downloads (and modified part of it to differentiate the copies) to test it, but the script doesn't seem to be setting it as "theNewFiles", with the variable returning {}. Any ideas? Or am I doing something wrong?
I really don't know. The script seems to work flawlessly in all my tests. Did you choose the right folder, the one called “New Location”, when asked by the script to choose a folder? Did the script work with some other files?
I'd also like to be able to run the script without intervention (possibly even as a folder action script)
Then the “choose folder” statement should be replaced with something like “set newLocation to POSIX file "/Users/curtisblack/Documents/New Location"” for example. The new Folder Action script (which should be attached to the Downloads folder) might then look like follows:
--BEGINNING OF SCRIPT
on adding folder items to thisFolder after receiving theseItems
set newLocation to POSIX file "/Users/curtisblack/Documents/New Location" -- or some other location
tell application "Finder"
set theNewFiles to files of thisFolder whose name extension is in {"txt", "ash"}
repeat with thisFile in theNewFiles
set thisName to name of thisFile
set theOldFiles to (files of the entire contents of folder newLocation whose name is thisName)
if theOldFiles is not {} then
move thisFile to container of item 1 of theOldFiles with replacing
end if
end repeat
end tell
end adding folder items to
--END OF SCRIPT
Message was edited by: Pierre L.

Similar Messages

  • AppleScript (or Automator?): How to search through online сhеss games?

    Hello.
    I would like to search for specific online сhеss games. Each game has a single adress. We are talking about millions of games. Obviously, it's far too long to index all the games. So I will set a limit and use the script at night. Conditions should be something like this:
    For adress example.com/game=NumberA to example.com/game=NumberB
    Search every web page containing SpecificWord
    Store wanted web adresses somewhere (so I could see the games by myself during the day)
    As you can see, I know nothing about Applescript and I don't know how to start, nor how the script can pick up adresses. I think it's possible and not difficult to code, just time consuming for the program to search through thousands of games.
    Should I use AppleScript or Automator? Should the script open Safari (or Firefox if possible) or can it search without any browser? Is it possible to simultaneously search through multiple pages/adresses? Maybe I could write several scripts for different ranges of games? If so, how many pages can I open at once? For instance I could disable images in Firefox to load quicker. How much time does it need to search for one game? 1, 2, 3, 4, 5 seconds?
    Any easy tutorials, examples of similar codes, advices, hints or tips are appreciated.

    Thanks for answering. Sorry that I was so unclear. My main problem was how to get urls and games id as variables. But then I thought there already should be programs doing web crawling. I have found Scrapy which use Python language.
    (Maybe I should edit my question, add Scrapy and Python as tags instead of applescript and automator. Is it possible?)
    I have Mac OS 10.6.8, Python 2.6.1. Scrapy needs at least Python 2.7 so I have downloaded the last version of Python (3.3).  I think I can handle the programming in Scrapy thanks to their tutorial. The most difficult part should be... how to install Scrapy. Don't laugh at me.
    I have entered "sudo easy_install Scrapy" in the terminal. But the terminal still uses Python 2.6.1. Python 3.3 is installed but I don't know how to clean update Python. If anyone knows, feel free...
    When I write scrapy in the terminal, here is what I get:
    Traceback (most recent call last):
      File "/usr/local/bin/scrapy", line 4, in <module>
        import pkg_resources
      File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/pkg _resources.py", line 2556, in <module>
        working_set.require(__requires__)
      File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/pkg _resources.py", line 620, in require
        needed = self.resolve(parse_requirements(requirements))
      File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/pkg _resources.py", line 518, in resolve
        raise DistributionNotFound(req)  # XXX put more info here
    pkg_resources.DistributionNotFound: lxml
    It seems Scrapy also needs something called lxml. Right now I am trying to make Python 3.3 the default python version. Is there a web crawler GUI which already includes Python, Scrapy, lxml?
    By default I also have Python 2.4 and 2.5. Does the system need them? I prefer not to delete system files but together all Python versions weigh 500 MB.
    In regard to the real example URL: let's say instantchess.com. Here's a game URL: http://www.instantchess.com/?EXP=1&GPI=84094532
    84094532 is the game id. Let's say I want to search every Reti openings (thus the page must contain the word "Reti") from id 84000000 to 85000000 and store games id in my computer. If I have understood correctly, I need to search through the source code of the pages.
    Feel free to add any remarks, suggestions, ideas.

  • Is there an Applescript or Automator action that can change Preferences in

    When I log on to my ISPs website to clean out my spam filter, the site redirects me to a second area that contains the filtered spam. Each time I access it I must change my "Accept Cookies from "Only sites you navigate to" to "Always". The problem is remembering to change it BACK. Is there an applescript or automator thingy that will allow me to to make these changes? I'm using Safari 3.1.2.
    Thank you.

    This question was answered in the Safari-for-Mac forum.

  • Applescript and automator

    I have studyed html for 3 days and wordpress for 3 days , word , excel for 5 days, and llustrator and photoshop 13 yeas ago for 6 months.
    and still now its so hard to understand some how.
    but I am in need of understading now with the printed documents from my computer.
    and I wonder , so there are many defferent way to communicate with anyone out side of the world, right?
    like I know email , fax, facetime,
    but there are other way now I think because of the documents I found.
    and also with applescript and automator can do anything possible like even the child can click one and start conecting etc..
    I have the copy from its ,
    does anyone have time to explain me what it is?
    It's not that of teenager who doesn't want paretns to know or else,
    but I am quite serious for my situations.
    Please Help !
    Mac OS snow leopard to lion to moutain lion,,,,,
    but I don't know when it started yet.

    Using JavaScript to script System Events wouldn't be any better, since it uses the same Apple Events mechanism (how well it uses it is another topic).  To hold down a key you would need to use something that has access to the deeper system APIs, most likely using Xcode.
    And yes, your code snippet will press the arrow key 5 times (I am guessing that the missing space in key code is a typo).  You can place the cursor in a bunch of text in another application such as TextEdit, and use your script to activate it before performing the key codes to get a better idea of what is happening (trying to reposition the cursor in the Script Editor will reveal a bug with the delay command).

  • Mounting a network share via Applescript or Automator causes errors in MS Office apps

    If I connect a network share using an automated process, either using Applescript or Automator, though the share shows up on the Desktop and I can open it and view the various folders and files, MS Office apps including Powerpoint, Excel and Word are unable to open the files.   Each gives a slightly different error message.  In Excel, it looks like this:
    In Word, it's:
    In Powerpoint, it's:
    BUT, if I connect to the server share manually (using Cmnd-K in Finder), all files and folders are properly accessible.  I cannot see any differences between the shares connected by the two different means on the Desktop.  They have the same name, are the same size, etc.; in short, everything about them seems identical.  I even took screen shots of the Get Info page from one of them connected by the different methods:
    "home" connected by Automator:
    and connected manually:
    Does anyone have any ideas as to why this is happening or how to fix it?

    I had the same issue. After upgrading kernel to 3.4.5 today the cifs share mounted with original fstab settings. I believe it was caused by this bug:
    kernel changelog wrote:    The double delimiter check that allows a comma in the password parsing code is
        unconditional. We set "tmp_end" to the end of the string and we continue to
        check for double delimiter. In the case where the password doesn't contain a
        comma we end up setting tmp_end to NULL and eventually setting "options" to
        "end". This results in the premature termination of the options string and hence
        the values of UNCip and UNC are being set to NULL. This results in mount failure
        with "Connecting to DFS root not implemented yet" error.

  • How to hide rows and columns by AppleScript or Automator for printing

    Hello,
    I have to hide first empty rows (I do it by: organize - Column B is not empty)
    then: By context-menu in Header of Column K: Hide column
    and: By context-menu in Header of Column L: Hide column
    How can I make this 3 Steps automatic with AppleScript or Automator or maybe by formula?
    Thanks for any help

    Here is an edited version which allow you to choose the custom template on the fly.
    No need to edit a property in the script.
    --[SCRIPT printtable(s)_choosecustom]
    Enregistrer le script en tant que Script ou Application : printtable(s)_choosecustom.xxx
    déplacer le fichier ainsi créé dans le dossier
    <VolumeDeDémarrage>:Users:<votreCompte>:Library:Scripts:Applications:Numbers:
    Il vous faudra peut-être créer le dossier Numbers et peut-être même le dossier Applications.
    Sélectionner une partie de table, une table ou même plusieurs tables.
    Aller au menu Scripts , choisir Numbers puis choisir “printtable(s)_choosecustom”
    Le script crée un nouveau document depuis un modèle perso sélectionné,
    puis applique « Colle les valeurs » au contenu du presse-papiers.
    Il envoie enfin la commande d'impression.
    --=====
    L'aide du Finder explique:
    L'Utilitaire AppleScript permet d'activer le Menu des scripts :
    Ouvrez l'Utilitaire AppleScript situé dans le dossier Applications/AppleScript.
    Cochez la case "Afficher le menu des scripts dans la barre de menus".
    Sous 10.6.x,
    aller dans le panneau "Général" du dialogue Préférences de l'Éditeur Applescript
    puis cocher la case "Afficher le menu des scripts dans la barre des menus".
    --=====
    Save the script as a Script or an Application : printtable(s)_choosecustom.xxx
    Move the newly created file into the folder:
    <startup Volume>:Users:<yourAccount>:Library:Scripts:Applications:Numbers:
    Maybe you would have to create the folder Numbers and even the folder Applications by yourself.
    Select a subset of a table, a table or even several tables.
    Go to the Scripts Menu, choose Numbers, then choose “printtable(s)_choosecustom”
    The script create a new document based on the selected custom template,
    then apply “Paste Values” to the clipboard's contents.
    At last, it issue the print command.
    --=====
    The Finder's Help explains:
    To make the Script menu appear:
    Open the AppleScript utility located in Applications/AppleScript.
    Select the "Show Script Menu in menu bar" checkbox.
    Under 10.6.x,
    go to the General panel of AppleScript Editor’s Preferences dialog box
    and check the “Show Script menu in menu bar” option.
    --=====
    Yvan KOENIG (VALLAURIS, France)
    2011/02/20
    2011/03/16 -- replaced the Blank template by a custom one defined thru the property custom_template
    2011/03/17 -- Let choose the custom template, no longer Paste but Paste Values.
    --=====
    property theApp : "Numbers"
    --=====
    on run
    --my doyourduty()
    run script doyourduty
    end run
    script doyourduty
    --on doyourduty()
    my activateGUIscripting()
    Copy the selected items *)
    my raccourci(theApp, "c", "c") (* cmd + c *)
    Create a new document based upon Blank.template *)
    set myNewDoc to my makeAnIworkDocFromCustom()
    As it's a custom template, there is no default table to delete.
    Delete the default table *)
    tell application "Numbers" to tell document 1 to tell sheet 1 to delete table 1
    my selectMenu("Numbers", 4, 8) (* Paste Values *)
    my raccourci(theApp, "p", "c") (* cmd + p = Print *)
    my raccourci(theApp, return, "") (* return = validate the Print command*)
    --end doyourduty
    end script
    --=====
    Creates a new iWork document from a custom template and returns its name.
    example:
    set myNewDoc to my makeAnIworkDocFromCustom()
    on makeAnIworkDocFromCustom()
    set nb_chiffres to 3 (*
    2 = allow 99 templates
    3 = allow 999 templates *)
    Grab the localized names of the templates folders *)
    tell application "Numbers"
    set templates_loc to localized string "Templates"
    -- set myTemplates_loc to localized string "My Templates"
    end tell -- to application a
    Define the path to the folder storing custom templates *)
    --set chemindesmodeles to "" & (path to library folder from user domain) & "Application Support:iWork:Numbers:" & templates_loc & ":" & myTemplates_loc & ":"
    set chemindesmodeles to "" & (path to library folder from user domain) & "Application Support:iWork:Numbers:" & templates_loc & ":"
    Grab the list of every items stored in the folder *)
    tell application "Finder"
    set entire_contents to entire contents of folder chemindesmodeles
    end tell
    Build two lists. One contain the path to every custom templates.
    The other contain the names of these templates and the names of subfolders *)
    set indx to 1
    set cheminde_mesmodeles to {}
    set nomsde_mesmodeles to {}
    set le_conteneur to ""
    tell application "System Events"
    repeat with i from 1 to count of entire_contents
    set un_element to item i of entire_contents as text
    try
    if type identifier of disk item un_element is in {"com.apple.iwork.numbers.template", "com.apple.iwork.numbers.sfftemplate"} then
    if name of container of disk item un_element is not le_conteneur then
    set le_conteneur to name of container of disk item un_element
    copy (text 1 thru nb_chiffres of "---") & space & le_conteneur to end of nomsde_mesmodeles
    end if
    copy un_element to end of cheminde_mesmodeles
    copy text -nb_chiffres thru -1 of ("00" & indx) & space & name of disk item un_element to end of nomsde_mesmodeles
    set indx to indx + 1
    end if
    end try
    end repeat
    end tell -- System Events
    if my parleAnglais() then
    set le_titre to "Numbers’s custom templates"
    else
    set le_titre to "Modèles personnalisés de Numbers"
    end if
    Choose the template to use.
    If you select a subfolder name, the script beep and ask one more time *)
    tell application (path to frontmost application as string)
    repeat
    set mon_choix to choose from list nomsde_mesmodeles with title le_titre
    if mon_choix is false then error number -128
    try
    set mon_choix to text 1 thru nb_chiffres of (item 1 of mon_choix) as integer
    exit repeat
    on error
    beep 1
    end try
    end repeat
    end tell
    tell application "Numbers"
    set nb_doc to count of documents
    open (item mon_choix of cheminde_mesmodeles)
    repeat until (count of documents) > nb_doc
    delay 0.1
    end repeat
    set doc_name to name of document 1
    end tell -- the_App
    return doc_name
    end makeAnIworkDocFromCustom
    --=====
    on parleAnglais()
    local z
    try
    tell application theApp to set z to localized string "Cancel"
    on error
    set z to "Cancel"
    end try
    return (z is not "Annuler")
    end parleAnglais
    --=====
    on activateGUIscripting()
    (* to be sure than GUI scripting will be active *)
    tell application "System Events"
    if not (UI elements enabled) then set (UI elements enabled) to true
    end tell
    end activateGUIscripting
    --=====
    ==== Uses GUIscripting ====
    This handler may be used to 'type' text, invisible characters if the third parameter is an empty string.
    It may be used to 'type' keyboard raccourcis if the third parameter describe the required modifier keys.
    I changed its name « shortcut » to « raccourci » to get rid of a name conflict in Smile.
    on raccourci(a, t, d)
    local k
    tell application a to activate
    tell application "System Events" to tell application process a
    set frontmost to true
    try
    t * 1
    if d is "" then
    key code t
    else if d is "c" then
    key code t using {command down}
    else if d is "a" then
    key code t using {option down}
    else if d is "k" then
    key code t using {control down}
    else if d is "s" then
    key code t using {shift down}
    else if d is in {"ac", "ca"} then
    key code t using {command down, option down}
    else if d is in {"as", "sa"} then
    key code t using {shift down, option down}
    else if d is in {"sc", "cs"} then
    key code t using {command down, shift down}
    else if d is in {"kc", "ck"} then
    key code t using {command down, control down}
    else if d is in {"ks", "sk"} then
    key code t using {shift down, control down}
    else if (d contains "c") and (d contains "s") and d contains "k" then
    key code t using {command down, shift down, control down}
    else if (d contains "c") and (d contains "s") and d contains "a" then
    key code t using {command down, shift down, option down}
    end if
    on error
    repeat with k in t
    if d is "" then
    keystroke (k as text)
    else if d is "c" then
    keystroke (k as text) using {command down}
    else if d is "a" then
    keystroke k using {option down}
    else if d is "k" then
    keystroke (k as text) using {control down}
    else if d is "s" then
    keystroke k using {shift down}
    else if d is in {"ac", "ca"} then
    keystroke (k as text) using {command down, option down}
    else if d is in {"as", "sa"} then
    keystroke (k as text) using {shift down, option down}
    else if d is in {"sc", "cs"} then
    keystroke (k as text) using {command down, shift down}
    else if d is in {"kc", "ck"} then
    keystroke (k as text) using {command down, control down}
    else if d is in {"ks", "sk"} then
    keystroke (k as text) using {shift down, control down}
    else if (d contains "c") and (d contains "s") and d contains "k" then
    keystroke (k as text) using {command down, shift down, control down}
    else if (d contains "c") and (d contains "s") and d contains "a" then
    keystroke (k as text) using {command down, shift down, option down}
    end if
    end repeat
    end try
    end tell
    end raccourci
    --=====
    my selectMenu("Numbers",4, 8)
    ==== Uses GUIscripting ====
    on selectMenu(theApp, mt, mi)
    tell application theApp
    activate
    tell application "System Events" to tell process theApp to tell menu bar 1 to ¬
    tell menu bar item mt to tell menu 1 to click menu item mi
    end tell -- application theApp
    end selectMenu
    --=====
    --[/SCRIPT]
    Yvan KOENIG (VALLAURIS, France) jeudi 17 mars 2011 21:29:15

  • Applescript in Automator File passing question

    Hi All,
    I work for an augmenative communication program in Monterey County. I do general tech stuff for them, like setting up new machines, upgrading RAM, and maintaining a few file shares.
    Many of the staff that make communication aides have to go through many steps to get a picture into the software used to make said communication boards. I'm trying to find a way to help make their job easier by creating an applescript or automator action that can help automate the process.
    The images of the kids and objects are in iPhoto (taken from digital cameras). The end result is to paste them into a program called BoardMaker. Getting the image to the clipboard would be good enough, because pasting is a simple operation.
    Since Automator has the Preview command to resize, that part is very easy. (BoardMaker only accepts low res images and the digital cameras they use are always set too high so we need to bring down the res.)
    After that I have a script action listed below that I was able to find online.
    Here's the script code:
    set myImage to open (choose file)
    tell application "Safari"
    activate
    open myImage
    delay 1
    tell application "System Events"
    tell process "Safari"
    keystroke "c" using {command down}
    end tell
    end tell
    end tell
    This is great, but it asks to choose a file when what we need is it to simply open the image passing through the automator actions.
    This isn't part of my job, I haven't been asked to do this, but I do see a need and I know it would help 20+ teachers and speech therapists to create augmenative communication boards.
    Any help would be great - Thanks.
    Paul
    P.S. I have searched these forums extensively before posting, as well as the net in general. Please don't flame if I missed the post with this answer.

    I tweaked the code as follows, which solved the issue.
    tell application "Preview"
    activate
    delay 1
    tell application "System Events"
    tell process "Preview"
    keystroke "c" using {command down}
    keystroke "q" using {command down}
    end tell
    end tell
    end tell

  • IWeb Applescript and Automator - scripts you shouldn't be without

    Applescript and automator will automate mundane manual repetative task that seem to take forever. These scripts fill in iWeb's void that makes it hard to implement advance features such one click ftp publishing, code editing, swithching domain site files, etc. Don't miss out on these scripts that will save you ton of time. These are scripts you shouldn't be without.
    Work smarter not harder with iWeb applescript, only from MacEzzy.
    -- Also check out the free downloadable iWeb templates.
    Powerbook G4 Ti   Mac OS X (10.4.4)  

    Thank you for your feedback.
    -- Article never mentions compressed or uncompressed. Traditionally tiff format is used for buttons and small images on web pages and jpeg is used for higher quality photos exemplified by iWeb.
    -- Search engine spiders or crawlers start from top of the page to the bottom of html pages. They craw for topic as well as content. This is exactly what appears from iWeb html pages for meta (meta name="Generator" content="iWeb 1.0.1")
    -- I am the first to admit I don't know everything but I don't make up information. I use iWeb on a daily bases and try new things to push the envelope. Things that I find helpful to me I make it available for other iWeb community users so that they don't go through tribulation.
    -- I put google ads and paypal donate buttons throughout the pages to test if iWeb is up for commercial challenge. I also tested how well the search and replace script worked. I have exemplified in macezzy website it is possible to use iWeb for business purpose. The script worked extremely well, it would have taken hours to insert google and paypal codes manually. Using the script it only took 10 min. I wanted to share that with other users who might wanted to do similar things. Sorry if that offend you, I will remove them.
    -- I never claimed to have created the script except the script that makes the first folder in documents folder. I did change the wording so that it is clear to users that they are switching sites(domain file). I did not create the awesome search and replace script either. I do mention that I have made the iWeb_ftpUpload automator.
    I have started macezzy site when iWeb was introduced and there wasn't much information about iWeb. I have and do try many things with iWeb and report to iWeb community users of things that I find helpful. I haven't made a dollar off the site and I have invested lot of my time because I like to see other users succeed.
    Powerbook G4 Ti   Mac OS X (10.4.4)  

  • Passing variables from Applescript to bash

    Hello,
    I'm trying to pass variables from Applescript to bash using the following code
    #!/bin/bash
    osascript <<EOF
    tell application "SystemUIServer"
    set username to text returned of (display dialog "Enter your name" with icon caution default answer ""  buttons{"Continue"})
    set macname to text returned of (display dialog "Enter name of your Mac" with icon caution default answer ""  buttons{"Continue"})
    do shell script "export USERNAME=" & quoted form of username & " && export MACNAME=" & quoted form of macname
    end tell
    EOF
    echo "USERNAME is $USERNAME, MACNAME is $MACNAME"
    but no luck
    Mac-mini:Downloads admin$./new.command
    USERNAME is , MACNAME is
    Any help would be greatly appreciated.

    I just realized you are returning 2 variables.  That can still be handled by echoing/printing the values, you just have to parse the output, or use other tricks.
    VALUES=( $(osascript -e '...') )
    This would make VALUES an array, with each array element containing one space separate return value from osascript
    USERNAME=${VALUES[0]}
    MACNAME=${VALUES[1]}
    If USERNAME or MACNAME could have spaces in them, you would need to use some kind of separator character.  For example if you use @ as the separator you could do something like:
    VALUES=$(osascript -e '...')
    USERNAME=${VALUES%@*}
    MACNAME=${VALUES#*@}
    which will %@* will delete everything starting with the @ til the end of the string, and #*@ will delete everything from the beginning of the upto and including the @.
    Another trick is to have the return values be properly formed shell variable assignments such as
    print "USERNAME='your user name' MACNAME='Your Mac Name' " -- I'm making this up as I do not really know Applescript, so you will have to figure out how to get Applescript to print something that looks like
    USERNAME='your user name' MACNAME='Your Mac Name'
    In your shell script you have code that looks like:
    VALUES=$(osascript -e '...')
    eval $VALUES
    The eval will execute whatever is stored in $VALUES, and if that happens to look exactly like shell variable assignments, you get the variables created in the current shell context, where can use them.

  • Filter data using where statement : need to filter a variable if it starts

    Hi,
    in my loop statment , i am using a where condition.
    a variable has numbers and characters , i want to filter the variable using where statement identifying if it is acharacter not to enter into the loop.
    any suggestions . Thanks in advance.
    regards,
    Ry

    Hi ,
    try like this
    data:l_file_data(20) type c,
    oref   TYPE REF TO cx_root.
    data: l_amount type p decimals 2.
    l_file_data = '12A3'.
    try.
    l_amount = l_file_data.
    catch cx_root into oref.
    endtry.
    if oref is not initial.
    write: 'Miss Match'.
    endif.
    regards
    Prabhu

  • AppleScript to Automator

    Hi there,
    I was wondering if it was possible to import an AppleScript into Automator, and if possible how do I go about doing this.
    Thanks, Ricky.
    http://rickyprograms.blogspot.com

    Knowledge Located via other sources...

  • Is there an AppleScript or Automator Script that will wake a Mac from Sleep?

    Is there an AppleScript or Automator Script that will wake a Mac from Sleep?

    Frank and All,
    The following answer to your question above is complicated, but I hope it explains why my question was formed with so much frustration in it.
    I have an OpenOffice(OO) Macro that was launched with Calendar at 6pm each business night. It ran properly in all Apples operating systems until I Hit Maverick(OSX10.9). From then on, the AppleScript would run from one to 3 days, then would disappear from the Calendar entry. The Calendar alert would still run, but the "OpenFile" section of the alert would disappear. I also was running elgato EyeTV HD during the day, so I would use energy saver to put my MacBook Pro to sleep at 12 Midnight and wake it again at 9am. I picked up a used Mac Mini to do the EyeTV stuff, provide AppleTV the files in H264 format through iTunes' media share, and found it had plenty of power to do the 6pm automated stuff simultaneously as well. Because I still wanted to run the OpenOffice Macro on my MacBook Pro at 6pm, and wanted to use it for a host of other things when I was on the road, I wanted it to sleep most of the time and only wake up automatically to run the 6pm OO Macro. When I called Apple about the issue I was having with Maverick and Calendar loosing the OpenFile command as part of the Alert Message, they told me the no longer supported answering AppleScript Questions but they now would support Automator questions. I pointed out that the OpenFile would also fail after one to three days if I used a Calendar Alert to launch an Automator App. At first, I did not like Automator, but now I see why Apple is pushing us to use it. Automator adds a TIME STAMP ID to the Apps developed in Automator so the first time you launch the App after a change to it, you must reply to a dialog message saying that this is the first time you are running this version of the App. If a Scammer has replaced your app with one that can reek havoc on your computer, the replacement app will not run unless you are there to agree that you know where the modified app came from and click the OK button to continue (BRILLIANT, Enhanced Security idea on Apples part). I also noticed that after Mountain Lion, the Applescript delay timing was all screwed up as well. Well I tried to use LaunchD Task Scheduler to circumvent the Calendar Problem and that worked until I upgraded to Yosemite Last week. Then LaunchD no longer worked and I am only into a few days of using The Calendar Launched Automator App to see if it will continue to run.
    But I think I solved the dilemma I was having with opening an Automator App in a Sleeping Mac. I Googled up the following question, "AppleScript to wake up computer".  I went thru several complex responses until I found this on that is INCREDIBLE EASEY! What came back was a brettterpstra.com  response from Feb 20th,2014. What it said, in a Quick Tip: caffeinated your Terminal Article,  if you wanted to wake a Mac from sleep, use the Terminal command named "Caffeine -u -t 1". I placed it in an Automator Most Used Action called "Run Shell Script -- Caffeine -u -t 1" and it worked!  Now, I can put my Mac to Sleep but at 6pm, the Automator App will launch, run the "Caffeine -u- -t 1" command and proceed to work as if I had awakened the Mac From Sleep mode by pressing a keyboard key and had run the Automator Script with a double click.
    Sorry for the long, drawn-out reply, but maybe this will help others.

  • Difference between Filter and Variables

    Hi Experts,
    What is the difference between Filter and Variables except user can give input dianamically in the case of Variables??
    Thanks in Advance!
    Sapna

    HI,
    Both works similarly ....but if the requirement is fixed means u know what data should be displayed in the query then u can use the filters....if u want to give that option to the Users then we create a variable and user can enter the required data which he wants to view.....once u define filters then only that particular restricted data will be displayed in the query out put....but incase of variables we are having the flexibility to view the data....
    Thanks/Tarak

  • Multiple filter in Excel by applescript

    Hi All,
    I wanna multiple filter in excel by applescript
    excel format like below, filter gender is "F", Happy is "N", Name is "Jack","Mary","Lynn", "Sue". I can filter gender is "F" and Happy is "N" and work fine. How to do the next? Thanks a lot.
    Name
    1day
    2day
    3day
    gender
    Happy
    Jack
    4
    745
    98
    M
    Y
    Jack
    3
    2
    1
    M
    N
    Jack
    5
    7
    8
    F
    N
    Leo
    44
    144
    44
    M
    N
    Leo
    441
    1456
    5
    M
    Y
    Mary
    5
    1236
    43
    F
    N
    Lynn
    66
    24
    123
    F
    N
    Mark
    124
    123
    6
    M
    N
    Ella
    6
    56
    3
    F
    Y
    Ella
    6
    234
    4
    F
    N
    Sue
    1
    1
    1
    F
    N
    Sue
    61
    4
    2
    F
    N
    Dave
    5
    5
    5
    M
    Y
    Wed
    7
    9
    11
    F
    N
    Lily
    7
    77
    44
    F
    N
    I wrote script like below
    tell application "Microsoft Excel"
      activate
              set RG_Row_2 to range "1:1"
          set LastColumn_Index to text 2 of (get address of (get offset of (get end range "A1" direction toward the right) column offset 1)) as text
              set Working_Range to range ("A:" & LastColumn_Index)
              set SKU_Index to get first column index of (find (RG_Row_2) what "Happy")
      autofilter range Working_Range field SKU_Index criteria1 "=N"
              set SKU_Index1 to get first column index of (find (RG_Row_2) what "gender")
      autofilter range Working_Range field SKU_Index1 criteria1 "=F"
    end tell
    -----Next is to filter Name is "Jack","Mary","Lynn", "Sue". I try to use advanced filter but failed, anyone can help? Thanks in advance.
    tell application "Microsoft Excel"
      activate
              set RG_Row_2 to range "1:1"
              set LastColumn_Index to text 2 of (get address of (get offset of (get end range "A1" direction toward the right) column offset 1)) as text
              set Working_Range to range ("A:" & LastColumn_Index)
              set SKU_Index to get first column index of (find (RG_Row_2) what "Happy")
      autofilter range Working_Range field SKU_Index criteria1 "=N"
              set SKU_Index1 to get first column index of (find (RG_Row_2) what "gender")
      autofilter range Working_Range field SKU_Index1 criteria1 "=F"
              set value of range "G1:G5" to {{"Name"}, {"=\"=Jack\""}, {"=\"=Mary\""}, {"=\"=Lynn\""}, {"=\"=Sue\""}}
      advanced filter Working_Range action filter in place criteria range "G1:G5"
    end tell

    autofilter range is only used when you have simple comparisons to make.  You can't build different autofilter range commands into a complex filter.  just use the advaced filter command once, with proper criteria.
    For clarity, I've moved the test data down to cell A10 and added the criteria in at cell A1.  This is what the data and criteria range should look like for the advanced filter to work:
    Name
    Happy
    gender
    =Jack
    N
    F
    =Mary
    =Lynn
    =Sue
    Name
    1day
    2day
    3day
    gender
    Happy
    Jack
    4
    745
    98
    M
    Y
    Jack
    3
    2
    1
    M
    N
    Jack
    5
    7
    8
    F
    N
    Leo
    44
    144
    44
    M
    N
    Leo
    441
    1456
    5
    M
    Y
    Mary
    5
    1236
    43
    F
    N
    Lynn
    66
    24
    123
    F
    N
    Mark
    124
    123
    6
    M
    N
    Ella
    6
    56
    3
    F
    Y
    Ella
    6
    234
    4
    F
    N
    Sue
    1
    1
    1
    F
    N
    Sue
    61
    4
    2
    F
    N
    Dave
    5
    5
    5
    M
    Y
    Wed
    7
    9
    11
    F
    N
    Lily
    7
    77
    44
    F
    N
    here is the applescript code:
    tell application "Microsoft Excel"
      activate
      -- get the range for the data in the main list
              set Working_Range to current region of cell "A10"
      -- create the criteria list programmatically
              set value of range "A1:C5" to {{"Name", "Happy", "gender"}, {"=\"=Jack\"", "N", "F"}, {"=\"=Mary\"", "", ""}, {"=\"=Lynn\"", "", ""}, {"=\"=Sue\"", "", ""}}
      -- get the range for the data in the criteria list
              set Criteria_Range to current region of cell "A1"
      -- filter
      advanced filter Working_Range action filter in place criteria range Criteria_Range
    end tell

  • Can Applescript or Automator be used to keep Character Viewer open?

    Since the upgrade to Mavericks the behaviour of the Character Viewer has changed, where it no longer 'sticks' (stays both active and on top) as a visible window when you switch applications: now it needs to be called up from within each application, and will be visible when working with that app.
    Is it possible to use Applescript or Automator (which I don't yet know how to use), to make the Character Viewer always stay open and visible while switching between and using any application, in effect restoring the way it worked before Mavericks?
    Thanks.
    (This question relates to one I asked here. It will be some time before I can access the computer in question and try the solution suggested there specifically for Word – my interest here is in finding out if it is possible to get the old Character Viewer behaviour back using Automator or Applescript.)

    Thanks for that suggestion too. Please let me know if you do try and succeed; I'm not sure I have the knowledge.
    In fact, in looking on my system I can find no .plist file with CharViewer in it, and it's not obvious any of the .plist files are related. I did find in the system library:
    Macintosh HD/System/Library/PreferencePanes/Keyboard.prefPane
    I don't seem to have a Library folder in my Home folder anymore (since Mavericks?). It looks like it now resides at Macintosh HD/Library.
    In the MacHD/System/Library there is an interesting folder: Input Methods. This is empty in MacHD/Library/Input Methods, but full of the following applications in System/Library/Input Methods (see screenshot). The first two look relevant. But I really don't know what I'm doing.

Maybe you are looking for

  • Flex fields in default BPM view 11.1.1.3.0

    Hi I Jdeveloper 11.1.1.3.0 I have created a SOA composite with a BPEL flow containing a Human task. In this task I have added data fields (flex fields) which I'm able to show in the Oracle BPM worklist using the Adminstration menu option and adding t

  • Will Apple get out a fix for iOS6? it's terrible

    Will Apple get out a fix for iOS6? it's terrible

  • CIF Transportation Lanes from R/3 to APO

    Currently, we are creating transportation lanes in APO via BAPI calls from R/3.     We have been lead to believe that transportation lanes can be CIF'ed over to APO. We are only executing GATP in APO.    We currently do not use DP, SNP, PP/DS, TP/VS,

  • CRM Survey err with Chinese trad. language

    Hi Expert, We are facing the err in CRM Survey with language Chinese Trad (ZF). After I created the a Survey in the CRM UI and got it saved, a warning msg is showing up saying the login lang. ZF is different with the Survey master Lang. Z1. I don't t

  • HT201401 Jag har en iPhone 4 som vissa knappar inte funkar på

    Min garanti går snart ut, Jag har en iPhone 4 som vissa knappar inte funkar på och det är en liten spricka i displayen, Vad kostar det att laga de