


Set thisRating to thisRating / 20 as integerĭisplay dialog "Rating of " & thisRating & " applied to " & trackCount & " song(s). If item m of addSourceData ≠ item m of addSynchData then If ((m = 1) and (matchDef contains "Time")) or ((m = 2) and (matchDef contains "Size")) or ((m = 3) and (matchDef contains "Year")) or ((m = 4) and (matchDef contains "Bitrate")) then Set frontApp to name of first process whose frontmost is true Aparece un cuadro de diálogo que le pide que califique la canción actual en una escala de 0 a 5 con una calificación predeterminada de 4. Lo ejecuto con un comando de teclado usando FastScripts. The AppleEvent as a whole is both itself and the AppleEvent Descriptor.No recuerdo dónde encontré esto, pero es una versión más robusta que podría ayudarte. Each descriptor can contain other descriptors as an ordered array or as a mixture of keyed data. An AppleEvent is a self-contained block of data which consists of a sequence of key-type-value data (called an AppleEvent Descriptor, or AEDesc). This makes it easy to debug the script when. The Script Editor can move the insertion point to a specific line of code. Select the event you want to respond to, and then click Add. In order to use AppleEvents on newer versions of macOS (Mojave and later) you may need to include the NSAppleEventsUsageDescription key in your plist file.ĪppleEvents are a way for macOS apps to communicate with one another. The Script Editor makes it easy to insert the template for an item event handler. Note: If there is an error in your AppleScript, it is logged to the Messages panel at run-time. This command calls the above script that adds two values: Scripts that return values can be assigned to a Xojo variable. If it has parameters, you supply them after the name as you would any other method that has parameters. You use the name it has in the Navigator. All values are returned as Strings to Xojo.ĪppleScripts are called just like built-in global methods and functions. This example adds two values and returns the result:ĪppleScript does not use types like Xojo does. You can also return values from an AppleScript back to your Xojo code by using the return command in the script. All other Xojo types (including other numeric types such as Int8 and Double) are sent as Strings and are treated as Strings by AppleScript. Xojo Integers passed to AppleScripts are sent as Integer values and are treated as Integers by AppleScript. To pass parameters, add an “on run” handler to contain your script and specify the parameters using curly brackets:
