Vorheriges Thema anzeigen :: Nächstes Thema anzeigen |
Autor |
Nachricht |
scriptingmouse13 •-->
Anmeldedatum: 04.11.2003 Beiträge: 125 Wohnort: .DS_Store
|
Verfasst am: 03.03.2006 - 16:49 Titel: Script-Releases |
|
|
Hi, Ich hab mir gedacht, da man imme ganz viele Fragen von mir bekommt aber nie die scripts zu sehen stell ich hier mal n paar von mir rein.
Das hier kann man ganz einfach auf ne taste belegen und sobald es ausgeführt wird, spielt es erst mal ab, wenns spielt dann kommt nächster usw.
tell application "iTunes"
if player state is paused then
play
else if player state is playing then
next track
else if player state is stopped then
play
end if
end tell
Das Folgende is für Leute die Probleme mit Handlern Haben ( beim Suchen und Ersetzen )
set omg to "äö"
set TTEXT to omg
set charList to {"ä", "ö"}
set cList to {"Dies ist ein", " Versuchs Text!"}
repeat with n from 1 to (count every item in charList)
set prevTID to AppleScript's text item delimiters
set AppleScript's text item delimiters to (item n of charList)
set TTEXT to text items of TTEXT
set AppleScript's text item delimiters to (item n of cList)
set TTEXT to TTEXT as text
set AppleScript's text item delimiters to prevTID
end repeat
return TTEXT
Für alle bei denen Code-Formatter nich wirklich funzt, ich hab das "set content to the clipboard" mit Keystroke v using command down ersetzt, was dann auch auf jedenfall bold usw. hervorruft :
property HexaChars : {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"}
set AppleScript's text item delimiters to ""
tell application "Tex-Edit Plus"
make new window
tell window 1
activate
delay 3
tell application "System Events" to keystroke "v" using command down
try
replace looking for "^*" looking for styles {style:bold} replacing with "^*"
replace looking for "^*" looking for styles {style:italic} replacing with "^*"
replace looking for "^*" looking for styles {style:underline} replacing with "^*"
replace looking for " " replacing with " "
replace looking for "<=" replacing with "<="
replace looking for ">=" replacing with ">="
set theStyles to style runs
repeat with i from 1 to count theStyles
set theColor to (color of style run i)
if the contents of style run i is not " " then
if theColor is not black then
set item i of theStyles to "[color=" & (my (myHexColor(theColor))) & "]" & ¬
(contents of item i of theStyles) & "[/color]"
end if
end if
end repeat
set beginning of theStyles to "[size=10]"
set end of theStyles to ""
set theStyles to theStyles as text
set the clipboard to theStyles
try
say "I'm ready"
on error
beep 3
end try
end try
close without saving
end tell
end tell
on myHexColor(rgb_value)
set hexValue to ""
repeat with i in rgb_value
set hexValue to (hexValue & (MakeHex(i)))
end repeat
set hexValue to "#" & hexValue
return hexValue
end myHexColor
on MakeHex(y)
set y to y div 256
try
set y to y as real
on error
FatalAlert("Sorry, only integers smaller than 65535 (hexa: 0 to FFFF) can be converted.")
return
end try
set theResult to {}
repeat
set theDigit to (y) mod 16
set beginning of theResult to (contents of item (1 + theDigit) of HexaChars)
set y to y div 16
if (y is 0) and ((count theResult) mod 2 = 0) then exit repeat
end repeat
set theResult to theResult as text
if (length of theResult > 8) then set theResult to (text 1 thru -9 of theResult) & " " & (text -8 thru -1 of theResult)
if (length of theResult > 4) then set theResult to (text 1 thru -5 of theResult) & " " & (text -4 thru -1 of theResult)
theResult
end MakeHex[/size]
Zuletzt bearbeitet von scriptingmouse13 am 03.03.2006 - 16:55, insgesamt einmal bearbeitet |
|
Nach oben |
|
|
scriptingmouse13 •-->
Anmeldedatum: 04.11.2003 Beiträge: 125 Wohnort: .DS_Store
|
Verfasst am: 03.03.2006 - 16:53 Titel: |
|
|
Das hier is um den Aktuellen User-Namen rauszubekommen.
set aktuell_user_name to do shell script "whoami"
display dialog aktuell_user_name
Und noch das geniale Sichtbar- Unsichtbar Skript von SNOW !! :
set macFilePath to choose file with prompt "Welche Datei unsichtbar machen ?" with invisibles
if (macFilePath as string) ends with ":" then -- it is a folder itself
set {od, AppleScript's text item delimiters} to {AppleScript's text item delimiters, ":"}
set parentFolder to (text items 1 thru -3 of (macFilePath as string)) as string
set AppleScript's text item delimiters to od
else -- it is just a file
set {od, AppleScript's text item delimiters} to {AppleScript's text item delimiters, ":"}
set parentFolder to (text items 1 thru -2 of (macFilePath as string)) as string
set AppleScript's text item delimiters to od
end if
set PosixParent to quoted form of POSIX path of parentFolder
set localPosixPath to quoted form of POSIX path of macFilePath
set FileName to do shell script "basename " & localPosixPath
tell application "Finder"
if name of macFilePath begins with "." then
set FileName to characters 2 thru (length of FileName) of FileName as string
do shell script "cd " & PosixParent & ";mv '." & FileName & "' " & quoted form of FileName
select macFilePath
else
do shell script "cd " & PosixParent & ";mv " & quoted form of FileName & " '." & FileName & "'"
select macFilePath
end if
end tell
Und zum krönenden Abschluss noch ein Zeilen-Ersetz Skript :
set Zeile to 27
set neuerText to ""
set text item delimiters to return
set Datei to choose file
set zeilenListe to paragraphs of (read Datei)
set item Zeile of zeilenListe to neuerText
write (zeilenListe as text) to Datei
|
|
Nach oben |
|
|
|
|
Du kannst keine Beiträge in dieses Forum schreiben. Du kannst auf Beiträge in diesem Forum nicht antworten. Du kannst deine Beiträge in diesem Forum nicht bearbeiten. Du kannst deine Beiträge in diesem Forum nicht löschen. Du kannst an Umfragen in diesem Forum nicht mitmachen.
|
Powered by phpBB © 2001, 2002 phpBB Group Deutsche Übersetzung von phpBB.de
|
|
|