applescript,spotify,scripting-bridgeRelated issues-Collection of common programming errors
Tshepang
applescript edit textedit
My question is very simple, and forget me for the bad english. I need to create an applescript that opens the hosts file in OSX (/etc/hosts) with the TextEdit app. And i need to do it with administrator privileges. Ive tried with many things, including:sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit /etc/hostsanddo shell script “/Applications/TextEdit.app/Contents/MacOS/TextEdit /etc/hosts” with administrator privilegesBut i get errors all the time. The error with the second example is:-
user3311058
applescript
My mom is 150 years old and when using mail on her mac she clicks a message so it opens in it’s own window, then instead of closing it she minimizes it to the dock. Eventually she’ll have 40 open mail messages and her mac slows way down. Does anyone have an applescript that will close all open mail messages, set to run automatically once a day? Sorry I don’t know a thing about applescript.
danieljimenez
loops applescript continue
I have a simple ‘repeat with’ in an AppleScript, and would like to move on to the next item in the “repeat” conditionally. Basically I’m looking for something similar to “continue” (or break?) in other languages. I’m not well versed in AppleScript but I have found it useful a few times now.
tzippy
bash escaping applescript
I am doing some json parsing in a bash script:curl http://myurl.com/get.json | sed -e ‘s/[{}]/”/g’ | awk -v k=”text” ‘{n=split($0,a,”,”); for (i=1; i<=n; i++) print a[i]}’ | grep ‘”key”:’ | sed ‘s/:/ /1’ | awk -F” ” ‘{ print $2 }’ | tr -d “\””Now I want to take this to AppleScript but I’m a little confused with the escaping. When I escpape all the ” so I get this:do shell script “curl http://myurl.com/get.json | sed -e ‘s/[{}]/”/g’ | awk -v k=\”text\” ‘{n=split($0,a,\”,\”); for (i=1; i<=
thinkcool
python html runtime applescript
I am using the following command to pass a string to python from ApplescriptString mytext contains the HTML body of an email starting with <…Applescriptdisplay dialog (do shell script “/Users/mymac/Documents/’Microsoft User Data’/’Outlook Script Menu Items’/ test.py” & mytext)Python #!/usr/bin/env pythonimport sys import stringdef main():print sys.argv[1:]if __name__ == “__main__”:main()How can I rectify this error?
Daniel
applescript spotify scripting-bridge
I use Scripting Bridge (Cocoa) to access AppleScript methods and properties of Spotify. For example, I need to access artwork of the current playing track. On the most of my machines Spotify pushes an ordinary instance of NSImage class, which I can access via something like [[spotifyApp currentTrack] artwork], and everything works as expected.But on the one of my machines and one friend’s machine-instead of an instance of NSImage class-I get very strange SpotifyImageData by calling still the sam
George C
mail.app applescript contacts
I’m trying to set up an Applescript to add the sender of a selected message in Apple Mail to a specific group in the Contacts app. By reconfiguring the code provided in this answer, I worked up the following but it isn’t working. Any suggestions on what I am doing wrong?tell application “Mail”set theMessage to selectiontell application “Contacts”set theGroup to “_TEST”end tellset theSender to sender of theMessagetell application “Contacts”set theName to name of theSenderset thePerson to make new
thefigg88
applescript
I’m trying to make compressing a video file using HandBrake easier through applescript and have been basing most of the code off of templates I’ve found. At this point in the code, the user has specified the source file and the destination folder. Instead of HandBrakeCLI just blindly overwriting a file with the same name in the destination folder, I wanted Finder to do a check and, if a file with the same does already exist in the destination folder, then I wanted to have the filename appended w
Danijel J
applescript bash
The following code is an example of what I’m using at the moment, but it keeps erroring out on me:do shell script “find /Applications -name ‘Bingo.app’ > /tmp/remove_files” with administrator privileges if exists “/tmp_malware_alternate” thendo shell script (“for i in `cat /tmp/remove_files`; do rm -rf $i”) with administrator privilegesdo shell script “rm -rf /tmp/remove_files” with administrator privileges end ifIt’s supposed to find the existence of a file (in this case, Bingo.app) and writ
the-kenny
osx bluetooth applescript
I want to disconnect a connection to a bluetooth device through an Applescript. Please note that I don’t want to disable or enable bluetooth, I just want to disable one specific connection.
Tom
c# spotify
I need to keep a database up-to-date with a playlist’s contents.I am using the C# Wrapper for the libspotify api – http://libspotify-sharp.hallerud.se/My work flow is as follows at presentLogin, wait for playlist container to load, when loaded listen for playlist loaded events, when the playlist I am interested in is loaded wait for all the tracks on the playlist to have loaded, then write the contents to the db.I am completely clearing the cache directory everytime the program starts. I am find
Daniel
applescript spotify scripting-bridge
I use Scripting Bridge (Cocoa) to access AppleScript methods and properties of Spotify. For example, I need to access artwork of the current playing track. On the most of my machines Spotify pushes an ordinary instance of NSImage class, which I can access via something like [[spotifyApp currentTrack] artwork], and everything works as expected.But on the one of my machines and one friend’s machine-instead of an instance of NSImage class-I get very strange SpotifyImageData by calling still the sam
Duncan Bayne
spotify
I’m building a Raspberry Pi based valve-amplified MP3 player, housed in a restored Westminster radio case:http://www.youtube.com/watch?v=oTabLcVgvwoI’d like to write a simple Free client that starts playing a particular named playlist (‘Westiamp’, which is the name of the project) immediately. It’ll also interface to a USB-connected control panel for skipping between tracks, etc. There will be a simple web UI for entering username and password to log in to Spotify, and WiFi details.My question
quetzalcoatl
spotify libspotify
Currently we’re implementing Libspotify in a win 7 64 bit system. Everything seems to work fine except the playback. We get data from the callback , but even using audicity on the saved audio, is filled with abnormalities. So to research further we took the win32 sample (spshell ) and modified it to save the music data to file. Same problem, definitely music with these ticks in it. I’m sure there’s something simple I’m missing here, but I’m at a loss as to what could be the problem. Any help wo
Kristofer Sommestad
spotify cocoalibspotify-2.0
I’m using cocoalibspotify for a Spotify iOS app.At one point in my app, I’m creating a new playlist and add a number of tracks to the playlist. When doing so, I’m getting a crash since the created playlist instance seem to have been deallocated. This is what the code looks like:[[[SPSession sharedSession] userPlaylists] createPlaylistWithName:playlistName callback:^(SPPlaylist *createdPlaylist) {if (createdPlaylist) {[SPAsyncLoading waitUntilLoaded:createdPlaylist then:^(NSArray *playlists) {//
Tigresstamm
api position player spotify
I’m trying to play a song from a position other than the beginning of the track.I’ve found that player.position = X will work as a standalone function, such as triggered by a button, but triggering it on player.observe(models.EVENT.CHANGE… results in a crash.I figure this is because the track hasn’t actually started playing once the event occurs as the player.position may still be at the previous song’s position.I’ve also experimented with sp.trackPlayer.seek() which seems to give the same res
Laurens
spotify
I’m trying to write a visualizer for Spotify using the Processing library.But I have a problem with the audio.RealtimeAnalyzer class.var analyzer = audio.RealtimeAnalyzer.forPlayer(models.player); analyzer.addEventListener(‘audio’, function(data){ … });If I let this run for an hour Spotify is using more then 1.5GB of memory and eventually crashes. Is there any possibility for dumping or freeing all this unnecessary memory? Or can I solve this issue with using an other class?
user605710
spotify
I’m trying to develop a Spotify app — it uses setInterval to change a canvas element, in order to create some animation.Like two others I found, my app seems to just rampantly eat memory until the app crashes, and it does not take long. Neither of these has answers — Spotify directs us to ask tech-support questions here. Anyone know why this happens or how to fix it? Thanks BobSpotify Apps API Memory Leak Spotify App API memory leak
TiagoOliveira
c spotify libspotify
I was testing out libspotify library (version 12.1.51 x86 for linux) and the application keeps crashing when I call sp_session_create() with a segmentation fault. I don’t have application key, nor a Premium Spotify account (yet), but that shouldn’t be the reason for the crash, since if I remember correctly, there is an error code for invalid application key.My code is as follows:static uint_8_t g_appkey[] = {1, 2, 3}; static const char *username = “MyUsername”; static const char *password = “MyP
Ivan Kelly
c segmentation-fault spotify libspotify
I’m getting a segmentation fault using if I try to call sp_session_logout after playing a song. I can’t really say much about the segfault, as I don’t have the symbols, With the following code the segfault occurs every time after logout is called https://gist.github.com/ivankelly/5564318#0 0x00007ffff7ac5746 in ?? () from /home/ivan/Apps/lib/libspotify.so.12 #1 0x00007ffff7a38289 in ?? () from /home/ivan/Apps/lib/libspotify.so.12 #2 0x00007ffff7a38535 in ?? () from /home/ivan/Apps/lib/libspot
Greg Steiner
xcode cocoa email scripting-bridge
Here’s what I’m attempting to do: Let’s assume that you are in mail and create a New blank mail message, then enter some data into it, such as body copy, etc. (in my case, the message was created through scripting bridge using the “Mail Contents of this Page” from safari… the main purpose of this process for my application.)From my application, I want to select that message and assign it to:MailOutgoingMessage *myMessage;so that I can programmatically add recipients. I’ve tried several ways
Daniel
applescript spotify scripting-bridge
I use Scripting Bridge (Cocoa) to access AppleScript methods and properties of Spotify. For example, I need to access artwork of the current playing track. On the most of my machines Spotify pushes an ordinary instance of NSImage class, which I can access via something like [[spotifyApp currentTrack] artwork], and everything works as expected.But on the one of my machines and one friend’s machine-instead of an instance of NSImage class-I get very strange SpotifyImageData by calling still the sam
Philip Regan
objective-c cocoa scripting-bridge
In using Scripting Bridge with Excel, when I get the value of a single cell, I don’t know what class I’m going to get from the cell. A range of a single cell so far returns an NSString or NSNumber (a range of multiple cells always returns an NSArray and I need to coerce the values from there). In my work, I usually only want the string value of the cell, so to coerce the value of a single-cell range into what I need, I do this…NSString *cellValue = [targetRange.value get]; if ([cellValue isKin
user1231779
xcode osx scripting-bridge
To use ScriptingBridge with iTunes, I used:iTunesApplication *iTunes = [SBApplication applicationWithBundleIdentifier:@”com.apple.iTunes”];However, when I run the application, (I have traced the source of the error to the above line), I get a build failed, and these errors:Apple Mach-O Linker (Id) Error “_OBJC_CLASS_$_SBApplication”, referenced from: objc-class-ref in AppDelegate.o ld: symbol(s) not found for architecture x86_64andApple Mach-O Linker (Id) Error Linker command failed with exit co
goofrider
osx cocoa itunes macruby scripting-bridge
I’m trying to populate an NSPopUpButton with an array of ITunesPlaylist objects. I got the NSArrayController bind to NSPopUpButtonapp = SBApplication.applicationWithBundleIdentifier(“com.apple.iTunes”) playlists = app.sources.objectWithName(“Library”).userPlaylistsmyArrayController.setContent playlistsAll the playlists will appear in the NSPopUpButton but they all have names with <ITunesUserPlaylist:0x4018a5000: iTunesUserPlaylist 0 of iTunes Source “Library” of Application “iTunes” (51822)&g
alwaysapple
objective-c itunes scripting-bridge artwork
I have been trying to figure out how to get the iTunes artwork for the currently playing song with scripting bridge. I have gotten to a point where it works for some songs, but for others, I get a SIGABRT. I’m not sure what the issue could be, so any help would be greatly appreciated. Here is what I have so far:iTunesApplication * iTunes = [SBApplication applicationWithBundleIdentifier:@”com.apple.iTunes”]; NSImage *songArtwork; iTunesTrack *current = [iTunes currentTrack]; iTunesArtwork *artwor
abroekhof
objective-c cocoa objective-c-category scripting-bridge
I am trying to write a category over iTunesTrack with associated objects (an NSMutableDictionary and an NSNumber)#import “iTunes.h” #import <objc/runtime.h>@interface iTunesTrack (dictionary) – (NSMutableDictionary*) getDictionary; – (NSNumber*) getScan; – (BOOL)scanTrack:(NSString *)equationString; @endThis fails:Undefined symbols for architecture x86_64:”_OBJC_CLASS_$_iTunesTrack”, referenced from:l_OBJC_$_CATEGORY_iTunesTrack_$_dictionary in iTunesTrack+dictionary.o ld: symbol(s) not fo
jmah
objective-c cocoa linker ld scripting-bridge
I was updating a Scripting Bridge glue file today (for Mail.app), and noticed that the sdp(1) man page reads:You do not need to create a corresponding implementation file; Scripting Bridge will create theclass implementations at runtime.That sounds cool, but without implementations for the generated classes I get (as expected):Undefined symbols for architecture x86_64:”_OBJC_CLASS_$_MailApplication”, referenced from:objc-class-ref in DMBugReportWindowController.o”_OBJC_CLASS_$_MailAttachment”, r
rounak
objective-c cocoa scripting-bridge
I’m a bit familiar with Scripting Bridge, and have used it for controlling the play/pause/back/next functions in iTunes. Through sdef and sdp I was able to create an iTunes.h file, with which I could declare an iTunesApplication object.When I tried to do the same thing for the inbuilt Reminders.app I got an error that saidsdp: error: class “list” inherits from undefined class “item”.sdp: error: class “reminder” inherits from undefined class “item”.Could any one help me in creating a Reminders.h
AmaltasCoder
cocoa osx applescript scripting-bridge
I have a document based drawing application that allows the user to save the final document as a JPEG file. Whenever the user saves a JPEG, I would like to import the picture to an iPhoto album “MyAppName album”. I am using Using Scripting Bridge and i have added the iPhoto.h file to my application. I have also added the ScriptingBridge.frameworkI am having some real trouble even creating the album “MyAppName album”. Can you please show me some code for the following pseudocode:if (check whether
Web site is in building