How to activate a script when not in target program?

So I'm trying to make a script that will rate my itunes songs when I'm not actually in the program. I found a how-to that lets me make a keyboard shortcut to rate the song while iTunes is the active program, but I'd like to make this work at all times.
tell application "iTunes"
repeat with theTrack in (get selection)
set the rating of theTrack to 20
end repeat
end tell
Any one know how to do this? Is there a script folder I can put this where it won't matter what program is the active program?
thanks!

This script doesn't require iTunes to be the active application, it should work from any app if the script is placed into the system wide script menu. Unfortunately it does not work on a "selection" in iTunes which would require iTunes to be the active app so you could make the selection (catch 22). It does work on either the current track or album of the current track and can set half star ratings. Setting a rating to zero will remove it.
<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
margin: 0px;
padding: 5px;
border: 1px solid #FF0000;
width: 720px; height: 335px;
color: #000000;
background-color: #ffff99;
overflow: auto;">
try
try
tell application "System Events" to if application "iTunes" is not running then error number -128
on error
tell application "System Events" to if "iTunes" is not in (get name of every process) then error number -128
end try
set stars to {"0", ".5", "1", "1.5", "2", "2.5", "3", "3.5", "4", "4.5", "5"}
tell current application
set alb to button returned of (display dialog "Set album or track rating?" buttons {"Album", "Track"} default button 2)
set val to (choose from list stars with title "Tune Stars" with prompt "How many?")
end tell
set val to (20 * val as real) as integer
tell application "iTunes"
if alb is "Track" then
set rating of (get current track) to val
else
set album rating of (get current track) to val
end if
end tell
on error errMsg number errNum
error number -128
end try
</pre>

Similar Messages

  • How to debugg a script when the Required out put is like Fax  or email

    Hi this is Durga Prasad i have small doubt in scripts can any one clarify that one plz  normally we will do that one with activating debugger but when a special requirement is like fax or e mail    how we will do that one
    "how to debugg a script when the Required out put is like Fax  or email"
    Thanks in advance
    Durga Prasad.

    Hi
    DEBUG Smartform:
    1) One way to debug smartform is to debug the Function Module of that smartforms.
    If you want to debug particular smartform node that the solution would be,
    insert a "Program Line" just above the node you want to debug and this program line write a normal abap breakpoint.
    So whenever you call the smartforms, it will stop at this breakpoint and you can debug onwards.
    2) SFTRACE can be used for debugging SMARTFORMS.
    Read More here.
    http://help.sap.com/saphelp_erp2004/helpdata/en/49/c3d8a4a05b11d5b6ef006094192fe3/frameset.htm
    script
    1). Use Tools - Word Processing - Layout Set (SE71). Enter name of layout set and then Utilities - Activate Debugger.
    It is of no consequence which layoutset you enter when selecting the SAPscript debugger. (Menu path: Tools-Wordprocessing - Forms, Utilities - Activate Debugger) The next layoutset called will invoke the debugger.
    2). Another way to set the SAPScript debugger is to run program RSTXDBUG.
    When you debug Print program it is same as you debug any other ABAP program. While when you debug SAPScript, you actually debug the code ( scripting) you have written SAPScript Form.
    As per ur question there is nothing new with script debugging,
    it is same as normal report debugging...
    SMARTFORMS DEBUGGING
    For smartforms debugging you can do this.
    1. Execute the smartform (execute button in SMARTFORMS transaction)
    2. Take the generated function module and display it in SE80.
    3.Find the smartforms Elements (text elements, windows, code lines, loops) in this and set Soft break points.
    Correct name is SMARTFORM_TRACE. You have lots of options for adequate analysis
    Tcode - SFTRACE
    Re: How to Debug a Smartform
    Debug of smartform and sapscript.
    Debugging SmartForms
    Debugging of a subroutine pool.
    SCRIPT
    There are 2 separate kinds of debugging available when you try to debug scripts.
    1. Debugging the print program : This is the normal debugging we do for our report programs.
    2. Debugging the script itself : You Can debug a SAP Script by activating debugger in two ways:
    a .In SE71->Menu->Utilities->Activate Debugger, then debugger will be get activated and when your print program is executing Script Debugger will be in active and you can proceed with your debugging.
    b. Goto se38-> RSTXDBUG ->Execute this same as going thru in se71-> Menu, now debugger will be activated.
    refer to the link below
    http://www.howforge.com/how-to-debugging-sapscript-form
    Look at the BLOG here, it is well explained
    /people/sudheer.junnuthula2/blog/2007/01/09/script-debugging
    Regards
    Anji

  • How to use java script when popups are blocked in browser

    How to use java script when popups are blocked in browser

    Not. When people install a popup blocker they don't WANT popups, so stop trying to force them down their throats.

  • How to deselect the text when I start the program?

    how to deselect the text when I start the program?
    photo:

    wants the blue background could not be seen:
    Code Form:
    Public Class Form2
        Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        End Sub
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            If ComboBox1.SelectedItem = "The Sims 4" Then
                Form3.Show()
            Else
            End If
            If ComboBox1.SelectedItem = "The Sims 3" Then
                Form4.Show()
            Else
            End If
        End Sub
    End Class
    There's a lot wrong with all of that.
    I'm sorry that I won't be able to help...
    Still lost in code, just at a little higher level.

  • The countdown timers at File Storage Locker sites (fileserve, bitshare, freakshare, etc) will no longer countdown if not the active page (Since upgrading to firefox 5.0). How do make it countdown when not the active page?

    Since upgrading to firefox 5.0, countdown timers at the various file locker sites will no longer countdown when the page is not the active page. I am sure it is not a site-side change as ALL the sites countdown timers freeze when not the active page. This has only happened since the upgrade.

    For reading only as Bugzilla is Not a forum.
    [https://bugzilla.mozilla.org/show_bug.cgi?id=652472 Bug#652472] - Higher setTimeout/setInterval clamping in inactive tabs breaks countdown scripts
    In mean time you can try opening those links in a new window instead of a new tab.
    Not all sites are affected as sites like Megaupload, Filesonic, depositfiles, Rapidshare work fine.

  • How to activate save session when closing multiple tabs?

    i've opened many tabs that i want. When I close Firefox there are many tabs. Those tabs have to be restored when i open again Firefox. how to activate in firefox 4.o. In firefox 3.6 it is asking defaultly to save sessions.

    In Firefox 4 you can always restore the previous session via Firefox > History > Restore Previous Session
    You can set the warn prefs on the about:config page to true via the right-click context menu or toggle with a double left-click.
    * browser.showQuitWarning, see http://blog.zpao.com/post/3174360617/about-that-quit-dialog
    * browser.tabs.warnOnClose, see http://kb.mozillazine.org/About%3Aconfig_entries
    * browser.warnOnQuit , see http://kb.mozillazine.org/browser.warnOnQuit
    * browser.warnOnRestart , see http://kb.mozillazine.org/browser.warnOnRestart
    To open the <i>about:config</i> page, type <b>about:config</b> in the location (address) bar and press the "<i>Enter</i>" key, just like you type the url of a website to open a website.<br />
    If you see a warning then you can confirm that you want to access that page.<br />
    * http://kb.mozillazine.org/about%3Aconfig

  • HT4059 how can i read books when not connected to wifi , at the moment have to g through apps store , which requires a connection . I want the books on the i pad not in  a acloud

    How can i read books purchased from i books when not connected to wifi . At the moment can only access via app store , which can only do when connected . I want top download to the device , not keep in a cloud!

    If you download them via the Purchased tab in the ibookstore in the iBooks app on your iPad then they should show in the Books collection on the app's bookshelf - and you should be able to read any books that you download from the store to your bookshelf without needing to be online.

  • How to end a call when not in the phone app?

    OS: 10.2.1
    I like to multitask when on a call so after taking a call I might be inside another app or in the hub, basically anywhere except the phone app. 
    My trouble is.. how can I quickly end a call when I'm done?  
    Swiping up to exit the app I'm in, then pressing the button on the lower left to enter the phone app, then pressing the hang up button sometimes takes up to 5 seconds dependong on the speed of the phone at the time.  Those five seconds of silence at the end of a call can be a little awkward. 
    Any faster way to just hang up a call when NOT in the Phone app?

    You should see the phone icon on the bottom left with the call counter on it. Simply touch that to bring the phone app backup quickly and then hang up.
    1. Please thank those who help you by clicking the "Like" button at the bottom of the post that helped you.
    2. If your issue has been solved, please resolve it by marking the post "Solution?" which solved it for you!

  • How to activate new computer when we already have 6

    Hello,
    we activate 6 computers of 6 personn who need to read ebook with drm.
    In order to ease the reading we decide to move to pc-tablet (on windows 8)
    we decided to deactivate three computer by using ctrl+shift+D, but when we want to use it on the tablet it still says that we reach the maximum authorization.
    how can we activate this new computer ?
    best regards
    Thierry

    Malheureusement, le système d'enregistrement ne semble pas toujours remarquer désactivations ,
    et Adobe ne fournit pas une interface Web approprié pour vous de les administrer .
    Adobe Live Chat : http://www.adobe.com/support/chat/ivrchat.html ,
    ou comme un léger raccourci essayer http://helpx.adobe.com/contact.html?product=digital-editions&topic=usi ng - mon -produit ou service
    Choisir un thème '' La signature sur mon compte » , puis cliquez sur« je encore besoin d'aide »;
    alors vous devriez voir « converser avec un agent » au bas de la page .
    Selon la résolution de l'écran , vous devrez peut-être faire défiler vers le bas pour voir le chat avec un agent « peu , un peu moins « Demandez à nos experts .
    «Demandez à nos experts» sera en effet juste vous ramener à ce forum .
    Parfois, vous obtiendrez ' Désolé ! Tous les agents sont occupés , s'il vous plaît vérifier bientôt de retour ».
    Ne pas actualiser la page, juste accrocher et il devrait finalement aller à 'Chat maintenant , et l'agent est disponible .
    Ils peuvent réinitialiser vos autorisations , puis vous devez autoriser à nouveau les périphériques que vous encore besoin .
    ( Malheureusement , Adobe n'a pas obtenu ronde pour un site Web d'administration pour la visualisation et l'édition des autorisations . )
    Certains des représentants n'ont pas été correctement formés et ne savent pas quoi faire ( et réclamer n'y a rien qu'ils peuvent faire ) ;
    dans ce cas, le seul moyen semble être de renoncer à cette discussion et essayer une autre session l'espoir d'un représentant dûment qualifié.
    Si votre problème est avec un autre appareil à l'aide Overdrive , Bluefire , Aldiko ou une application tierce partie semblable , il est recommandé de ne pas mentionner que l'application quand sur le chat , mentionnez simplement que vous avez exécuté des autorisations ( E_ACT_TOO_MANY_ACTIVATIONS ) . Merci à AJP_Bear pour cette astuce .
    Unfortunately the registration system does not always seem to notice deactivations,
    and Adobe does not provide a proper web interface for you to administer them.
    Adobe Live Chat: http://www.adobe.com/support/chat/ivrchat.html,
    or as a slight short cut try http://helpx.adobe.com/contact.html?product=digital-editions&topic=using-my-product-or-ser vice
    Choose topic ‘'Signing into my Account' , and then click on 'I still need help';
    then you should see 'Chat with an Agent' at the bottom of the page.
    Depending on screen resolution, you may need to scroll down a bit to see the Chat with an Agent' bit, just under 'Ask our Experts'.
    'Ask our experts' will indeed just lead you back to this forum.
    Sometimes you will get ‘Sorry! All agents are busy— please check back soon.’
    Don’t refresh the page, just hang on and it should eventually go to ‘Chat Now, and agent is available’.
    They can reset your authorizations, and then you must reauthorize any devices you still need.
    (Unfortunately, Adobe haven’t got round to an admin website for viewing and editing authorizations.)
    Some of the representatives haven't been properly trained and don't know what to do (and claim there is nothing they can do);
    in that case the only way seems to be to give up that chat and try another session hoping for a properly trained representative.
    If your problem is with another device using Overdrive, Bluefire, Aldiko or similar third party app, it is recommended not to mention that app when on the chat, just mention that you have run out of authorizations  (E_ACT_TOO_MANY_ACTIVATIONS) .  Thanks to AJP_Bear for that tip.

  • How to load .jar files when not specified in the .jnlp file

    Hello,
    We are deploying an application with JWS but due to the nature of this app, we need to download additional jar file only when the user has been authenticated. The jar file(s) we need to download can hardly be predicted (in term of name) and thus cannot be all listed as lazzy resource in the .jnlp file.
    However, we would like to take advantage of the various JWS features relateed to .jar download and cache and would prefer not to reinvent the wheel by implementing our on stuff (i.e. URLClassLoader with caching etc.).
    Any idea, suggestion?
    Thanks in advance.
    Fred.

    How about writing a second jnlp file with the optional jar listed in it and running it only if your user is authenticated?

  • Script will not accept target volume when setting Windows Backup policy

    I have manually configured a Windows Backup on a VM using the GUI. I set the target volume for the backup and it works fine. However, I am trying to script out the configuration of the backup and when I run the script, I get the following output:
    Label                  : Backup
    WBDisk                 :  \\ ?\Volume{96ab04f0-5a45-11e4-80f1-00155dbae602}
    WBVolume               : Backup (E:)
    Path                   :
    TargetType             : Volume
    InheritAcl             : False
    PreserveExistingBackup : False
    Date        : 10/23/2014 12:00:00 AM
    Day         : 23
    DayOfWeek   : Thursday
    DayOfYear   : 296
    Hour        : 0
    Kind        : Unspecified
    Millisecond : 0
    Minute      : 30
    Month       : 10
    Second      : 0
    Ticks       : 635496210000000000
    TimeOfDay   : 00:30:00
    Year        : 2014
    DateTime    : Thursday, October 23, 2014 12:30:00 AM
    Date        : 10/23/2014 12:00:00 AM
    Day         : 23
    DayOfWeek   : Thursday
    DayOfYear   : 296
    Hour        : 6
    Kind        : Unspecified
    Millisecond : 0
    Minute      : 30
    Month       : 10
    Second      : 0
    Ticks       : 635496426000000000
    TimeOfDay   : 06:30:00
    Year        : 2014
    DateTime    : Thursday, October 23, 2014 6:30:00 AM
    Date        : 10/23/2014 12:00:00 AM
    Day         : 23
    DayOfWeek   : Thursday
    DayOfYear   : 296
    Hour        : 12
    Kind        : Unspecified
    Millisecond : 0
    Minute      : 30
    Month       : 10
    Second      : 0
    Ticks       : 635496642000000000
    TimeOfDay   : 12:30:00
    Year        : 2014
    DateTime    : Thursday, October 23, 2014 12:30:00 PM
    Date        : 10/23/2014 12:00:00 AM
    Day         : 23
    DayOfWeek   : Thursday
    DayOfYear   : 296
    Hour        : 18
    Kind        : Unspecified
    Millisecond : 0
    Minute      : 30
    Month       : 10
    Second      : 0
    Ticks       : 635496858000000000
    TimeOfDay   : 18:30:00
    Year        : 2014
    DateTime    : Thursday, October 23, 2014 6:30:00 PM
    Set-WBPolicy : The specified file path does not exist or is not on a locally attached disk.
    At D:\Admin\Configure_Backup.ps1:44 char:1
    + Set-WBPolicy -force -policy $BackupPolicy
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [Set-WBPolicy], Exception
        + FullyQualifiedErrorId : System.Exception,Microsoft.Windows.ServerBackup.Commands.SetWBPolicy
    The E: volume is one of three drives for the VM.  I attach and detach the volume from the Hyper-V host weekly - creating a new VHD for each week of backups.  This all works fine with me doing it manually, but I want to automate the process and
    the script below won't let me.  IDEAS???
    # Open the existing policy in Edit mode
    $BackupPolicy = Get-WBPolicy -Editable
    # Now,define the parts of it.
    # First,let's specify the files to backup
    $FileSpec = New-WBFileSpec -Filespec C:\,D:\
    # and then add that to the policy we're building
    Add-WBFileSpec -policy $BackupPolicy -filespec $FileSpec
    # Remove the existing target
    $Target = Get-WBBackupTarget -Policy $BackupPolicy
    Remove-WBBackupTarget -Policy $BackupPolicy -Target $Target
    # Add the new target
    $Target = New-WBBackupTarget -VolumePath E:
    Add-WBBackupTarget -policy $BackupPolicy -target $Target
    # Add System State and Bare Metal Recovery
    Add-WBSystemState -policy $BackupPolicy
    Add-WBBareMetalRecovery -policy $BackupPolicy
    # Define the schedule
    Set-WBSchedule -policy $BackupPolicy -schedule 00:30,06:30,12:30,18:30
    # Finally, set for VSS Copy Backup
    Set-WBVssBackupOptions -policy $BackupPolicy -VssCopyBackup
    # Finally, we need to SET the policy before it actually takes control
    Set-WBPolicy -force -policy $BackupPolicy

    Hi Dan,
    Since you want to replace the destination volume for the existing backups, I recommend you can delete the existing backup task and create a new backup task, or you can also try the steps below:
    Reattach the original (old) volume and also attach the new volume to VM, then run the powershell script to
    add the new target volume firstly, then remove the old volume, after you run the script you can detach the original volume from VM.
    If there is anything else regarding this issue, please feel free to post back.
    Best Regards,
    Anna Wang

  • Final Cut Pro X Project file corrupt, how to restore for backup when not prompted by the program?

    We have a project on an iMac 13 4gb RAM. We have discovered that it is not the event, but instead it is the project file that has become corrupted. When we try to poen FCPX it crashes, and reports that it has crashed. however, if we remove the project file and leave the event and then try to open FPCX, there is no problem. Looking online, usually FCPX asks if you want to open from the backup hat FCPX makes of yourproject. However, since we cannot opn FCPX with the project, then we cannot do this!
    Just as a side note, this is a VCE media project that is due tomorrow... So any ideas are extremely welcome!!!

    This is absolutely ridiculous:  a Project is a work so complicated, there should be MULTIPLE backups (as in Logic or Photoshop) and an easy "Restore from Backup" File command!  Instead, you must manually COPY from the backup folder in Finder -- OUTSIDE the program (and which contains only the most RECENT backup) into the parent project folder for the particular project.  This capability is almost useless, since the only backup you have might be just 15 minutes old.  Then you are up a creek.
    Fortunately there is Time Machine, and you can use that to go back far enough to find the work you accidentally destroyed (or APPLE destroyed) and MANUALLY copy that over into the correct folder using Time Machine restore procedures. 
    I am finding, which led to rant, that when I delete an Audio Effect, the Whole Project is deleted when the audio track is selected.  I'm doing something wrong, or here's more work for the programmers.
    Really, this is unacceptable work.  And thank goodness for my Time Machine.  Program 101 in work like this is MULTIPLE backup capability and an easy restore command.
    This needs to be addressed pronto.  I'm holding my breath.

  • How to activate i phone when purchased second hand

    I just bought a I phone 5c and to activate it, i need the previous owner to remove the device from their account. Well, they have not responded and i didnt know if there was anyway around that. Any help is appreciated!
    Thanks! Katherine

    There isn’t. It’s an anti-theft measure.
    (120392)

  • How to set column names when not using object of row data in  constructer

    hello i am using JTable constructer as
    public JTable(int numRows,
    int numColumns)
    can i set column names for the columns .How?

    hi,
    sure you can: Create a subclass of DefaultTableModel and overwrite the method public String getColumnName(int) which returns the column name of a specific column. Then use this subclass as the data model for the table.
    best regards, Michael

  • How to find your iPod when not connected to internet?

    I just receving lost my iPod touch. I tried Find my iPod touch on icloud and it needed the iPod to be connected to the internet to locate it. Please help?

    You can't locate an iPod Touch without internet connection because it cannot connect to a cellular network unlike the iPhone. It is impossible I guess.

Maybe you are looking for

  • Sonos system locks up iMac

    I saw an earlier post (2009) from a user who felt his Sonos music  sharing system was locking up his iMac.  I have an iMac that is about a year old.  I purchased about the most sophisticated system available.  I have the 27" screen, the 3.4 GHz Intel

  • Equipment to be sent to contractor for repairs

    PM Gurus; In a scenario, I want to send equipment for repairs to contractor and also track the maintenance cost on 'maintenance order'. I am following the steps; 1) For every equipment, one non valuated material is created in MM 2) Maintenance order

  • EPub export using just a range of pages from inDesign Book

    I've created an ePub Fixed Layout ebook from inDesign 2014.1. I now want to create a summary book for Apple's iBook store, using pages from multiple chapters. I know the ePub export dialog has an "Export Range" panel in the "General" tab. When you ex

  • Lightroom 1.4 and Windows 7

    Some background: I have had Lightroom since 2007. My current version is 1.4. I do not have the CD/DVD of the software because I downloaded it from the Adobe website. A few weeks ago I upgraded from Vista 64 to Windows 7. The issue: Lightroom has alwa

  • AFS Material Indicator in ME23N

    Hello, I have a technical requirement where I'm creating a PO using ABAP object class in a program. However, I find that the AFS material indicator in the item data is not ticked. I wish to know what are the criteria on when this indicator is marked.