Applescript to skip Automator step

I'm trying to create a workflow to sync two folder with some option, such as "Sync even the icon" or "Sync remote folders".
What I need to do is put an Applescript on the top of the workflow to ask these options and then if, for example, the option "Sync the icon" is enabled, the applescript must run only determined actions that I specify.
My current Automator workflow:
- Ask for finder items
- Set value of variable 1
- Ask for finder items
- Set value of variable 2
- Ask for confirmation
- Get value of variable 1
- Get value of variable 2
- Run script shell
What I want to do:
- Run Applescript to ask options and then depending on the option chosen run determined actions
- Ask for finder items
- Set value of variable 1
- Ask for finder items
- Set value of variable 2
- Ask for confirmation
- Get value of variable 1
- Get value of variable 2
- Run script shell - this if the options chosen are "Sync the icon" and "Sync local folders"
- Run script shell - this if the options chosen are "Don't sync the icon" and "Sync local folders"
- Run script shell - this if the options chosen are "Sync the icon" and "Sync remote folders"
- Run script shell - this if the options chosen are "Don't sync the icon" and "Sync remote folder"
If isn't possible to do this, is it possible to convert actions to applescript?

I don't understand what 'sync the icon' means but that may be irrelevant?
Personally I'd start by keeping it simple – split it into 2 (or even 4) workflows…
Sync local folders (icons)
Sync local folders (no icons)
Sync remote folders (icons)
Sync remote folder (no icons)
The remote & local version could be a single workflow with a choice of 'icon' or 'no icons'.
That way you can keep the logic to a minimum inside Automator or Applescript.
If it must all be inside one Application/workflow you could try something inside a "Run Applescript" action…
on run {input, parameters}
  set choice to choose from list {"Sync local folders (icons)", "Sync local folders (no icons)", "Sync remote folders (icons)", "Sync remote folder (no icons)"}
  return choice
end run
Then you need to decide if an Applescript action or a shell script action is handling all the logic…
For example a "Run shell script" action will speak the you the result of the Applescript choice via…
say "$@"
It gets complex as you start handling all the variables. I'm unsure if you would be better with an Applescript or even a shell script - it really depends on what your overall aim is and how the sync is being performed. Are you making this for others to use?
P.S. You may want to explain what exactly you are syncing - it may be easier (and more logical to manage) by using an Application like Chronosync which can save 'sync jobs'.

Similar Messages

  • AppleScript to skip Automator workflow step - when no files are provided

    My current Automator workflow:
    Get Specified Finder Items (path to folder auto-populating with images from a camera)
    Get Folder Contents
    Sort Finder Items - by Creation Date in descending order (gets oldest item first)
    Limit Number of Items - Limit to First 1 items
    Move Finder Items (If no items are passed to this step skip it)
    Loop - Automatically; Stop after 20 minutes; Use the original input
    What I am trying to accomplish:
    I'm trying to write an AppleScript to skip the "Move Finder Items action" when it is not supplied with any files (from the previous workflow step), moving on to the next step which is a loop to begin my workflow again.
    Big picture:
    I have a workflow, where I am moving files from one folder to another folder (one at a time). When the input folder is empty, Automator comes back with "No item references were passed to the Move Finder Items action (-50)"; which it should - because it is not passed any files. I would like to ignore this error (or skip this step) and continue with the workflow if no files are provided to the "Move Finder Items action". I currently have an AppleScript (see below) that stops the workflow when this error occurs, but I would like to have this flow continue, not stop.
    AppleScript:
    on run {input, parameters}
              if input is {} then error number -128 -- 'user cancelled'
              return input
    end run
    Please help me create a script to skip this step, or to restart the Automator workflow when no files are passed to  the "Move Finder Items action".

    I'm not aware of a way to do this with a workflow saved as an application, but Automator is scriptable, so you can manipulate a workflow document.  For an example, build the follwing workflow:
    Ask for Text (just to get some input)
    Run AppleScript:
    on run {input, parameters}
      set currentAction to index of current action of front workflow -- the most recent completed action
      if input is {} then -- if no input then disable the following action
        tell Automator action index (currentAction + 2) of front workflow to set enabled to false
      else -- enable it
        tell Automator action index (currentAction + 2) of front workflow to set enabled to true
      end if
      return input
    end run
    Ask for Confirmation (just to show a dialog when enabled - this action will be enabled/disabled based on the text input)
    Loop
    You can also use action names, but I think it is less confusing to use indexes, since names can be edited and an action can be used more than once.

  • AppleScript version of Automator's Safari Actions

    I am building an AppleScript studio app and really need some help on how to do applescript versions of Automator's "Get Link URLs from Webpages" and "Get Image URLs from Webpage" actions. I would love to use curl or some other way to prevent the user from actually seeing the webpage.
    Thanks for your help
    Thanks,
    LX-88

    "Get Image URLs from Webpage" action
    There is a perl script buries inside this AM action:
    '/System/Library/Automator/Get Image URLs from Webpage.action/Contents/Resources/images'
    You can run that from AS, it gives you links to the images. Then, you step thru the list and curl the images. Here is one to get link to images at Apple site:
    set _URL to "apple.com" -- change this to your site
    set images_pl to "/System/Library/Automator/Get Image URLs from Webpage.action/Contents/Resources/images"
    set site_images to do shell script (quoted form of images_pl & space & quoted form of _URL)

  • Need help creating applescript to perform automator actions.

    Hi,
    I am looking for help with an applescript the will tell automator to execute  the steps of a workflow.  I'm aware that I coud just run a workflow or even tell applescript to instruct automator to run the workflow, however, I am looking to make this part of a larger workflow and this method would save the hassel of having to create a new workflow outside of applescript each time.
    I would like automator to "get folder contents" then "extract pdf text" to a "new file" with the "same name as original file" in the "same location as original" and "save as txt".  This doesnt seem to difficult to me, however, I have limited knowledge of scripting at this time.
    I appreciate anyones help...

    Hi,
    I'd say on a difficulty scale of 1-10, what you're asking for is a seven.
    Automator is scriptable, but when you run a basic AppleScript like
    tell application "Automator" to make new workflow
    you immediately get taken to the dialog asking you to choose a type for your document (app, calendar plugin etc). So that's going to stop the AppleScript dead in its tracks. It might be possible to move on with GUI scripting (using AppleScript to click the buttons) but it would be a ferocious cludge.
    I think the best approach would be to manually create an empty action as a starting point. You would then need an AppleScript that would duplicate the workflow file (so you've got a fresh one to duplicate next time), open it in Automator, add the appropriate actions, set the settings etc.
    It all sounds a bit too complicated
    HD

  • I'm setting up my MacBook Air and it tells me to sign in with my apple ID but when I try to sign in it says there's a server error. What do I do? Do I try to skip the step?

    I'm setting up my MacBook Air and it tells me to sign in with my apple ID so that I can set up features like iTunes and iCloud and such but when I try to sign in it says there's a server error. What do I do? Do I try to skip the step? How can I fix this?

    The following previous discussion may help, in particular the last post (1/22/2014 by frankjet7): https://discussions.apple.com/message/21295536#21295536

  • Option to "buy calendar" at the bottom is grayed out. Am I skipping a step?

    Trying to buy a calendar in iPhoto and the option to buy at the bottom is grayed out. Am I skipping a step, or is my computer glitching?

    Have you selected a Print Store to order from? Iphoto -> Preferences -> Advanced
    Regards
    TD

  • Skipping disabled step in GAF

    Hello All,
    I am disabling a main step in a GAF FPM at runtime by calling method IF_FPM_GAF->enable_mainstep in the OVERRIDE_EVENT_GAF method of interface IF_FPM_GAF_CONF_EXIT.
    However, the step is still being called when it is reached.
    Moreover, the step is automatically re-enabled  this.
    Does anybody know if this is normal behaviour?
    And if so, is there an efficient way of programming this in?
    I suppose I could trigger a 2nd next_step event in the before_flush of the application controller to skip it, but will need to suppress any event processing validations for the relevant uibbs.
    Many thanks for any advice,
    Pieter

    Hello Harish,
    I do sometimes need the step - that's why I'm disabling it dynamically.The validation is there for the cases when I do need it.
    Somehow I would have expected the FPM to have the intelligence to know by itself to skip a step that is disabled.
    That's why I was wondering if maybe I was doing something wrong...
    I've managed to do it now by raising the next_step event in the before_flush as I already suggested myself, but this is more work as I would have liked it to be - I even need to re-disable it as the next_step apparently reenables it.
    Regards,
    Pieter

  • HT4623 I am trying to complete the iOS7 update and it stalls on the updating of iCloud settings....if I skip this step what will happen?

    I am trying to complete the iOS7 update and it stalls on the updating of the iCloud settings, if I skip this step what will happen?

    Same issue here....somebody help?

  • I'm not able to create my apple id without my credit card number in my iphone 5c.there is no way to skip this step.there is no option like "NONE" to skip that step.kindly help me out.im unable to download even free apps

    i'm not able to create my apple id without my credit card number in my iphone 5c.there is no way to skip this step.there is no option like "NONE" to skip that step.kindly help me out.im unable to download even free apps

    See
    Why can’t I select None when I edit my Apple ID payment information?
    and
    Creating an iTunes Store, App Store, iBooks Store, and Mac App Store account without a credit card
    Step 3 is important, no matter whether you do this on a Mac or an iPad / iPhone:
    Important: Before proceeding to the next step, you must download and install a free application. ...
    Important: Before proceeding to the next step, you must download and install the free application by tapping Free followed by tapping Install App. …
    First you must download a free app from the App Store. When you are asked to sign in with your Apple ID, select "Create new account". Accept the terms and conditions checkbox, then click Continue. After you enter all the requested personal data, click Continue.
    When you are asked to select a payment method, select "None". 
    That's all there is to it.

  • HT2534 im 14 and i dont have no credit card how can i skip that step?

    im 14 and i dont have no credit card how can i skip that step?

    None Payment
    Did you create a NEW account using the instructions in Creating an iTunes Store, App Store, iBookstore, and Mac App Store account without a credit card using an email address you had not previously used with Apple?
    You have to.
    You may have to create a new account following the instructions using a new email address.

  • I live in Australia and i dont want to put in any credit card details, How do i skip this step?

    i live in Australia and i dont want to put in any credit card details, How do i skip this step?

    Creating an iTunes Store account without credit card -  Support - Apple

  • I found an ipod 5th generation at the train station. i tried to find the owner i couldn't. i kept it and restored it, now its asking me for the apple id username that had setup the ipod. my question is how can i skip that step

    I found and iPod touch 5th generation. I restored it now its asking me for the apple Id that had set up the iPod. Myoy quesyotion is ow can I skip that step.

    JacobiJ, no email address/Apple ID is listed. It just says enter the Apple ID and password.
    JacobiJ wrote:
    Send them a email at the Apple ID email address and tell them you found their iPod. I'm sure they will be very greatful.

  • Applescript, iMovie and Automator problem

    Hi,
    Sorry for reposting from another area, but maybe this will fair better in the right section.
    I'm trying to convert a .mov file to .mp4 using Visualhub and automator, but a step in my automator file uses an applescript step that just causes the automator flow to stop and the end and not gon one with the rest of the actions.
    More specifically:-
    1. I use my HD camera to film something.
    2. Connect the camera to my mac.
    3. Import the video using iMovie.
    4. My Automator actions ask me to confirm that iMovie has finished the import
    5. Then Ask for finder items, which is get the newly imported .mov into VisualHub
    6. Run the problematic Applescript:-
    on run {input, parameters}
    --we need to unset the default timeout length of two minutes, we'll make it 45
    with timeout of (45 * 60) seconds
    tell application "VisualHub" to set VisualHub to load script (scripts path of main bundle & "/automation.scpt" as POSIX file)
    tell VisualHub
    LoadSettings("/Volumes/MyBook/hd.cam.settings.vhub")
    --SetSaveLocation("YOURHARDDRIVE:Users:YOURNAME:Desktop:iphonemovies:temp")
    AddFiles(input)
    StartConversion()
    QuitApp()
    end tell
    end timeout
    return input
    --delay 15
    end run
    Which I've used from this site (http://professafresh.wordpress.com/2007/10/18/fun-with-automator/) and just stopped the two lines with a comment marker.
    What is supposed to happen after that is that
    7. Automator asks to confirm that VisualHub has finished.
    8. VisualHub quits
    9. Finder finds the .mov that was created when the film was imported
    10. Finder then moves the item to the trash.
    So there is something going on with the applescript that causes the process to stop after the conversion.
    Some points:-
    1. I have used the VisualHub import and convert script step but the default settings are not what I'm after as I want the video resized to 960x540.
    2. iMovie recognizes and keeps all the head info as long as the file name is the same. So if you skip over the thumbnail in iMovie the timestamp changes to reflect the time that the video was taken. If you convert the .mov to .mp4 the info is retained but with a much smaller video size.
    I've tried to give as much info as possible, sorry if it's too much.
    Regards,

    You can do that all in iMovie
    Select 300 photos set the length to 3:15 - Import
    Select all in the timeline. Pick your transition. Set it to .29. Apply.
    Daniel C. Slagle - Keeper of the "Unofficial" iMovie FAQ
    http://iMovie.danslagle.com
    Quad - 2.5 Ghz G5   Mac OS X (10.4)   GeForce 7800 GT, 3G RAM, 250GB & 500GB internals

  • Applescript equivalent of Automator's "Combine PDF"?

    Folks -
    I'm starting to learn Applescript, and working to use it to help automate some workflows in a prepress department.
    I'm trying to write a script that (among other things) will combine a folder full of PDFs into one file before passing it along to the next step. This is easy using Automator, but the only Applescript equivalent that I've found calls for Acrobat to launch and combine the files - this seems to run more slowly than the Automator version, which doesn't appear to call Acrobat at all. I thought I'd try scripting Preview to do the same thing, but I didn't realize that Preview isn't scriptable.
    Is there a way I can accomplish this without combining Automator and Applescript, or am I out of luck? (I have a sneaking suspicion that this may involve a shell script, which would mean that I'm out of my depth.)
    Thanks for any ides on this one..
    -Andy Gill

    Hi Andy,
    I thought I'd try scripting Preview to do the same thing, but I didn't realize that Preview isn't scriptable.
    Using [GUI Scripting|http://www.macosxautomation.com/applescript/uiscripting/index.html], it should be relatively easy to write a script that will do what you are asking for. The drawback, however, is that such a script would have to open Preview.app and so could not run inconspicuously in the background.
    Maybe you might want to have a look at these two Mac OS X Hints articles:
    [10.5: Use Preview to merge or create multi-page PDFs|http://www.macosxhints.com/article.php?story=20071114191806624]
    [10.6: Combining documents in Snow Leopard's Preview|http://www.macosxhints.com/article.php?story=20090915223224601]
    Hope it can help.

  • Applescript works in Automator but not as Application workflow

    I have a pretty simple Application workflow in automator that runs this applescript:
    set front_app to (path to frontmost application as Unicode text)
    tell application front_app
    activate
    set bounds of window 1 to {0, 0, 1280, 800}
    end tell
    as you can see all it does is it maximizes the current window. it works when I run the script from within automator, but when i save it as an application and run that it says the applescript errored.
    Why is my simple automator not working as an application?
    Message was edited by: Pyrolistical

    When you run that script as an application it comes to the front and is therefore the frontmost application: it doesn't have a window to be maximised.
    You would need to specify the actual application to have its window maximised:
    tell application "Safari"
    activate
    set bounds of window 1 to {0, 0, 1280, 800}
    end tell
    Trying to find out which was the frontmost application before you launched the AppleScript application is going to to be difficult.

Maybe you are looking for