Convert automator object to applescript

Hi,
6 months ago I was working with automator and in my web searching I found a technique to convert the automator object (in the editor) to applescript. I have forgotten the trick and cannot find it...
How is that done????
I thought it was a drag and drop or copy and past thing, but it doesnt seem to be working.
same OS, 10.5.8

I'm not sure what you mean by "automator object". Are you referring to a script in the *Run AppleScript* action window? If that is the case, you can sometimes convert by copying the contents of the on run {input, parameters} handler to the *Script Editor*. I say "sometimes", because you will need to handle the input to the script differently, and Automator's scripting dictionary is a little different than normal AppleScript in some places (e.g. dialogs).
If you are referring to events recorded in a *Watch Me Do* action, you can select the desired event(s) and copy/paste into the *Script Editor*.

Similar Messages

  • Convert Automator Flow to AppleScript??

    Hello AppleScript/Automator Gurus
    Firstly, I just started Automation this week with Automator but I've ran into a wall.. x.x   I'm hoping I can resolve this by means of AppleScripting.
    Below is an image of what I'm trying to do. It works great, unless there's no files matching. At this point, it denies going any further because theres nothing to 'Move'.
    What I actually want to do is (in steps):
    1. Get specified finder items >
    2. Get folder contents >
    3. Filter Finder Items by extension w/no folders selected >
    4. Move Finder Items to specified folder >
    5. If there is no Finder Items found to move skip >
    6. Repeat from step 1 to filter other extensions into appropriate folders unless there are no more steps or files then stop.
    Now I'm thinking if I could replace Step 4 (Move Finder Items) with an Applescript that would do this. Then insert Step 5. Eliminating the break in chain, so it can continue on to the next extension and do the same Steps 1-5.
    Then for the last move of the last group, an end if there are no files to move and no next step.
    If this has to be done all in Applescript from Step 1-6 I'm SOL (hoping not since I'm posting here).
    Thank you all very much for your attention and help. I apologize if this has been discussed before but I've been researching for a couple of days now and born unto Applescript as of yesterday I see it as a logical process but I have no idea where to begin or how to write Applescript. I'm a new Mac user since Feb, Automator since about 3 days ago and complete noob to Applescript. Any help is appreciated.

    Reviewing what you mentioned, seems extremely simple. Even moreso than Automator in a way
    In my opinion, AppleScript is easier - it's certainly easier to string together multiple discrete tasks, plus it's easier to read that one line and understand it's purpose than it is reading each step in an Automator workflow and knowing what it's trying to do.
    what if there are no files of that filetype left in the folder and there are only
    That's a fair question, right now, as it stands, it would throw an error ("can't get every file of folder.."). There are multiple ways of dealing with that. One is to add a specific test to check that files exist, another is to assume the best and just catch errors.
    To specifically check that some files were found the script needs to be expanded some:
    tell application "Finder"
              set files2Move to (every file of folder "Split Filetypes" of desktop whose name extension is "wav")
              if count files2Move > 0 then
                        move files2Move to folder "Path:to:your:WAVs"
              end if
    end tell
    Here the first statement gets a list of matching files and puts them in a variable I've called files2Move.
    I then check to make sure that files2Move actually contains some data (i.e. there aren't 0 files). If there are any files, I move them. If there are no files the move statement never executes.
    The alternative approach is to use a 'try' statement. This tells AppleScript to fail gracefully, rather than reporting an error, so in this case I can just try to move the files and ignore any failures:
    tell application "Finder"
              try
                        move (every file of folder "Split Filetypes" of desktop whose name extension is "wav") to folder "Path:to:your:WAVs"
              end try
    end tell
    Here I've wrapped the move command in a try/end try block. If an error occurs the script moves silently to the 'end try' statement without reporting an error to the user. Note that there are multiple things that cold constitute an error - the source or destination directories might be invalid or missing, there might be zero files that match the criteria, the destination directory might be read-only, etc. This script doesn't differentiate between any of those cases, it'll just try its best and move on.
    Can I just put in a move function to move those filetypes, written in applescript, that goes on to the next step in automator if no files are found?
    You can do that - Automator is built on top of the same underlying engine as AppleScript is. Indeed, there is a Run AppleScript action in Automator, so anything you can do in AppleScript you can add as a step in Automator. My problem with this though, is in passing data between the workflow and the AppleScript action. For me, I find it easier to write in AppleScript, so as soon as I find myself thinking in AppleScript I move the whole project there since integration is just so much easier.
    Applicatons and Folder Actions are not Automator-exclusives. Indeed, the original Folder Actions spec was AppleScript entirely - Automator put a slightly prettier front-end on it, but it was originally all AppleScript.
    Granted, building a Folder Action in Automator is easier since it takes care of saving the script in the right place and attaching it to the folder in question, but it's not hard to do in 'pure' AppleScript - you just need to add an appropriate handler so that the OS knows what to do when the folder is triggered.
    Of course, as a folder action you're no longer concerned with checking a specific directory. Since the folder action is attached to a folder (or, really, any folder) you should check the data that's passed in rather than rely on a hard-coded path.
    For example, to turn my script into a Folder Action that triggers on newly-added files, you wrap it like;
    on adding folder items to theFolder after receiving theNewItems
              repeat with each_file in theNewItems
                        tell application "System Events"
                                  if name extension of each_file is "wav" then
                                            move each_file to folder "Path:to:your:WAVs"
                                  end if
                        end tell
              end repeat
    end adding folder items to
    Now, this is a little different. Since it's a Folder Action it inherently knows the files that have just been added, so there's no need to query the Finder to find the WAV files - you can just look at the list of files that were passed in. You can just duplicate the 'if name extension... end if' statements for each of your file types, and you don't need to worry about there being zero files to move since the 'if' statements will identify the file types.

  • How to convert the output of Applescript which is in object format to text or string format??

    Hi All,
    I want to convert the output of Applescript which is in object format to string or text format, am running Applescript with Java, I need to display the output of applescript in Eclipse Java Console, since its object format the output is not properly displayed..
    Pls suggest.. I used the below code
    repeat with i in allContents
                if class of i is button then set the end of allStaticText to contents of i
            end repeat
    Applscript ouptput
    {button 1 of window "Player Installer" of application process "Install  Player" of application "System Events", button 2 of window "Player Installer" of application process "Install  Player" of application "System Events", button 3 of window "Player Installer" of application process "Install  Player" of application "System Events", button "Finish" of UI element 1 of scroll area 1 of window "Player Installer" of application process "Install  Player" of application "System Events"}
    Java output
    <NSAppleEventDescriptor: 'obj '{ 'form':'indx', 'want':'butT', 'seld':1, 'from':'obj '{ 'form':'name', 'want':'cwin', 'seld':'utxt'(" Player Installer"), 'from':'obj '{ 'form':'name', 'want':'pcap', 'seld':'utxt'("Install  Player"), 'from':'null'() } } }>

    Here's an improved version of the previous script, where the handler now returns "button 2 of window \"Untitled\" of application process \"TextEdit\" of application \"System Events\"" instead of "button \"2\" of window \"Untitled\" of application process \"TextEdit\" of application \"System Events\"":
    tell application "System Events"
        get button 2 of window 1 of process "TextEdit"
        my objectToText(result) --> "button 2 of window \"Untitled\" of application process \"TextEdit\" of application \"System Events\""
    end tell
    on objectToText(UI_element)
        set theText to ""
        tell application "System Events"
            repeat
                if exists attribute "AXParent" of UI_element then
                    set theParent to value of attribute "AXParent" of UI_element
                    set theClass to class of UI_element
                    if name of UI_element exists then
                        set theName to name of UI_element
                        set theText to theText & (theClass as text) & " \"" & theName & "\" of "
                    else
                        set k to 0
                        get UI elements of theParent whose class is theClass
                        repeat with thisItem in result
                            set k to k + 1
                            if contents of thisItem is UI_element then exit repeat
                        end repeat
                        set theIndex to k
                        set theText to theText & (theClass as text) & " " & theIndex & " of "
                    end if
                    set UI_element to theParent
                else
                    set theClass to class of UI_element
                    set theName to name of UI_element
                    set theText to theText & (theClass as text) & " \"" & theName & "\" of application \"System Events\""
                    exit repeat
                end if
            end repeat
        end tell
        return theText
    end objectToText
    Message was edited by: Pierre L.

  • Using Delphi, and the InDesign automation object ("indesign

    Using Delphi, and the InDesign automation object ("indesign.application"), I need to open a indd file, move to a bookmark and insert text or picture at that exact location. Any examples of such code I could start with?

    Hi Bill,
    Sorry to be so late getting to this thread!
    If you want to add something to a page, or find an object that's on a page, you need a reference to the page. Simply displaying the page with ShowBookmark won't give you a reference to the page--InDesign scripting, for the most part, doesn't rely on the selection and current view in the way that Word scripting does (this is a good thing, but that's a topic for another day).
    You had to have a reference to a page to create the HyperlinkPageDestination that you used to create the bookmark--but, if not, you can get a reference to the page using (VBScript form):
    Rem Given a reference to an instance of InDesign "myInDesign"...
    myInDesign.Bookmarks.Item("Description").ShowBookMark
    Set myPage = myInDesign.ActiveWindow.ActivePage
    In general, though, you probably don't need the bookmark and the whole "ActiveWindow" construct--just use the reference to the page itself.
    Now that you have a page, you can put things on the page.
    Rem Create a rectangle
    Set myRectangle = myPage.Rectangles.Add
    Rem Size and position the rectangle
    myRectangle.GeometricBounds = Array("6p", "6p", "24p", "24p")
    Rem Place a graphic in the rectangle
    myRectangle.Place "c:\test.tif"
    If you have a text frame on the page that has the label "myLabel", you can get a reference to the text frame and add text:
    Set myTextFrames = myPage.TextFrames.Item("myLabel")
    Rem myTextFrames will return an array--get the first item
    Set myTextFrame = myTextFrames(0)
    Rem Replace the text in the text frame:
    myTextFrame.Contents = "This is some text."
    Rem Or add text to the end of the text frame:
    myTextFrame.InsertionPoints.Item(-1).Contents = "This is some additional text."
    If you know that there is only one text frame with the label "Description" in the entire document, you can even say:
    Set myTextFrames = myDocument.TextFrames.Item("myLabel")
    Rem myTextFrames will return an array--get the first item
    Set myTextFrame = myTextFrames(0)
    ...to get to it directly. If, at that point, you want to get at the page containing the text frame (and assuming that the text frame is not in a group, pasted inside text, or pasted inside another page item), you can use:
    Set myPage = myTextFrame.Parent
    Have you looked through the "Working with Documents" chapter of the InDesign CS3 Scripting Guide: VBScript and the associated scripts archive? I realize that you're using Delphi, but it doesn't look too difficult to convert from one to the other.
    Thanks,
    Ole

  • How can i convert an object to stream of chars or bytes?

    how can i convert an object to stream of chars or bytes?

    One way is the serialization mechanism. There are examples and explanations of it in the Java tutorial: http://java.sun.com/docs/books/tutorial/essential/io/serialization.html

  • How do i convert an object into a string?

    has said above, im trying to convert a object to a string.
    here is what i ahve so far:
    Object nodeInfo = node.getUserObject()

    RTFM
    Object o =...
    String str = o.toString();

  • How can I convert table object into table record format?

    I need to write a store procedure to convert table object into table record. The stored procedure will have a table object IN and then pass the data into another stored procedure with a table record IN. Data passed in may contain more than one record in the table object. Is there any example I can take a look? Thanks.

    I'm afraid it's a bit labourious but here's an example.
    I think it's a good idea to work with SQL objects rather than PL/SQL nested tables.
    SQL> CREATE OR REPLACE TYPE emp_t AS OBJECT
      2      (eno NUMBER(4)
      3      , ename  VARCHAR2(10)
      4      , job VARCHAR2(9)
      5      , mgr  NUMBER(4)
      6      , hiredate  DATE
      7      , sal  NUMBER(7,2)
      8      , comm  NUMBER(7,2)
      9      , deptno  NUMBER(2));
    10  /
    Type created.
    SQL> CREATE OR REPLACE TYPE staff_nt AS TABLE OF emp_t
      2  /
    Type created.
    SQL> Now we've got some Types let's use them. I've only implemented this as one public procedure but you can see the principles in action.
    SQL> CREATE OR REPLACE PACKAGE emp_utils AS
      2      TYPE EmpCurTyp IS REF CURSOR RETURN emp%ROWTYPE;
      3      PROCEDURE pop_emp (p_emps in staff_nt);
      4  END  emp_utils;
      5  /
    Package created.
    SQL> CREATE OR REPLACE PACKAGE BODY emp_utils AS
      2      FUNCTION emp_obj_to_rows (p_emps IN staff_nt) RETURN EmpCurTyp IS
      3          rc EmpCurTyp;
      4      BEGIN
      5          OPEN rc FOR SELECT * FROM TABLE( CAST ( p_emps AS staff_nt ));
      6          RETURN rc;
      7      END  emp_obj_to_rows;
      8      PROCEDURE pop_emp (p_emps in staff_nt) is
      9          e_rec emp%ROWTYPE;
    10          l_emps EmpCurTyp;
    11      BEGIN
    12          l_emps := emp_obj_to_rows(p_emps);
    13          FETCH l_emps INTO e_rec;
    14          LOOP
    15              EXIT WHEN l_emps%NOTFOUND;
    16              INSERT INTO emp VALUES e_rec;
    17              FETCH l_emps INTO e_rec;
    18          END LOOP;
    19          CLOSE l_emps;
    20      END pop_emp;   
    21  END;
    22  /
    Package body created.
    SQL>Looks good. Let's see it in action...
    SQL> DECLARE
      2      newbies staff_nt :=  staff_nt();
      3  BEGIN
      4      newbies.extend(2);
      5      newbies(1) := emp_t(7777, 'APC', 'CODER', 7902, sysdate, 1700, null, 40);
      6      newbies(2) := emp_t(7778, 'J RANDOM', 'HACKER', 7902, sysdate, 1800, null, 40);
      7      emp_utils.pop_emp(newbies);
      8  END;
      9  /
    PL/SQL procedure successfully completed.
    SQL> SELECT * FROM emp WHERE deptno = 40
      2  /
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM
        DEPTNO
          7777 APC        CODER           7902 17-NOV-05       1700
            40
          7778 J RANDOM   HACKER          7902 17-NOV-05       1800
            40
    SQL>     Cheers, APC

  • Hello, 2 questionss here is it possible or is there a way to convert all object s outlines in all frames to fills at once and not frame by frame? and why sometimes erases the outline instead of converting it to fill?

    Hello, 2 questionss here>is it possible or is there a way to convert all object s outlines in all frames to fills at once and not frame by frame? and why sometimes erases the outline instead of converting it to fill?

    Hello, 2 questionss here>is it possible or is there a way to convert all object s outlines in all frames to fills at once and not frame by frame? and why sometimes erases the outline instead of converting it to fill?

  • Converting Array Objects into ArrayCollections

    Hi,
    I am facing problem with converting Array Objects into ArrayCollections. How can i convert Array Objects into ArrayCollections. If any one knows how can we do that Pl reply.
    Thanks in advance to all
    Regards
    subbareddy.p

    Hi Bhasker,
    thanks for u r reply. Here i attached screen shot of my server "data.result".
    My proxy varaible contains
    My object varaible "obj" contains
    After parsing the result my arraycollection contains, (i mean after converting Object to Array to ArrayCollection) the below information. For information Pl find the attached arraycollection.png image. In the attached image my arraycollection name is "users".
    Here i pasted the code that i used  to convert  "ObjectProxy" to "ArrayCollection"
    var proxy:ObjectProxy = ObjectProxy(data.result);
                var obj:Object = proxy.object_proxy::object;
                var arrycoll:Array = ArrayUtil.toArray(obj); 
                model.users = new ArrayCollection(arrycoll);
    Regards
    sss

  • How to get windows form object of a MMC snapin node using MMC automation object model

    Hello,
    I am using automation object model for an existing mmc file and just trying to traverse all nodes of it. And i am able to do so.
    My query is : how can i get the access of windows form object of a particular node . Windows form is present in result pane of a node, i want to get access of that so that i can perform some automation on that form.
    http://msdn.microsoft.com/en-us/library/aa815049(v=vs.85).aspx
    I found that if OCX control is in result view of any node, then "view object -> control object property" returns
    the automation interface supplied by the control in the result view. 
    However, if result view is HTML view then how to get the automation interface of that result
    view.
    Thanks in advance,
    Sumit

    Hi Sumit,
    I read the link you provide above. It seems that when you want to achieve your target by using MMC automation
    object model, you need to use codes. Based on the programming language, if use VB, I suggest you post the question in
    VB Forum. If you want to use C#, may post in
    C# Forum.
    In addition, there is an answered question, may help you to find the correct forum.
    MMC development forum?
    http://social.microsoft.com/Forums/en-US/3796a8e9-674e-4da0-a40e-4e4b69575c8e/mmc-development-forum?forum=whatforum
    Since, it’s more related to development. We may can’t provide some more detailed information. Thanks for your
    understanding.
    Hope this helps.
    Best regards,
    Justin Gu

  • WD(ABAP) - How to convert PDF object to XML

    I know there is a way available to converting PDF object to XML in JAVA. However how to achieve this goal in ABAP?
    In Web Dynpro ABAP, I can bind a context attribute to the pdfSource property of interactive form element. There also should be method to able to convert the binary content of this attribute to XML format, right? Does anyone know it?
    Your help would be greatly appreciated.

    Hi all,
    As an extension to Fred's question, is it possible to later use the generated XML data and present it in a PDF template?  It used to be possible using the FDF format, but Adobe seem to have discontinued that. 
    My basic requirement is to send the form data to a third party in XML format and for them to be able to view it in human-readable format, preferably using a PDF as a template. 
    Is this possible?
    Thanks,
    Jonathan

  • BSP Exception: Missing reference when converting data object ZZxx

    Hi there,
    I have created these new Z fields and tried to include them in a field group. These fields did appear, but they are highlighted with a red box, with the above text in the tool tip.
    Does anyone know what it means??
    Thanks

    I believe they were generated by EEWB - or could've been added manually to the CRMD_CUSTOMER_H. This error only occurs on the Currency fields...something to do with reference field but I just can't find what is wrong with this. I searched up SAP notes and found the following the closest match: -
    <b>Symptom</b>
    when trying to scroll down in the result list in the F4 for the Ibase the error error "BSP exception : Missing reference when converting data object amount.  Correct the entry" occurs.
    <b>Other terms</b>
    CRMT_BSP_IBASE_TREE_NF, data object amount
    <b>Reason and Prerequisites</b>
    This happens due to inconsistancy in structure
    <b>Solution</b>
    Please follow the below steps manually.
    1. Go to tx:SE11
    2. Select data type "CRMT_BSP_IBASE_TREE_NF" in change mode
    3. Select component AMOUNT in 'Components' tab
    4. Go to "Currency/quantity fields" tab
    5. Replace 'Reference table' entry from 'CRMT_BSP_IBASE_DETAIL'
       to 'CRMT_BSP_IBASE_TREE_NF'
    6. Save and activate

  • How do I Convert an "Object" to a "double"?

    Can anyone please tell me how to convert an "Object" to a "double"? Typecasting does not work.

    Do you want to convert any object at all to a double, or only particular kinds of objects? My guess is that you don't really need to convert a File or a JButton to a double, you have some kind of an object that really contains some sort of double information and you want to get it out. More information would help.

  • Can I know the automation object for firefox like "InternetExplorer.Application" for IE?

    Can I know the automation object for firefox like "InternetExplorer.Application" for IE?

    Firefox is not a COM-based application, so there is no equivalent. Over the years, different approaches have been offered for automating or embedding Firefox. The current one is [https://developer.mozilla.org/en/XULRunner XULRunner].

  • Converting EJB Object into XML

    All:
    Suppose I have an EJB that is named MyDog, it has attributes as follows:
    name
    breed
    weight
    age
    Is there a way to convert this Object into an XML document? Something like:
    <?xml version=\"1.0\" ?>
    <MyDog>
    <name>Bubba</name>
    <breed>Australian Shepherd</breed>
    <weight>65 lbs</weight>
    <age>6 years old</age>
    </MyDog>
    I can't find any information on doing this - any ideas, links, etc? There has to be a way to do this, but I can't find it. I'm welcome to any ideas out there!

    check JAXB - might be usefull for you: http://java.sun.com/xml/jaxb/index.html

Maybe you are looking for