Automator if/then to Trigger Actions

I am trying to set iTunes' Equalizer depending on what the system audio output is. I have been able to get the name of the audio device using AudioDevice and save it to a variable (though I suspect the latter isn't necessary). What I can't figure out how to do is set the Equalizer based on what the name returned is. For example, if it is "Headphones", then set the Equalizer using the "Set iTunes Equalizer" (preferably), or if it is "Internal Speakers", set it to another. I hardly have any experience with AppleScript and Automator
This is where it's at, currently:

Thanks! That's exactly what I wanted! Only problem is, I'm trying to use an "else" statement (not "else if") like this and it produces an error:
set currentAudioDevice to (do shell script "/Users/anyone/Downloads/Audiodevice/audiodevice output")
tell application "iTunes"
  if currentAudioDevice is "Headphones" then
  set current EQ preset to "Headphones"
  else
  set current EQ preset to "High Bass"
  -- add more 'else' clauses here
  end if
end tell
It looks like it should be correct, but it says that "current EQ preset" is an "Unknown object type".

Similar Messages

  • Bug in Automator's Combine PDF Pages action?

    Hi guys,
    I've been playing around with 10.6's new Automator and Services. I decided to make an Automator Service so that if I have some PDFs selected in Finder, I can combine all the pages into one PDF and save it to a location. So I created the following service:
    * Get Selected Finder Items
    * Combine PDF Pages (appending pages)
    * Move Finder Items (to Desktop by default, show this action when the workflow runs)
    * Rename file (comes up as Name Single Item in Finder Item Names, show this action when the workflow runs)
    I tested this in Automator by selecting some PDFs on my desktop and hitting the Run button; everything worked out well. So I saved it as an Automator Service, only available for PDF files but in all applications (drop down lists at the top of the Automator window).
    I noticed however when I ran this workflow as a service, the pages in the resulting PDF file is actually duplicated. For example, if I had page 1 in page1.pdf, and page 2 in page2.pdf, running the service on these two files will produce a PDF with the following pages: page 1, page 2, page 1, page 2.
    Does this happen to anyone else in here, or is it just me? I tried saving the workflow as an application, placed it in the Dock, and then dropped my test files on it and it does the same thing. And this happens with other PDF files too.
    Is this a bug? Can someone confirm that it happens on their machine too?
    Thanks.

    Anyone? It doesn't take long to create an Automator workflow with the 4 actions above. Probably 2 minutes max. Can someone test on their machine?
    I tried to do the same with my MBP, which I also upgraded to Snow Leopard, and it does the same thing there. For some reason, it works perfectly when the workflow is run within Automator, but when it's exported as an Application or a Service, it duplicates pages.
    I tried to submit a bug report to Apple, but I couldn't log in with my current Apple ID -- it shows me an error page to submit a bug report! That's what I've been trying to do in the first place, but it seems the bug report process has bugs that they want you to report on. Chicken and egg scenario methinks.

  • Trigger actions through a program

    Hi experts,
      Here is my business functionality.
      I have to implement a badi for a customer request in crm. this would check the product against the reason code entered. If both match then i need to trigger action (actions are already defined) otherwise i have to collect error message in application log. I am through with the later half but dont know how to proceeed to action triggering.
      Can somebody pls help me out. Thanks in advance

    Hi Manuel,
    I have already seen that blog but when i copied the program , it gave me the error when the method for triggering the action is called. it gave me a short dump sayin
    Access via 'NULL' object reference not possible.
    The reason for the exception is:
    You attempted to use a 'NULL' object reference (points to 'nothing')
    access a component (variable: "LV_ACTION").
    An object reference must point to an object (an instance of a class)
    before it can be used to access components.
    Either the reference was never set or it was set to 'NULL' using the
    CLEAR statement.
    at line CALL METHOD lv_action->set_is_inactiv( space )..  "
    and since i have never used this method, i dont know how to solve this error. so can you please help me out with this

  • Is it possible to trigger action in backing bean on page unload event?

    Hi,
    There is a RichPopup in my page which has a Listener to save data or not by user choice "Data change detected, do you want to save those changes?"
    I've tried with the javascript event 'window.onbeforeunload', but this way must be fit with a Servlet function which I am not allowed to use.
    The attibute 'onunload' in the tag '<af:document>' seems useless. Even there is few description or example in the 'Tag Reference'.
    So, is it possible to trigger action in backing bean on page unload event? Thanks in advance for helping.
    Viva

    Hi Frank
    Thanks for helping, I've tried in your way. My codes are like below:
    Page codes:
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:h="http://java.sun.com/jsf/html"
              xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
      <jsp:directive.page contentType="text/html;charset=UTF-8"/>
      <f:view>
        <af:document id="d1" clientComponent="true" title="viva test">
          <af:resource type="javascript">
            if (!window.addEventListener) {
                // alert('window.addEventListener is not supported in IE8. Override it!');
                window.addEventListener = function (type, listener, useCapture) {
                    window.attachEvent('on' + type, function() {listener(event)});
            window.addEventListener('beforeunload', function (){performUnloadEvent()}, false);
            function performUnloadEvent() {
              var eventSource = AdfPage.PAGE.findComponentByAbsoluteId('d1');
              //var x and y are dummy variables obviously neeed to keep the page
              //alive for as long it takes to send the custom event to the server
              var x = AdfCustomEvent.queue(eventSource, 'handleOnUnload', {args:'noargs'}, false);
              var y = 0;
          </af:resource>
          <af:serverListener type="handleOnUnload" method="#{vivaTestBean.testOnUnload}"/>
          <!--
          <af:form id="f1">
            <af:commandButton text="Unload" id="cb1" action="unload"/>
          </af:form>
          -->
        </af:document>
      </f:view>
    </jsp:root>The backing bean codes:
    public class VivaTestBean {
        public VivaTestBean() {
        public void testOnUnload(ClientEvent clientEvent) {
            System.out.println("Thanks God");
    }The first way which triggers a 'unload' event by clicking a button DO WORKS. :)
    But when I changed the triggered way by changing the <af:document> to clientComponent as what you did, the 'onbeforeunload' event won't come out when I refreshed or closed the page.
    That doesn't make sence, since I think the two ways to trigger a 'unload' event are the same.
    Edited by: 841766 on 2011-3-7 上午1:13

  • Button to trigger action then call URL

    Hi all,
    Does anyone know if it is possible to create a web dynpro button which when pressed triggers an action. Within the method of this action i want to execute some ABAP code then call a website URL.
    Is this possible and does anyone know what the syntax for the URL call would be.
    Thanks in advance
    Mart

    Hi Mart
    Use this piece of code in the onaction method of the button
    data lo_window_manager type ref to if_wd_window_manager.
    data lo_api_component  type ref to if_wd_component.
    data lo_window         type ref to if_wd_window.
    lo_api_component  = wd_comp_controller->wd_get_api( ).
    lo_window_manager = lo_api_component->get_window_manager( ).
    CALL METHOD lo_window_manager->CREATE_EXTERNAL_WINDOW
      EXPORTING
        URL            = 'http://www.google.com/'
      RECEIVING
        WINDOW         = lo_window.
    lo_window->open( ).
    Hope this helps u
    Regards
    Tamil

  • When user click on Submit in the salesquote then this submit action needs to be captured in the BeforeSave script file

    Hi Expert,
    Explanation:
    In the sales quote there is a Submit in the Action Menu, so when a user click on the submit button then sales quote approval process triggers and
    sales quote saved with Approval status as "In Approval" .
    Requirement: Each time user click on the submit of sales quote then we have to record this action and update our BO for further calculation.
    Issue: All BO elements in the ActionValidation-Submit script file are accessible but they are read only so can not be modified.
              So when you click on the Submit then immediately after submit action event beforesave gets trigger, so we build logic here but issue is that we           are not  able to segerate this save even, I mean which SAVE is coming from the EXPLICIT save button on the UI or which save being triggered           from Submit Action.
    Resolution tried: We found only one script for the submit action ActionValidation-Submit script file so we implemented this script but here all BO                          elements are read only, we can not modify those elements.
                             Even we are not able to return any variable on the validation submit script. so only we can return true/false that says validation is                          success or not.
    My Question : How to capture the information in the event before save when user click on the submit on the sales quote.
                             So other than valiation script file is there any other appraoch by which I can acheive this. even in the global variable "this"  I also dont                          find any varaible that is setting as true/false that refers to action triggers on the sales quote.
    Thanks
    Asaad

    Thanks Meghana.. Appreciate your input.
    We are doing this but the issue we are encountering is after the submit if other user changes sales quote and click on the SAVE button then we dont want this save from SAVE button on UI, so always whenever user click on the submit from action menu in the sale quote then we need to capture user information at the submit click.
    Thanks
    Asaad

  • Using cue points in Flash CS5 to trigger actions

    Hi there,
    I'm looking to use a cue point in a video to trigger an action, in this case go to and play at a movie clip on the stage. Is this possible. My setup is as follows:
    I've a video on stage with the instance name 'vid', with a cue point 'lap1' (an actionscript cue point created directly in Flash using the properties panel). When the video reaches cue point 'lap1', I want it to go to and play frame 2 of a movie clip I've got on stage with the instance name 'cueMovie'.
    Any help would be great; I've looked online for tutorials but no joy.
    Cheers,
    Conor

    1  stop();
    2  varListenerObject:Object = new Object();
    3  listenerObject.cuePoint = function(eventObject:Object):Void{
    4  trace(Cue Point:"+ eventObject.info.name);
    5  trace("event:"+eventObject.info.type);
    6  if(eventObject.info.name=="cue Point 1"){
    7  gotoAndStop(2);
    8  }
    9
    10 }
    if your cue point is named cue point 1 then you can leave script as it is if not you have to insert your cue point name> Also it has to be an event type of cue point to work.

  • Automator 2.1.1 iTunes Actions Set Info

    I have several Automator programs that I've created and have been using successfully for several years. All of a sudden, two Automator Actions stopped working. They are "Set Info of  iTunes Songs" and "Set Options of iTunes Songs".
    I found a discussion thread in MacWorld's website from over a year ago... something to do with iTunes 10 and version 4.6. You had to find the specified Action in the System Library, show package contents, open the info.plist and remove the version check.
    Is there an Apple fix for this? Or, do you think something else has happened?

    I had the problem where I got an unknown error when upgading from 3.1.3 to 4.0.1 last night. It put my phone into recovery & said that I had to restore it. Tried to twice but I still kept getting the unknown error message. Wasn't until I restarted my computer that it let me restore.
    All of my music, videos, contacts, etc are fine. But I found that none of my apps were restored to the phone. So I had to go back through & manually drag each one back onto the iPhone in iTunes and then re-sync it. But now none of the apps will load or open. I have tried switching the phone off & back on a number of times but it hasn't helped.
    Next I am going to try to restore again & see if that helps. From what I understand, the apps should have also been restored from the previous backup. Am not sure what happened in my case though

  • Perl's __END__ doesn't work under Automator's Run Shell Script action

    Howdy,
    I have a large embedded data file in my Perl source file using the _END_ token. It works great at the command line, but when I copy and paste my Perl code into the Run Shell Script code window and execute it, reading the special file handle DATA always returns 0 lines.
    Help?
    -Eric

    Originally I was using $@ to parse a string and get the result pasted by the service. That was a while ago. There, I noticed that some Japanese characters were messed up. Basically all the kana characters that come with voicing markers like が-ga (instead of か-ka) etc. I did not have the time to pursue that issue though.
    Then, last night, I found that a colleague of mine had tried to use $@ to feed to a local dictionary application called ding (http://ftp.tu-chemnitz.de/pub/Local/urz/ding/). His problem was with characters that had umlauts. After verifying how he wrote his action I remembered that I had similar issues with Japanese.
    Basically his command was "/path/to/ding $@"
    That's supposed to use the selected string as an argument to pass to ding, which will launch a Wish application where the string is used as the searched item.
    From Terminal, that works a treat. But the exact same line in Automator (with input as argument, not as stdin) messed the composition and the resulting string was not recognized by ding as a match to what it was supposed to match.
    So, I tried a few things to get to the core of the issue and found that a simple "echo [accented characters]" was enough to reproduce the difference in string handling between Automator and Terminal. That difference is also reproduced on a number of person's machines.
    I have a number of services that basically revolve on "run shell script" actions and involve 3rd party application outputs, preference files etc. so it would not be convenient to show that to you.
    I have sent a mail about this issue to the automator list yesterday too:
    http://lists.apple.com/archives/Automator-users/2011/Jun/msg00004.html

  • Automator bug in Group Mailer action

    Hello, I think there's a bug with the Group Mailer action. The first time I ran the workflow it only worked partially. Not all the mails included the email message. When I ran the workflow again it only included the greeting and completely left out the email Message from the "New Mail message" action.
    I have the following workflow setup:
    New Mail Message
    Get Specified Address Book Items
    Group Mailer
    Send outgoing mail
    The workflow will include the email message if I deselect the "add greeting" from the "Group Mailer" action. But then I won't have the personal greeting. I might as we'll use "bc" in the email instead of using Automator.
    Please help.
    Thanks.

    The workflow works with some restrictions only to be found by trial and error (i bought SerialMailer to avoid further irritation).
    I translated the workflow commands from Dutch into English, excuse if me I do not use the correct wording.
    First [create new mail message] (You cannot use any formatting or import text, result panel will show mail)
    Next [Search address book groups] (Results panel should show the group)
    Then [send e-mail to group] (you can use the "dear" etc check box
    a bubble will connect the search group and send e-mail box
    Finally [send outgoing mail].
    You cannot select a concept mail in your Apple Mail, Automator needs to create one and Automator will put it in the outgoing mailbox (this box you cannot reach as user, it is hidden!).
    Good luck

  • Hi, I'm planning on using Mainstage 3 for performing live and I wanted to know how to add my Logic Pro backing tracks into it and have automated vocal effects that trigger while I'm singing.  How do I do this?

    I have a mic hooked up through an interface and I'd like to open up my backing tracks then figure out what vocal effect sound good on what places during the song, then I want to have those automatically trigger while I'm singing and performing.  Any help or suggestions would be much appreciated.  Thanks.

    Here’s a couple of links to get you started on your research...
    OS X Lion Overview
    iLife 11
    http://www.apple.com/ilife/video-showcase/
    http://www.apple.com/ilife/
    Running Windows on a Mac
    http://www.pcmag.com/article2/0,2817,2344661,00.asp
    And just in case you didn't know... This is a User to User Forum

  • How to trigger action dynamically in Web Dynpro ABAP?

    Hi,
    I need to trigger an action dynamically. How do I do that?
    Eg. I have Search Tab where I input Purchase Order Number and press Find button to get the PO details.
    Now I have an Overview Tab where I have listed all the Purchase Orders, after selecting a purchase order I click the Transfer button on the Overview Tab, on clicking on transfer button I navigate to the Search Tab and the PO number selected in Overview Tab is binded and appears in the Search Tab.
    In the same flow I also want to trigger the action without clicking on Find button of Search Tab so that I get the search results.
    Please let me know how to go about doing this.
    Thanks
    Samekshaa

    fire plugs in Search Tab as it has multiple UI view containers which displays different views in the Search tab.
    can you elaborate on that ...  a clear explaination of what u intend to do will be of great help.
    Outbound Plugs can have Parameters. so you can still decide what plug to fire , further when in the details view.
    i dont think there is option of raising ONACTION automatically because framework create an EVENT object for each action, at the most you can transfer this EVENT as Parameter to other methods.
    Greetings
    Prashant

  • Trigger action when file opens via bridge

    Can something be done to trigger a photoshop action when a photoshop files are opened using the Load Files as Photoshop Layer command or using DR.Browns Services Place-A-Matic 8bit?
    The Scripts Events Manager is unable to run an action or script when the photoshop file is opened through Bridge using the Load Files as Photoshop Layers or Dr. Brown's Place-A-Matic script.

    Control will return to your function only after the copy is done so technically any code you place after the copy command will execute after the copy. But you should at least test to make sure the copy worked before you run off and start doing things about it.
    BOOL worked;
    worked = [[NSFileManager defaultManager] copyItemAtPath:[fromPathDirectory stringByExpandingTildeInPath] toPath:[toPathDirectory stringByExpandingTildeInPath] error:nil];
    if (worked) { //copy worked, execute code here}
    else { //copy failed - deal with error return code here.}
    HTH,
    =Tod

  • ITunes 10 + Automator. Where's "Play action?

    After I updated to iTunes 10, I lost the most iTunes actions in Automator (primarily "Play").
    iTunes system gives me an error that those codes do not exist and I should update my iTunes to 4.6 or higher...
    Any solutions?
    Thank you

    The bad news is, iTunes 10 is missing the following actions:
    Add Songs to iPod
    Add Songs to Playlist
    Ask for Songs
    Change Case of Song Names
    Get Selected iTunes Items
    Get the Current Song
    Import Audio Files
    Import Files into iTunes
    New iTunes Playlist
    Pause iTunes
    Play iTunes Playlist
    Remove Empty Playlists
    Set Info of iTunes Songs
    Set iTunes Equalizer
    Set iTunes Volume
    Set Options of iTunes Songs
    Start iTunes Playing
    Start iTunes Visuals
    Stop iTunes Visuals
    Update iPod
    The good news is, iTunes' AppleScript dictionary appears to still contain the ability to script all of these items, which means that it should be easy for now to create AppleScript actions to replicate these, and that it should at least be possible for these actions to return. Will they? I certainly hope so!
    Shawn

  • Agentry: Trigger action when changing main screen tab

    Hi,
    I'm adapting Work Manager for iPad and in my main screen I have 4 tab screens: Work Orders, Notifications, Time Sheets and Crew Manager.
    I would like to trigger a List Selection action step when the user navigates to the Time Sheets tab in order to select the current day of the week automatically. I already created and tested the action with a button and it's working fine but I don't find a way to trigger an action when changing main screen tabs.
    Here my main screen:
    In the screen definition there is not much I can define... just the icon, size and styling...

    Ok, thank you both, the question has been answered
    Regarding Bill suggestions I think there are too many possible actions in the main screen where to apply the selection step.
    And to apply Jason's workaround I need to do a major UI change and user's are too familiar now with the solution that has been in production for a while...
    I think I will set the date after transmit. It won't work on the initial load and when user manually selects a different day and comes back to the tab, but I think it will cover more than 90% of application uses since they are supposed to synchronise every morning and register time for the current date usually.
    @Jason: I hope you can tell the idea to the engineering team

Maybe you are looking for