Zugriffe auf das Dateisystem loggen
fs_usage beholfen. Ein deutlich komfortableren Weg kann man nun unter
fs_usage beholfen. Ein deutlich komfortableren Weg kann man nun unter
-- ©hubionmac.com 18.12.2008
-- GUI-Skript mit dem die aktuelle Air-Tunes ausgabe verändert wird,
-- die aktuelle Airtunes-Lautsprecher-Auswahl werden quasi
activate application "iTunes"
tell application "System Events"
get system attribute "sysv"
if result is greater than or equal to 4144 then -- Mac OS X 10.3.0
if UI elements enabled then
tell application process "iTunes"
if (name of button 15 of window "iTunes" as text) ≠ "" then
set noe to false
click button 15 of window "iTunes" --Den ITunes Lautsprecher Button drücken
delay 0.25
-- in der Liste ganz nach unten gehene (mehrere Lautsprecher auswählen Menüpunkt
repeat with i from 1 to 5
key code 125
end repeat
keystroke return
try
repeat with i from 1 to (count of every UI element of window 1)
tell UI element i of window 1
set rowcount to count of rows
if rowcount > 0 then
if (value of checkbox 1 of row rowcount) as integer = 0 then
--dieser part beugt einer Fehlermeldung vor...
--welcher? einfach mal diesen if-Block entfernen und Du wirst sehen =)
click checkbox 1 of row rowcount
set rowcount to rowcount - 1
end if
repeat with rownr from 1 to rowcount
click checkbox 1 of row rownr
end repeat
end if
end tell
end repeat
end try
keystroke "w" using command down
else
set noe to true
end if
end tell
else
beep
display dialog "GUI Scripting is not enabled" & return & return & "Open System Preferences and check Enable Access for Assistive Devices in the Universal Access preference pane, then run this script again." with icon stop
if button returned of result is "OK" then
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.universalaccess"
end tell
end if
end if
else
beep
display dialog "This computer cannot run this script" & return & return & "The script uses GUI Scripting technology, which requires an upgrade to Mac OS X 10.3 Panther or newer." with icon caution buttons {"Quit"} default button "Quit"
end if
end tell
if noe = true then
tell application "iTunes" to display dialog "nö, keine Airtunes Lautsprecher angeschlossen bzw. kein Button da, wo man so etwas auswählen könnt :-/"
end if
defaults write com.apple.frontrow FrontRowUsePreferredDisplayID <<displayID>>
Die Display ID bekommt man soweit ich es bisher weiss recht schnell durch Ausprobieren der Display IDs aus (~/Library/Preferences/com.apple.preference.displays....plist) heraus.
Bei sah es dann am Ende so aus:
defaults write com.apple.frontrow FrontRowUsePreferredDisplayID 69673024
(danach nur noch FronRow neustarten)
on open some_items
tell me to activate
display dialog "Längste Seite" default answer "1024"
set mh to (text returned of the result) as integer
repeat with this_item in some_items
try
rescale_and_save(this_item, mh)
end try
end repeat
end open
to rescale_and_save(this_item, target_width)
tell application "Image Events"
launch
-- open the image file
set this_image to open this_item
set typ to this_image's file type
copy dimensions of this_image to {current_width, current_height}
if current_width is greater than current_height then
scale this_image to size target_width
else
-- figure out new height
-- y2 = (y1 * x2) / x1
set the new_height to (current_height * target_width) / current_width
scale this_image to size new_height
end if
tell application "Finder" to set new_item to ¬
(container of this_item as string) & "scaled." & (name of this_item)
save this_image in new_item as typ
end tell
end rescale_and_save
Ein kleines Skript (quick&dirty) um die Ausgewählten iTunes Titel (Name, Interpret und Album) als Liste via Email zu verschicken:
set thelist to ""
tell application "iTunes"
set h to selection of browser window 1
set i to 1
repeat with s in h
set thelist to thelist & i & ". " & name of s & " -- " & artist of s & " -- " & album of s & return
set i to i + 1
end repeat
end tell
tell application "Mail"
--close every window
set newMessage to make new outgoing message with properties {content:thelist as text}
tell newMessage
set visible to true
end tell
end tell
...vor allen Dinge beim Abpausen
tell application "EyeTV"
set these_r to selection of programs window
end tell
set thepath to do shell script "echo $HOME" & "/Music/iTunes/iTunes Music/TV Shows/"
repeat with this_r in these_r
tell application "EyeTV"
try
set this_year to (last word of (episode of this_r as text)) as integer
set theepisode to episode of this_r
on error
set this_year to 0
end try
set is_busy to busy of this_r
set the_contents to description of this_r as text
set the_name to (title of this_r) as text
set the_info to episode of this_r
end tell
try
set theepisode to replace_chars(theepisode, ":", "_")
set theepisode to replace_chars(theepisode, "/", "_")
end try
set the_name_ to replace_chars(the_name, ":", "_")
if is_busy = false then
if this_year is not 0 then
set the clipboard to the_name & " (" & this_year & ")" & return & return & the_info & return & return & the_contents as text
try
do shell script "mv " & quoted form of (thepath & the_name_ & "/" & theepisode & ".m4v") & " " & quoted form of thepath & quoted form of ("(" & this_year & ") ") & quoted form of the_name_ & ".m4v"
do shell script "pbpaste | cat>" & quoted form of thepath & quoted form of ("(" & this_year & ") ") & quoted form of the_name_ & ".txt"
(** tell application "EyeTV"
delete this_r
end tell**)
on error msg
--display dialog the_name_ & " gibt es anscheinend nicht."
end try
else
set the clipboard to the_name & return & return & the_info & return & return & the_contents as text
try
do shell script "mv " & quoted form of (thepath & the_name_ & "/" & theepisode & ".m4v") & " " & quoted form of thepath & quoted form of ("(" & this_year & ") ") & quoted form of the_name_ & ".m4v"
do shell script "pbpaste | cat>" & quoted form of thepath & quoted form of the_name_ & ".txt"
(** tell application "EyeTV"
delete this_r
end tell
**)
on error
--display dialog the_name_ & " gibt es anscheinend nicht."
end try
end if
end if
end repeat
on replace_chars(this_text, search_string, replacement_string)
if this_text contains the search_string then
set AppleScript's text item delimiters to the search_string
set the item_list to every text item of this_text
set AppleScript's text item delimiters to the replacement_string
set this_text to the item_list as string
set AppleScript's text item delimiters to ""
end if
return this_text
end replace_chars
Die ist ein Beispiel, wie man die Original-EyTV-Aufnahme kopieren könnte...
tell application "EyeTV"
set these_r to selection of programs window
repeat with this_r in these_r
set this_location to location of this_r as text
set AppleScript's text item delimiters to ":"
set this_location to text items 1 through -2 of this_location as text
set AppleScript's