Dreaded -10801 error

Posted on
Tue Oct 03, 2017 6:18 pm
Different Computers offline
User avatar
Posts: 1832
Joined: Jan 02, 2016
Location: East Coast

Dreaded -10801 error

I'm suddenly getting this on my most commonly run iTunes script. http://www.thexlab.com/faqs/error-10810.html suggests, well, it suggests a LOT of stuff, none of which seems to apply.

Seriously, this script regularly runs 50+ times a day, and only today started erring every single time.

Code: Select all
-- configuration properties to set specific to your
-- own setup
property outputTempFN : "Library:Application Support:Perceptive Automation:Indigo 6:IndigoWebServer:images:iTunesCurrentAlbum.tiff"
property outputPNGFN : "Library:Application Support:Perceptive Automation:Indigo 6:IndigoWebServer:images:iTunesCurrentAlbum.png"
property noArtworkFN : "Library:Application Support:Perceptive Automation:Indigo 6:IndigoWebServer:images:iTunesNoArtworkAvailable.png"
property notPlayingFN : "Library:Application Support:Perceptive Automation:Indigo 6:IndigoWebServer:images:iTunesNotPlaying.png"
property targetSize : 256

-- main run routine
on run
   -- checks to ensure that itunes is running and available
   if my checkItunesIsActive() is false then
      -- uncomment below to show an error or add your own logging
      -- set opt to (display dialog "iTunes is not running." buttons {"OK"} default button 1 with title "Cannot proceed..." with icon 0 giving up after 30)
      my outputPlaceholderImage(notPlayingFN)
      return false
   end if
   
   -- ensure that itunes will respond, apparently some version will not if a modal dialog
   -- window is showing
   if my itunesIsNotAccesible() is true then
      -- uncomment below to show an error or add your own logging
      -- set opt to (display dialog "Close any utility windows that may be open in iTunes." buttons {"OK"} default button 1 with title "Cannot proceed..." with icon 0 giving up after 30)
      my outputPlaceholderImage(notPlayingFN)
      return false
   end if
   
   -- itunes should be available… attempt to process now
   tell application id "com.apple.iTunes"
      if (player state is playing) or (player state is paused) then
         copy (get rating of current track) to trackRating
         if (artworks of current track exists) then
            -- the current track has artwork available, attempt to output
            -- that to a PNG now
            set artwork_data to (get raw data of first artwork of current track)
            my outputAlbumArtwork(artwork_data)
            -- THIS IS MY EDIT FOR TRACK RATING <===============================
            --Original locations copy (get rating of current track) to trackRating
            -- tell application "IndigoServer"
            -- set value of variable "iTunesStars" to trackRating
            -- end tell
            -- THIS IS MY EDIT FOR TRACK RATING <===============================
         else
            -- export the "no artwork available" file to the output
            my outputPlaceholderImage(noArtworkFN)
         end if
      else
         -- export the "not playing" artwork file to the output
         my outputPlaceholderImage(notPlayingFN)
      end if
      -- -----------this is MY edit for telling Indigo  <==================================
      tell application "IndigoServer"
         set value of variable "iTunesStars" to trackRating / 20
      end tell
   end tell
end run

-- this routine checks to see if iTunes is running
to checkItunesIsActive()
   tell application "System Events" to return (exists (some process whose name is "iTunes"))
end checkItunesIsActive

-- this routine ensures that itunes is responding to applescript commands
to itunesIsNotAccesible()
   try
      with timeout of 1 second
         tell application id "com.apple.iTunes" to get name of library playlist 1
      end timeout
   on error
      return true
   end try
   return false
end itunesIsNotAccesible

-- this routine will output the artwork data provided to the artwork
-- file specified in the properties at top
to outputAlbumArtwork(artwork_data)
   set tempFileHandle to (open for access outputTempFN with write permission)
   try
      tell application "System Events"
         write artwork_data to tempFileHandle starting at 0
         set file type of (outputTempFN as alias) to ".tiff"
      end tell
      close access tempFileHandle
      
      tell application "Image Events"
         launch
         set tempImageRef to open outputTempFN
         scale tempImageRef to size targetSize
         save tempImageRef as PNG in outputPNGFN with icon
         close tempImageRef
      end tell
   on error err_msg
      close access tempFileHandle
      -- log error message if desired
      -- set opt to (display dialog "Error: " & err_msg buttons {"OK"} default button 1 with title "Cannot proceed..." with icon 0 giving up after 30)
   end try
end outputAlbumArtwork

-- this rouitne will output the given filename, assumed to already be a PNG,
-- to the output filename defined in the properties up top
to outputPlaceholderImage(filename)
   set outputFileHandle to (open for access (outputPNGFN as alias) with write permission)
   try
      write (read (filename as alias)) to outputFileHandle starting at 0
      close access outputFileHandle
   on error err_msg
      close access outputFileHandle
      -- log error message if desired
      -- set opt to (display dialog "Error: " & err_msg buttons {"OK"} default button 1 with title "Cannot proceed..." with icon 0 giving up after 30)
   end try
end outputPlaceholderImage


The error is said to be occurring somewhere in
Code: Select all
tell application "System Events" to return (exists (some process whose name is "iTunes"))


When I try to recompile the above, (which again, had been working for most of a year) I get "process" highlighted and a response of "Expected class name but found identifier."

SmartThings refugee, so happy to be on Indigo. 10.13.6 on an i5 MBP w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKit Bridge, MatplotLib, Plex, uniFAP, Wunderground, Nanoleaf, LED Simple Effects, Airfoil Pro, Grafana.

Posted on
Tue Oct 03, 2017 6:35 pm
Different Computers offline
User avatar
Posts: 1832
Joined: Jan 02, 2016
Location: East Coast

Re: Dreaded -10801 error

As an old HyperCard stack I used to have to support would say, it seems my Mac OS got into a funky state.

After a restart, the error is gone.

SmartThings refugee, so happy to be on Indigo. 10.13.6 on an i5 MBP w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKit Bridge, MatplotLib, Plex, uniFAP, Wunderground, Nanoleaf, LED Simple Effects, Airfoil Pro, Grafana.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests