Gå till innehåll
Just nu i M3-nätverket

Hjälp med osascript


weeeeeew

Rekommendera Poster

Detta script har jag fått och modifierat lite snabbt så att det ska passa mina behov. När jag kör det så får jag det förväntade resultatet, men samtidigt så får jag en väldig massa skräp som jag helst skulle slippa. (Se längre ner)

 

Eftersom jag bara ändrade lite snabbt i scriptet så kan det mycket väl ligga oanvänd kod och skräpa någonstans, men det är inget ni behöver haka upp er på om det inte ställer till det på något sätt.

 

#!/usr/bin/perl
use strict;
use warnings;
use Text::ParseWords;
#my $state = `osascript -e 'tell application "iTunes"' -e 'return player state' -e 'end tell'`;
my $type = `osascript -e 'tell application "iTunes"' -e 'set my_current_track to (a reference to current track)' -e 'return (get class of my_current_track) as string' -e 'end tell'`;

if($type eq "file track\n") {
my $trackinfo = `osascript -e 'tell application "iTunes"' -e 'set mct to (a reference to current track)' -e 'set mtname to (get name of mct) as string' -e 'set mtartist to (get artist of mct) as string' -e 'set mtia to {mtname, mtartist}' -e 'return mtia' -e 'end tell'`;
$trackinfo =~ s/^\{(.*)\}$/$1/;
my @array = &quotewords(', ', 0, $trackinfo);
my ($artist, $title) = @array;                

       $artist = "Unknown artist" if ($artist eq "" || $artist eq "missing value");
       $title  = "Unknown title"  if ($title eq "" || $title eq "missing value");

my $output = "np: $title - $artist";
#	print $output;
`echo "$output" > /Users/Jack/Music/nowplaying.aids`;
}

 

Detta får jag när jag kör scriptet:

jacks-macbook:~ Jack$ /Users/Jack/Music/aids.pl 
2008-08-16 02:39:23.185 osascript[878:613] *** _NSAutoreleaseNoPool(): Object 0xf34f60 of class NSPathStore2 autoreleased with no pool in place - just leaking
Stack: (0x932f6cdf 0x93204767 0x9320c4af 0x9320bfae 0x93210a5b 0xed78e6 0xed7b5b 0x2d959 0x2df45 0x96f98c74 0x96f8a648 0x96f937be 0x96f965ab 0x93f25caf 0x182417a 0x1827dfd 0x1827fc0 0x180fc3d 0x180ff07 0x180ffa5 0x1807a2d 0x376ded 0x2baf8 0x18236c4 0x18237e2 0x1823915 0x182311c 0x18238c9 0x376ded 0x3d1c3 0x20c9)
2008-08-16 02:39:23.189 osascript[878:613] *** _NSAutoreleaseNoPool(): Object 0xf363a0 of class NSPathStore2 autoreleased with no pool in place - just leaking
Stack: (0x932f6cdf 0x93204767 0x93203869 0x9320dfd2 0x93210c32 0xed78e6 0xed7b5b 0x2d959 0x2df45 0x96f98c74 0x96f8a648 0x96f937be 0x96f965ab 0x93f25caf 0x182417a 0x1827dfd 0x1827fc0 0x180fc3d 0x180ff07 0x180ffa5 0x1807a2d 0x376ded 0x2baf8 0x18236c4 0x18237e2 0x1823915 0x182311c 0x18238c9 0x376ded 0x3d1c3 0x20c9)
2008-08-16 02:39:23.190 osascript[878:613] *** _NSAutoreleaseNoPool(): Object 0xf37c70 of class NSPathStore2 autoreleased with no pool in place - just leaking
Stack: (0x932f6cdf 0x93204767 0x9320c4af 0x9320bfae 0x9320beb6 0x93211f58 0xed79fc 0xed7b5b 0x2d959 0x2df45 0x96f98c74 0x96f8a648 0x96f937be 0x96f965ab 0x93f25caf 0x182417a 0x1827dfd 0x1827fc0 0x180fc3d 0x180ff07 0x180ffa5 0x1807a2d 0x376ded 0x2baf8 0x18236c4 0x18237e2 0x1823915 0x182311c 0x18238c9 0x376ded 0x3d1c3 0x20c9)
2008-08-16 02:39:23.191 osascript[878:613] *** _NSAutoreleaseNoPool(): Object 0xf37020 of class NSBundle autoreleased with no pool in place - just leaking
Stack: (0x932f6cdf 0x93203562 0xed79fc 0xed7b5b 0x2d959 0x2df45 0x96f98c74 0x96f8a648 0x96f937be 0x96f965ab 0x93f25caf 0x182417a 0x1827dfd 0x1827fc0 0x180fc3d 0x180ff07 0x180ffa5 0x1807a2d 0x376ded 0x2baf8 0x18236c4 0x18237e2 0x1823915 0x182311c 0x18238c9 0x376ded 0x3d1c3 0x20c9)
2008-08-16 02:39:23.192 osascript[878:613] *** _NSAutoreleaseNoPool(): Object 0xf37770 of class NSCFArray autoreleased with no pool in place - just leaking
Stack: (0x932f6cdf 0x93203562 0x932358f1 0x932358ba 0xed7ad2 0xed7b5b 0x2d959 0x2df45 0x96f98c74 0x96f8a648 0x96f937be 0x96f965ab 0x93f25caf 0x182417a 0x1827dfd 0x1827fc0 0x180fc3d 0x180ff07 0x180ffa5 0x1807a2d 0x376ded 0x2baf8 0x18236c4 0x18237e2 0x1823915 0x182311c 0x18238c9 0x376ded 0x3d1c3 0x20c9)
2008-08-16 02:39:23.193 osascript[878:613] *** _NSAutoreleaseNoPool(): Object 0xf38650 of class NSPathStore2 autoreleased with no pool in place - just leaking
Stack: (0x932f6cdf 0x93204767 0x93203869 0x9320dfd2 0x9320de62 0x9323605a 0x932359bf 0x932358ba 0xed7ad2 0xed7b5b 0x2d959 0x2df45 0x96f98c74 0x96f8a648 0x96f937be 0x96f965ab 0x93f25caf 0x182417a 0x1827dfd 0x1827fc0 0x180fc3d 0x180ff07 0x180ffa5 0x1807a2d 0x376ded 0x2baf8 0x18236c4 0x18237e2 0x1823915 0x182311c 0x18238c9 0x376ded 0x3d1c3 0x20c9)
2008-08-16 02:39:23.195 osascript[878:613] LCC Scroll Enhancer loaded
2008-08-16 02:39:23.195 osascript[878:613] *** _NSAutoreleaseNoPool(): Object 0xf3a3a0 of class NSMachPort autoreleased with no pool in place - just leaking
Stack: (0x932f6cdf 0x93203562 0x93222f65 0x93249e4f 0xede702 0xede5bf 0xed7b2e 0xed7b5b 0x2d959 0x2df45 0x96f98c74 0x96f8a648 0x96f937be 0x96f965ab 0x93f25caf 0x182417a 0x1827dfd 0x1827fc0 0x180fc3d 0x180ff07 0x180ffa5 0x1807a2d 0x376ded 0x2baf8 0x18236c4 0x18237e2 0x1823915 0x182311c 0x18238c9 0x376ded 0x3d1c3 0x20c9)
2008-08-16 02:39:23.197 osascript[878:613] *** _NSAutoreleaseNoPool(): Object 0xf3b680 of class NSCFNumber autoreleased with no pool in place - just leaking
Stack: (0x932f6cdf 0x93203562 0xedf1b2 0xede766 0xede5bf 0xed7b2e 0xed7b5b 0x2d959 0x2df45 0x96f98c74 0x96f8a648 0x96f937be 0x96f965ab 0x93f25caf 0x182417a 0x1827dfd 0x1827fc0 0x180fc3d 0x180ff07 0x180ffa5 0x1807a2d 0x376ded 0x2baf8 0x18236c4 0x18237e2 0x1823915 0x182311c 0x18238c9 0x376ded 0x3d1c3 0x20c9)
2008-08-16 02:39:23.197 osascript[878:613] *** _NSAutoreleaseNoPool(): Object 0xf3bac0 of class NSCFString autoreleased with no pool in place - just leaking
Stack: (0x932f6cdf 0x93203562 0x9328402a 0xede766 0xede5bf 0xed7b2e 0xed7b5b 0x2d959 0x2df45 0x96f98c74 0x96f8a648 0x96f937be 0x96f965ab 0x93f25caf 0x182417a 0x1827dfd 0x1827fc0 0x180fc3d 0x180ff07 0x180ffa5 0x1807a2d 0x376ded 0x2baf8 0x18236c4 0x18237e2 0x1823915 0x182311c 0x18238c9 0x376ded 0x3d1c3 0x20c9)
2008-08-16 02:39:23.197 osascript[878:613] *** _NSAutoreleaseNoPool(): Object 0xf3bb00 of class NSPathStore2 autoreleased with no pool in place - just leaking
Stack: (0x932f6cdf 0x93204767 0x93212d75 0xede782 0xede5bf 0xed7b2e 0xed7b5b 0x2d959 0x2df45 0x96f98c74 0x96f8a648 0x96f937be 0x96f965ab 0x93f25caf 0x182417a 0x1827dfd 0x1827fc0 0x180fc3d 0x180ff07 0x180ffa5 0x1807a2d 0x376ded 0x2baf8 0x18236c4 0x18237e2 0x1823915 0x182311c 0x18238c9 0x376ded 0x3d1c3 0x20c9)
2008-08-16 02:39:23.199 osascript[878:613] *** _NSAutoreleaseNoPool(): Object 0xf3bc90 of class NSCFData autoreleased with no pool in place - just leaking
Stack: (0x932f6cdf 0x93203562 0x93217c35 0x932259fa 0x932258b8 0x932256d5 0xede79e 0xede5bf 0xed7b2e 0xed7b5b 0x2d959 0x2df45 0x96f98c74 0x96f8a648 0x96f937be 0x96f965ab 0x93f25caf 0x182417a 0x1827dfd 0x1827fc0 0x180fc3d 0x180ff07 0x180ffa5 0x1807a2d 0x376ded 0x2baf8 0x18236c4 0x18237e2 0x1823915 0x182311c 0x18238c9 0x376ded 0x3d1c3 0x20c9)
2008-08-16 02:39:23.437 osascript[879:613] *** _NSAutoreleaseNoPool(): Object 0xf35130 of class NSPathStore2 autoreleased with no pool in place - just leaking
Stack: (0x932f6cdf 0x93204767 0x9320c4af 0x9320bfae 0x93210a5b 0xed78e6 0xed7b5b 0x2d959 0x2df45 0x96f98c74 0x96f8a648 0x96f937be 0x96f965ab 0x93f25caf 0x182417a 0x1827dfd 0x1827fc0 0x180fc3d 0x180ff07 0x180ffa5 0x1807a2d 0x376ded 0x2baf8 0x18236c4 0x18237e2 0x1823915 0x182311c 0x18238c9 0x376ded 0x3d1c3 0x20c9)
2008-08-16 02:39:23.440 osascript[879:613] *** _NSAutoreleaseNoPool(): Object 0xf36570 of class NSPathStore2 autoreleased with no pool in place - just leaking
Stack: (0x932f6cdf 0x93204767 0x93203869 0x9320dfd2 0x93210c32 0xed78e6 0xed7b5b 0x2d959 0x2df45 0x96f98c74 0x96f8a648 0x96f937be 0x96f965ab 0x93f25caf 0x182417a 0x1827dfd 0x1827fc0 0x180fc3d 0x180ff07 0x180ffa5 0x1807a2d 0x376ded 0x2baf8 0x18236c4 0x18237e2 0x1823915 0x182311c 0x18238c9 0x376ded 0x3d1c3 0x20c9)
2008-08-16 02:39:23.441 osascript[879:613] *** _NSAutoreleaseNoPool(): Object 0xf37ad0 of class NSPathStore2 autoreleased with no pool in place - just leaking
Stack: (0x932f6cdf 0x93204767 0x9320c4af 0x9320bfae 0x9320beb6 0x93211f58 0xed79fc 0xed7b5b 0x2d959 0x2df45 0x96f98c74 0x96f8a648 0x96f937be 0x96f965ab 0x93f25caf 0x182417a 0x1827dfd 0x1827fc0 0x180fc3d 0x180ff07 0x180ffa5 0x1807a2d 0x376ded 0x2baf8 0x18236c4 0x18237e2 0x1823915 0x182311c 0x18238c9 0x376ded 0x3d1c3 0x20c9)
2008-08-16 02:39:23.441 osascript[879:613] *** _NSAutoreleaseNoPool(): Object 0xf37e90 of class NSBundle autoreleased with no pool in place - just leaking
Stack: (0x932f6cdf 0x93203562 0xed79fc 0xed7b5b 0x2d959 0x2df45 0x96f98c74 0x96f8a648 0x96f937be 0x96f965ab 0x93f25caf 0x182417a 0x1827dfd 0x1827fc0 0x180fc3d 0x180ff07 0x180ffa5 0x1807a2d 0x376ded 0x2baf8 0x18236c4 0x18237e2 0x1823915 0x182311c 0x18238c9 0x376ded 0x3d1c3 0x20c9)
2008-08-16 02:39:23.442 osascript[879:613] *** _NSAutoreleaseNoPool(): Object 0xf38170 of class NSCFArray autoreleased with no pool in place - just leaking
Stack: (0x932f6cdf 0x93203562 0x932358f1 0x932358ba 0xed7ad2 0xed7b5b 0x2d959 0x2df45 0x96f98c74 0x96f8a648 0x96f937be 0x96f965ab 0x93f25caf 0x182417a 0x1827dfd 0x1827fc0 0x180fc3d 0x180ff07 0x180ffa5 0x1807a2d 0x376ded 0x2baf8 0x18236c4 0x18237e2 0x1823915 0x182311c 0x18238c9 0x376ded 0x3d1c3 0x20c9)
2008-08-16 02:39:23.443 osascript[879:613] *** _NSAutoreleaseNoPool(): Object 0xf38890 of class NSPathStore2 autoreleased with no pool in place - just leaking
Stack: (0x932f6cdf 0x93204767 0x93203869 0x9320dfd2 0x9320de62 0x9323605a 0x932359bf 0x932358ba 0xed7ad2 0xed7b5b 0x2d959 0x2df45 0x96f98c74 0x96f8a648 0x96f937be 0x96f965ab 0x93f25caf 0x182417a 0x1827dfd 0x1827fc0 0x180fc3d 0x180ff07 0x180ffa5 0x1807a2d 0x376ded 0x2baf8 0x18236c4 0x18237e2 0x1823915 0x182311c 0x18238c9 0x376ded 0x3d1c3 0x20c9)
2008-08-16 02:39:23.445 osascript[879:613] LCC Scroll Enhancer loaded
2008-08-16 02:39:23.445 osascript[879:613] *** _NSAutoreleaseNoPool(): Object 0xf3a5f0 of class NSMachPort autoreleased with no pool in place - just leaking
Stack: (0x932f6cdf 0x93203562 0x93222f65 0x93249e4f 0xede702 0xede5bf 0xed7b2e 0xed7b5b 0x2d959 0x2df45 0x96f98c74 0x96f8a648 0x96f937be 0x96f965ab 0x93f25caf 0x182417a 0x1827dfd 0x1827fc0 0x180fc3d 0x180ff07 0x180ffa5 0x1807a2d 0x376ded 0x2baf8 0x18236c4 0x18237e2 0x1823915 0x182311c 0x18238c9 0x376ded 0x3d1c3 0x20c9)
2008-08-16 02:39:23.446 osascript[879:613] *** _NSAutoreleaseNoPool(): Object 0xf3b8d0 of class NSCFNumber autoreleased with no pool in place - just leaking
Stack: (0x932f6cdf 0x93203562 0xedf1b2 0xede766 0xede5bf 0xed7b2e 0xed7b5b 0x2d959 0x2df45 0x96f98c74 0x96f8a648 0x96f937be 0x96f965ab 0x93f25caf 0x182417a 0x1827dfd 0x1827fc0 0x180fc3d 0x180ff07 0x180ffa5 0x1807a2d 0x376ded 0x2baf8 0x18236c4 0x18237e2 0x1823915 0x182311c 0x18238c9 0x376ded 0x3d1c3 0x20c9)
2008-08-16 02:39:23.446 osascript[879:613] *** _NSAutoreleaseNoPool(): Object 0xf3bd10 of class NSCFString autoreleased with no pool in place - just leaking
Stack: (0x932f6cdf 0x93203562 0x9328402a 0xede766 0xede5bf 0xed7b2e 0xed7b5b 0x2d959 0x2df45 0x96f98c74 0x96f8a648 0x96f937be 0x96f965ab 0x93f25caf 0x182417a 0x1827dfd 0x1827fc0 0x180fc3d 0x180ff07 0x180ffa5 0x1807a2d 0x376ded 0x2baf8 0x18236c4 0x18237e2 0x1823915 0x182311c 0x18238c9 0x376ded 0x3d1c3 0x20c9)
2008-08-16 02:39:23.447 osascript[879:613] *** _NSAutoreleaseNoPool(): Object 0xf3bd50 of class NSPathStore2 autoreleased with no pool in place - just leaking
Stack: (0x932f6cdf 0x93204767 0x93212d75 0xede782 0xede5bf 0xed7b2e 0xed7b5b 0x2d959 0x2df45 0x96f98c74 0x96f8a648 0x96f937be 0x96f965ab 0x93f25caf 0x182417a 0x1827dfd 0x1827fc0 0x180fc3d 0x180ff07 0x180ffa5 0x1807a2d 0x376ded 0x2baf8 0x18236c4 0x18237e2 0x1823915 0x182311c 0x18238c9 0x376ded 0x3d1c3 0x20c9)
2008-08-16 02:39:23.447 osascript[879:613] *** _NSAutoreleaseNoPool(): Object 0xf3bee0 of class NSCFData autoreleased with no pool in place - just leaking
Stack: (0x932f6cdf 0x93203562 0x93217c35 0x932259fa 0x932258b8 0x932256d5 0xede79e 0xede5bf 0xed7b2e 0xed7b5b 0x2d959 0x2df45 0x96f98c74 0x96f8a648 0x96f937be 0x96f965ab 0x93f25caf 0x182417a 0x1827dfd 0x1827fc0 0x180fc3d 0x180ff07 0x180ffa5 0x1807a2d 0x376ded 0x2baf8 0x18236c4 0x18237e2 0x1823915 0x182311c 0x18238c9 0x376ded 0x3d1c3 0x20c9)

 

Som sagt så får jag det förväntade resultatet, men för att scriptet överhuvudtaget ska vara användbart så måste jag bli av med dessa felmeddelanden.

 

Jag testade att köra en del andra saker direkt från terminalen som involverade osascript och fick liknande meddelanden, så det är därför jag misstänker att det har med det hela att göra.

 

All hjälp är varmt välkommen. Säg även till om ni behöver veta något mer för att kunna hjälpa mig.

Länk till kommentar
Dela på andra webbplatser

Arkiverat

Det här ämnet är nu arkiverat och är stängt för ytterligare svar.



×
×
  • Skapa nytt...