When receiving items: Accept all without warning "Bluetooth: Apple Bluetooth Software Version: 6.0.7f11įolder other devices can browse: ~/Public No worries, I’m a total noob with AS and most of this stuff goes way over my head haha. return do shell script "system_profiler SPBluetoothDataType" I’m sorry, I assumed you knew how to find the value of a variable in Applescript. Set batteryLevel to property list item "device_batteryPercent" of currentDevice If exists property list item "device_batteryPercent" of currentDevice then Set currentDevice to property list item 1 of deviceRecord Repeat with deviceRecord in property list items of devices Set devices to property list item "device_title" of property list item 1 of allItems Set allItems to property list item "_items" of property list item 1 of propertyList Set propertyList to make new property list item with data xmlData The script extracts the battery percent of all connected Bluetooth devices and returns a list of records deviceStatus containing the name and battery percent of each device set xmlData to do shell script "system_profiler SPBluetoothDataType -xml" System_profiler can return the output in property list format and System Events can parse property list. That’s a stay-open Application with an “on idle” handler. I don’t know if you also need help with the the application that loops it and notifies you. Set batteryLevel to text -3 through -2 of batteryInfo Tell menu 1 to set batteryInfo to the title of the first menu item whose title contains "Battery Level" Set magicMouseItem to item 1 of (the first menu item whose title is mouseName) of menu of bluetoothMenu Set bluetoothMenu to (first menu bar item whose description is "bluetooth") of menu bar 1 This gets the battery level, but it’s UI scripting and will steal your mouse, so it may be annoying to have this polling in the background: set mouseName to "Jerry" -Put your mouse name here
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |