AppleScript freezes in editor but works in script menu.

Hi guys.
I've run into a weird problem while writing a simple AppleScript for Aperture. It works fine if I save it and run it from the script menu, but if I run it from Script Editor, all I get is a spinning beach-ball. How is this possible? This is the part of the script that makes it hang:
tell app "Aperture"
set sel_ to (get every image version of library 1)
set list_ to {}
repeat with i from 1 to (count sel_)
tell (item i of sel_)
if (get value of exif tag "CaptureYear") is 2010 then
set end of list_ to (item i of sel_)
end if
end tell
end repeat
end tell
Does anybody have an idea why this works in the script menu but not in the editor?
Thanks,
Morten

Sorry, I should have posted this in the AppleScript forum.
Morten

Similar Messages

  • Workflow does not work from Script Menu or as Application

    Hi,
    I create a really simple script to adjust podcast volume...
    1. Get Specified iTunes Items (Recently added podcast – my smart folders of recently downloaded items)
    2. Filter Songs in iTunes (Volume Adjustment is 0: so the workflow will not touch podcasts already adjusted.)
    3. Set Options of iTunes Songs (Volume Adjustment: 80)
    The workflow works find when running from Automator. But when I save it as script plug-in or application and try to run it, nothing happens. Please help. Thanks.
    P.S. I tried to create folder action script that adjust the volume automatically when a podcast is downloaded (get selected items -> set options in iTunes songs). At first it works. Now it doesn't.

    It starts by pausing iTunes, executes a applescript where there are say commands, pauses for 3 seconds, gets info from ical, filters out todays events, speaks these events out loud, fetches a weather report via web(xml), speaks out loud, pauses a couple of seconds, gets current itunes song, resumes playing of this song and the workflow is finished.
    It quits right before it is about to announce todays events. Doesnt matter if there are events for today or not. If I start the application manually however, everything seems fine.
    The Applescript used to launch the program:
    tell application "TodaysiCal"
    run
    end tell
    Any suggestions now ?

  • "Show Script menu in menu bar" setting won't stick

    Hi all,
    I'm starting some Applescript development, and I'd like to make some scripts available in the Scripts menu. I checked the box to "Show Script menu in menu bar" from within the prefs for AppleScript Editor, but it doesn't work. When I close AppleScript Editor, relaunch it, and look at the prefs again, the box is unchecked. I deleted the relevant preference files from my Library and recreated them by launching AppleScript Editor, but the setting just won't stick.
    Any ideas?
    -Tim

    Taylor,
    The preference that I'm looking at is within AppleScript Editor, the program I use to write new AppleScripts. Script Editor was the previous name of the same application. When I check the "Show Script menu in menu bar" in the AppleScript Editor prefs and close with window. The box is unchecked the next time I open the AppleScript Editor application, and the Script menu never appears in my menu bar. Everything works fine on my iMac at home. The problem seems to be isolated to my MBP. Weird.
    -Tim

  • Showing the script menu

    How do i activate the script menu in itunes. So i can see my scripts onscreen within itunes. Sinc I can't see them right now, i assume it means i do not have my itunes scripts assigned to itunes. but my finder script menu shows lots of itunes scripts in it. It also shows lots of safari scripts, although i can't see those inside Safari either. This has to be easy, but applehelp offers not help.

    Scripts for iTunes must be placed in specific locations to automatically appear in the Scripts menu:
    HD/Library/iTunes/Scripts (accessible by every account)
    or
    HD/Users/Username/Library/iTunes/Scripts (account specific)
    When you've never used scripts this way, the Scripts folder inside the iTunes folder does not exist, so you have to create it.
    A good resource for iTunes scripts is http://www.dougscripts.com/itunes/
    Hope this helps.
    M

  • Apple Script: Script works in Editor but not in iTunes

    Ok so I have written/cobbled together other peoples scripts to make my own script but now it will only work in Script Debugger 4.5 or AppleScript Editor??? When I exicute the script in the editors it works perfectly, but when its saved and added to the iTunes script folder it all works except for one part.
    This part is supposed to duplicate the iTunes file then open it back into itunes, so I have two copies of the file (so I can alter one). Now in itunes everything works but it seems to be skiping over the open command??
    any help would be appreciated
    to DuplicateItunesFiles()
        set trackTitleList to ""
        tell application "Finder"
            repeat with i from 1 to the count of the selected_track_files
                set currentFile to item i of selected_track_files
                set currentTitle to item i of track_titles
                set trackTitleList to trackTitleList & ", " & currentTitle
                open (duplicate currentFile to folder of location_file)
            end repeat
            if trackTitleList is "" then
                display dialog "Sorry, couldn't duplicate your tracks."
            end if
        end tell
    end DuplicateItunesFiles

    Ya sorry about that, the script is long and poorly made so I didnt want to scare people of haha.
    Here is a link to the script I am having trouble with (Version 5.2): http://pastebin.com/dGsHifZM
    and I'm not sure if this is helpfull but here is an older version that works...in both the editor and iTunes http://pastebin.com/chb19KNQ
    Errors: I get this error only sometimes:
    Can’t get «class cTrk» 1 of «class pPla» of application "iTunes".
    Edit: Can I not edit my origonal post to add the links into it?

  • Script works in Script Editor, when saved as app, no longer works

    I've been playing around with AppleScript trying to learn a little. I wrote an app to fullscreen the current application. First I wrote one to full screen a specific app:
    tell application "Safari"
    set the bounds of the first window to {0, 0, 1440, 894}
    activate
    end tell
    This worked without any problems and I set a keyboard shortcut to activate it.
    Then I decided to make it work for the current app:
    tell current application
    set the bounds of the first window to {0, 0, 1440, 894}
    end tell
    When I ran it in Script Editor, it worked fine and set the bounds of the Script Editor window to what I asked. When I save it as an application the same way I did the first app, it doesn't work. I get the error message "Can't set the bounds of window 1 to {0, 0, 1440, 894}." I tried it on the same Script Editor window it worked on when I simply clicked run, but I keep getting the error message.

    try something like this saved as an app
    tell application "AppleScript Editor"
    activate
    make new document
    set the bounds of the first window to {0, 0, 1440, 894}
    make new paragraph at beginning of document 1 with data "hello world"
    end tell
    tell application "TextEdit"
    activate
    make new document
    set the bounds of the first window to {0, 0, 1440, 894}
    make new paragraph at beginning of document 1 with data "hello world"
    end tell
    Budgie

  • Multicam works in the angle editor but not in timeline

    I have 2 cameras in the new multicam system and they work in the angle viewer in the angle editor but once I go back to my work  timeline one of the cameras goes black and there is no video or audio .  Please help.

    i just figured it out.....

  • Flash works in Flash editor but not when puiblished

    Hi
    I have got my flash working fine in the editor but when I
    publish it, neither opening it in IE from the hard drive, nor from
    the internet works.
    The animation works fine, but there should be images loaded
    onto the animated squares and there's not.
    Any thoughts?
    Thanks

    LLuis12 wrote:
    > Hi
    >
    > I have got my flash working fine in the editor but when
    I publish it, neither
    > opening it in IE from the hard drive, nor from the
    internet works.
    >
    > The animation works fine, but there should be images
    loaded onto the animated
    > squares and there's not.
    My guess is your paths are wrong to the loaded content. Done
    for local view
    not for html. Make sure the paths to files are a ok.
    Best Regards
    Urami
    <urami>
    If you want to mail me - DO NOT LAUGH AT MY ADDRESS
    </urami>

  • PSE 9 on Win 8.1: Editor stopped working but organizer works.

    Editor stopped working but organizer works. Un install and re install didn't solve problem

    You don't give us much to go on, like what operating system, when the editor fails, etc. More information would help,
    but try quitting the editor, then restarting while holding down ctrl +alt+shift/command+option+shift. Keep the keys down till you see a window asking if you want to delete the settings file. You do.

  • Snow leopard freezes  but works fine in safe mode

    I have been using snow leoprad and it hangs after  login to the system (from the first one/two minutes). But it works well in safe mode . So far the things I  have tried are - repair the disk permissions, verify the disk , created a  new user account etc.  But  I'm not getting a soluion. Please help!!

    Hmm, that's not good.  Running out of "moving parts".
    No third party add ons but works in safe mode only!    Here's the apple article on what happens during a safe boot.
    Mac OS X: What is Safe Boot, Safe Mode?
    Since third party stuff is rulled out you would think it would be one of the other things mentioned that may be corrupted.  For example, /System/Library/Fonts, font cache.  In other words, font related. 
    Not sure what to suggest at the moment and it's my bed time. 
    Maybe look at OnyX (Maintenance, Rebuild) and rebuild the dyld shared cache and look at other stuff in OnyX that might need rebulding (Cleaning, Fonts, delete font caches).

  • Speak Sender Name Only AppleScript in Mail No Longer Working In Mountain Lion

    Hi all, the title pretty much says it all.
    I have a very simple AppleScript that I use as a rule in Apple Mail everytime new email comes in.
    This AppleScript will speak only the sender's name. That's all I want it to say.
    I there are two emails, it will say, "Mail From John Smith" followed closely by "Mail From Johnny Appletree", etc.
    This works great in Lion as a Mail rule.
    I have properly placed this AppleScript in the correct path for Mail scripts.
    It's located in:
    (user name)/Library/Application Scripts/com.apple.mail
    I've popped in the sample script provided by Apple into this same path that speaks the total number of selected emails, the name and the subject, etc. That works fine, so I'm positive the path is correct. But that script says a bunch of items I don't need. I just need a simple script and I'm guessing somehow the conversion from Lion to Mountain Lion doesn't work for some reason with this script.
    Anyone know how to modify this supposedly simple script to make it work in Mountain Lion?
    Any help is most appreciated, thanks!
    Here is the script I had been using in Lion as a Mail rule without any issues before Mountain Lion:
    on perform_mail_action(info)
    -- see if iTunes is playing
              set itunes_playing to false
              tell application "System Events"
                        if (get name of every process) does not contain "iTunes" then
                                  set itunes_playing to false
                        else
                                  tell application "iTunes"
                                            if player state is playing then set itunes_playing to true
                                  end tell
                        end if
              end tell
    -- pause iTunes if needed
              if itunes_playing is true then tell application "iTunes" to pause
              tell application "Mail"
                        set the_messages to |SelectedMessages| of info
                        repeat with a_message in the_messages
                                  set the_sender to extract name from sender of a_message
                                  if (junk mail status of a_message) is not true then
                                            say "Mail from " & the_sender
                                  end if
                        end repeat
              end tell
    -- resume iTunes if it was playing before
              if itunes_playing is true then tell application "iTunes" to play
    end perform_mail_action

    Hi,
    This script should work, try it :
    using terms from application "Mail"
          on perform mail action with messages theselectedMessages
                tell application "iTunes" -- this doesn launch Tunes if iTunes is not running
                      set itunes_playing to running and player state is playing -- see if iTunes is playing
                      if itunes_playing then pause -- pause iTunes if needed
                end tell
                tell application "Mail"
                      repeat with a_message in theselectedMessages
                            set the_sender to extract name from sender of a_message
                            if (junk mail status of a_message) is not true then
                                  tell me to say "Mail from " & the_sender
                            end if
                      end repeat
                end tell
                -- resume iTunes if it was playing before
                if itunes_playing then tell application "iTunes" to play
          end perform mail action with messages
    end using terms from

  • Some sample Applescripts are missing from Script menu.

    I am a new to AppleScript and I have just started reading A Beginner's Guide to Apple Script (by Guy Hart-Davis). The book makes numerous references to the default example scripts that are created during OS X install. I have added the script menu to to the menu bar and when I open the script menu - I only see about half of the default scripts that are shown in the book. I did some browsing and found other examples of the script menu which shows fewer scripts than the example in the book - but still shows a few more than what I am seeing on my system. On my system I do not see the following scripts (Address Book Scripts, Basics, Finder Scripts, Info Scripts, Internet Services, Navigation Scripts, URL's or Virtual PC Scripts). I am on SL 10.6.2. The book is written for SL 10.6 - but also makes references to Leopard 10.5. Is there something wrong with my system or were some of these default scripts eliminated in 10.6.2. My iMac came with 10.6.1 initially - so I have no prior OS version as a point of reference. My concern is that I progress with the lessons and exercises in the book - that there will be continued references to these missing scripts - as I suspect that the missing scripts may be used as a starting point for creating new scripts. Any idea where I can find the scripts that I listed as missing?

    Thanks. The book I am using appears to be a brand new book just released a month ago (or so). It appears the book may have been written for Leopard and tweaked for Snow Leopard (but under the guise of being the other way around) - without actually verifying that the examples for Snow Leopard actually work. The website for the book (McGraw Hill) does not seem to provide a mechanism for providing feedback or errata info. So far these missing scripts have not hampered my progress - except on the initial example. I was more concerned that something was missing from my iMac.

  • Open .scptd in Editor, but want it to run.

    When I opened an AppleScript file for the first time I remember getting a dialog that asked if I should run it by default or open by default. I chose open. But I really want run. Now I can't find the option to change it to run a script by default.

    Okay, not really sure how you saved it originally but (depending on exactly what you want to do) there are a couple options, the most common probably this:
    Open the script in the editor on the desktop
    Go to file > save as (which gets you a save window)
    Specify a location to save to (say, Desktop)
    As "File Format" choose "Application"
    As "Options," leave boxes unchecked. If you check "Run Only," that will make the script itself inaccessible to you and others -- so, unless you want that, don't check it.
    (These are what you'll find if you're using the usual "Script Editor," but if you're using another editor (e.g., Script Debugger) the choices may have different names but will be similar.)
    You will get a script application icon on the desktop. Double-clicking that will run the script without again showing the script editor window. This app may also be entered into Startup Items (System Preferences), in which case it will run each time the computer is started. Finally, regrding the desktop icon, there ways to customize the icon itself.

  • Run a applescript in scripts menu in Photoshop

    Hello I been trying to figure out a way to run a applescript saved as an application bundle into a javascript. I would appreciate any help on this.
    David

    It used to state (don't know if it still does not checked) that AppleScripts can be placed in the Photoshop scripts folder… This is not the case. Anyhow if I recall correctly then File.execute() from ESTK does not work as if double clicked in the GUI. If you use CS4+ then you could have the system open the app but this is where things get out of hand, have JS calling Shell to open AppleScript… Too much of a mess for me so Im learning the ESTK
    Something along the lines of…
    app.system('open ~/Desktop/Some.app');
    May work for you but its one ugly work around… and you may need to quote the path string too…

  • Swf link not working in Firefox, Opera and Internet Explorer but works in Safari

    Hi,
    I'm sorry but Im a real newbie and really need help!!!
    On the homepage of my website I have put a swf file that I linked to another page in my website through the div a href link and it displays great on safari and links, however in other browsers, when i try to click on it, it comes up with the link at the bottom of the browser (where it sometimes says Done), however it doesnt actually link, it jsut stays on the homepage.
    Here is the coding i put in:
    <div id="products2">
              <p>
              <a href="Our_brands/index.html">
                <script type="text/javascript">
    AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','wid th','449','height','449','title','Products','src','Productions/boxes3','quality','high','p luginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=Shockwav eFlash','movie','Productions/boxes3' ); //end AC code
              </script>
                <noscript>
                <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="449" height="449" title="Products">
                  <param name="movie" value="Our_brands/boxesnew.swf" />
                  <param name="quality" value="high" /><param name="SCALE" value="noborder" />
                  <param name="allowScriptAccess" value="always"/>
                  <embed src="Our_brands/boxesnew.swf" width="449" height="449" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" allowScriptAccess="always" scale="noborder"></embed>
                  <br />
                  <br />
                </object>
                </noscript>
              </a>
              </p>
            </div>
    Could someone please tell me where I am going wrong?
    I would REALLY appreciate it.
    Thank you in advance!!

    I'm doing it for a client and they dont want it put up on the server yet, I wish I could put it up bc I have no idea what I'm doing!
    Basically I wanted a swf file from Flash to display a range of products (I have turned all the products into buttons) and then I put coding into all the buttons to on release getURL which work in the swf file, however when I put the swf file into dreamweaver, the buttons worked in hover state, but the action scripting didn't work to link the swf file to another page in the website (the index in Our_brands folder).
    So i decided to make it link to the index.html in Our_brands folder from wrapping the swf box in a div tag and linking the div tag <a href="Our_brands/index.html"> which links it great in Safari but wont link in Firefox, Opera and Internet Explorer.
    Does that make any sense?
    Sorry if it doesn't.
    Thanks for the quick reply as well!!!

Maybe you are looking for