| 
	
		| 
 
	
		| Vorheriges Thema anzeigen :: Nächstes Thema anzeigen |  
		| Autor | Nachricht |  
		| scriptingmouse13 •-->
 
  
  
 Anmeldedatum: 04.11.2003
 Beiträge: 125
 Wohnort: .DS_Store
 
 | 
			
				|  Verfasst am: 06.01.2006 - 15:24    Titel: Question @ Spirigwi & Snow |   |  
				| 
 |  
				| Also Ich hab ja von euch beiden das SuchT ErsatzT skript... so da dieses jetzt mit nem on handler versehen sind... krieg ich schwierigkeiten mit xCode und ich kann mit auch kein on Idle skript machen  Jetzt wollt ich fragen ob man das nich einfach normal ins skript einfügen könnte... also anstadt 
  	  | Code: |  	  | set ZuErsetzenText to the_Variable
 set ErsetzterText to my SuchErsAusWerteListeWL1()
 set the_Variable to ZuErsetzenText
 
 | 
 
 Das ganz ausschreiben sprich die On Handler verschwinden lassen. Ich hoff ihr wisst was ich mein
 |  |  
		| Nach oben |  |  
		|  |  
		| spirigwi •----->
 
  
  
 Anmeldedatum: 10.07.2003
 Beiträge: 1517
 Wohnort: Olten-CH
 
 | 
			
				|  Verfasst am: 06.01.2006 - 23:45    Titel: |   |  
				| 
 |  
				| Damit Snow das Schlusswort bleibt stürze ich mich nun über Klippe: 
 Hallo Mouse der Scripter! tapfer, wie du dich durchschlägst mit den handlern. Wenns ohne gehen soll:
 
 hast du im posting von Snow :
 http://www.fischer-bayern.de/phpBB2/viewtopic.php?t=690
 schon die Handler-lose Variante von Armin Egginger gelesen?
 mit diesem Konzept könnte dir (durch umgehen der Handler) das Bauen etwas leichter fallen.
 
 Aber, nicht vergessen:
 die handler machen nicht etwas falsches und es enteht auch keine Einschränkung der Funktionsbreite damit, sondern der Umgang  ist lediglich etwas kniffliger.
 Handler können  übrigens auch  mehrere verwertbare Zwischenresultate liefern .(Global-Technik)
 Andererseits lässt sich mit etwas Handler-Training(igs zu Hanteln-Training=Muskeltraining, das fürs AppleSkripten ungeeignet ist! es gibt ja auch hier so einen ! einzigen Muskelprotzer) wesentlich leichter "Brockenweise" vorgehen (= Test-Abschnitte bauen), vor allem wenn es um grosse Ersatz-Texte geht, bei denen man ZB solcherart " Zeichen" noch in die Variable füttern muss, dann braucht man andere Programme dazu, welche einem Gesamt-Texte mit solchem Inhalt als einen einzigen Variablen-Inhalt liefern, u.a zur Mehrfachverwertung für das AppleSkript.
 
 Der Handler-Aufbau dienst auch als Ersatz von "Eingabemasken", mit denen man immerwieder v.a mehrmals  denselben Ersetzen-Process losstarten kann, aus beliebiger Stelle des laufenden Skriptes heraus, ohne dass man jedesmal die ganzen mono-funktionalen Zeilen erneut tippen muss.
 
 Tipp:
 Bei der Skript Korrektur dienen einem obtische Marker für die  Stellen der
 on handlerER() --ZB so oooooooooooooooooooooooooooooooo
 --...
 end handlerER
 
 --oder den Startpunkt im Skript sichtbaer machen:
 my handlerER() --ZB so oooooooooooooooooooooooooooooooo
 
 mit einem Handler kann man auch "Probeläufe" in einem 2. Skriptfenster machen, was ich als den grössten Vorteil betrachte: Damit kann man Funktionsabschnitte des zu bauenden Skriptes Brockenweise auf seine Fehlern untersuchen.
 
 Kurz: Armin Egginger nicht vergessen, der zeigt seine Modelle MIT und OHNE HANDLER.
 
 (Hey, ScriptingMouse, eine Frage noch: Warum wohl dieser gescheite Kopf von Armin Egginger denn überhaupt eine on handler()-Version anbietet, wenns ja auch ohne geht?, irgend ein Grund wird wohl dahinter stecken¿
 
 PS:
 ganz ohne handler kommen die SHELL-SKRIPTER aus (ZB hweber) aber zu der Zunft gehöre ich nur gegen Vorhalten einer Pistole und die heisst FileMaker-Server, wohl kaum dein Problem
   (nur noch so nebenbei: im FileMaker client drin bist du ohne handler meist ein Tiefseetaucher mit Schnorchel: aus! fertig! amen !)
 _________________
  Skript-Fan => ein  �  -Fan =>Scr¿¿-KongFuSius_Kurpfusius
 
 Zuletzt bearbeitet von spirigwi am 07.01.2006 - 23:00, insgesamt einmal bearbeitet
 |  |  
		| Nach oben |  |  
		|  |  
		| scriptingmouse13 •-->
 
  
  
 Anmeldedatum: 04.11.2003
 Beiträge: 125
 Wohnort: .DS_Store
 
 | 
			
				|  Verfasst am: 07.01.2006 - 21:04    Titel: |   |  
				| 
 |  
				| Ok ... Ich sag dann erstmal danke  Das Beispiel von Armin Egginger hat mit seeeehhhr geholfen  Hab einfach ein Paar Variablen Geändert und Anstadt den ASCII einfach normale "Characters" genommen  ... Das Ganze sieht dann so aus : 
 
  	  | Code: |  	  | 
 set omg to "ABCDEGHIJKLLMNOPQRSTUVWXYZ*+'#-.,_<>!\"§$%&/()=?ß|~"
 set TTEXT to omg
 set charList to {"ä", "ö", "ü", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "[AE]", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "Ö", "Ü", "ß", "!", "~", "+", "#", "'", "*", "<", ">", "=", ")", "(", "/", "|", "&", "%", "$", "~", "_", "\"", ".", ",", "?"}
 set cList to {"^1[^9a^7e^1]^7", "^1[^9o^7e^1]^7", "^1[^9u^7e^1]^7", "^9A^7", "^9B^7", "^9C^7", "^9D^7", "^9E^7", "^9F^7", "^9G^7", "^9H^7", "^9I^7", "^9J^7", "^9K^7", "^9L^7", "^9M^7", "^9N^7", "^9O^7", "^9P^7", "^9Q^7", "^9R^7", "^9S^7", "^9T^7", "^9U^7", "^9V^7", "^9W^7", "^9X^7", "^9Y^7", "^9Z^7", "^1[^9A^7E^1]^7", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "^1[^9O^7E^1]^7", "^1[^9U^7E^1]^7", "^1[^9S^1]^7", "^1!^7", "^1~^7", "^1+^7", "^1#^7", "^1'^7", "^1*^7", "^1<^7", "^1>^7", "^1=^7", "^1)^7", "^1(^7", "^1/^7", "^1|^7", "^1&^7", "^1%^7", "^1$^7", "^1~^7", "^1_^7", "^1\"^7", "^1.^7", "^1,^7", "^1?^7"}
 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
 | 
 
 also danke Spirigwi
  ich glaub von jetzt an komm ich allein zurecht *g* ... aber besser du guckst in 1 - 2 Tagen nochmal... falls ich nich doch noch ne frage hab  Thx ! |  |  
		| Nach oben |  |  
		|  |  
		| Snow Administrator
 
  
  
 Anmeldedatum: 21.11.2000
 Beiträge: 1946
 Wohnort: Deiningen
 
 | 
			
				|  Verfasst am: 07.01.2006 - 21:18    Titel: |   |  
				| 
 |  
				| Was gibt's den für Schwierigkeiten mit Handlern in XCode? Da ist doch sowieso schon jede Kleinigkeit in Handler verpackt - on clicked, on launched, on ... 
 Eigene Handler zu verwenden ist absolut problemlos.
 Eine Kleinigkeit fällt mir ein: Beim Aufruf eines eigenen Handlers ist es zuverlässiger, die folgende Form zu verwenden:
 
 HandlerName() of me
 
 anstatt
 
 my HandlerName()
 
 Ansonsten sind mir keine Probleme damit bekannt.
 _________________
 Peter
 -
 Fischer-Bayern.de|Shadetreemicro.com
 |  |  
		| Nach oben |  |  
		|  |  
		| scriptingmouse13 •-->
 
  
  
 Anmeldedatum: 04.11.2003
 Beiträge: 125
 Wohnort: .DS_Store
 
 | 
			
				|  Verfasst am: 07.01.2006 - 21:34    Titel: |   |  
				| 
 |  
				| Bei mir is das problem... ich hab n großen on clicked handler und dann is halt dieser teil mit drin verpackt : 
 set ZuErsetzenText to the_song
 set ErsetztertText to my ErsatzPaarWL()
 set the_song to ZuErsetztenText
 
 und ganz unten im skript sind halt dann diese 3 On Handler von Spirigwi ( mit SuchT und ErsetzT und dann zeigt er mir entweder an, dass es irgend ne variable net gibt... oder er machts einfach nich und lässt den text unverändert... aber jetz is es egal, da ich ja das ohne on handler hab
  |  |  
		| Nach oben |  |  
		|  |  
		| spirigwi •----->
 
  
  
 Anmeldedatum: 10.07.2003
 Beiträge: 1517
 Wohnort: Olten-CH
 
 | 
			
				|  Verfasst am: 07.01.2006 - 22:45    Titel: |   |  
				| 
 |  
				| Hallo Snow, bist du denn kein bisschen stolz auf deinen Schüler ScriptingMouse, der hat sich ja zum Skripter-Elefanten durchgeschlagen, in so kurzer Zeit solches in Listen zu packen "^1[^9a^7e^1]^7"..caracho! da staune ich halt nur so
 
 
 wann versagt der andere? 	  | Snow hat Folgendes geschrieben: |  	  | zuverlässiger.. HandlerName() of me
 | 
 
 my handlerNAME()
 
 darf ich verraten warum ich den vorziehe(
  ) •  1) er hat eine Wort weniger zum tippen (dh bei mir wimmelt es nur so von handlern, dann summiert sich das ..)
 •  2) hat man schon mal mit ach und Krach ein Probekript-Ablauf in einen handler verpackt, so:
 on handlerNAME()
 --
 end handlerNAME
 
 genügt ein Kleiner Copy-Kniff für die Handler-Aufrufe Zeile:
 aus:
 on handlerNAME()
 
 wird durch Doppelklick auf on + tippe my zu :
 my handlerNAME()
 
  muss ich das verlassen? 
 @Scriptingmouse:
 Tipp:
 gib Snow noch eine Antwort auf
  	  | Snow hat Folgendes geschrieben: |  	  | Was gibt's den für Schwierigkeiten mit Handlern in XCode? | 
 Solche Angebote sollte man sich nicht entgehen lassen, du lernst dabei fürs ganze Leben! dein Musik-Autoren-gag ist super! aber hinsichtlich AppleSkript ist er eine äusserst kurzlebige Angelegenheit. Also wuchte dein Fehlerskript hinein!
       nicht kneiffen
  _________________
  Skript-Fan => ein  �  -Fan =>Scr¿¿-KongFuSius_Kurpfusius
 |  |  
		| Nach oben |  |  
		|  |  
		| scriptingmouse13 •-->
 
  
  
 Anmeldedatum: 04.11.2003
 Beiträge: 125
 Wohnort: .DS_Store
 
 | 
			
				|  Verfasst am: 08.01.2006 - 01:43    Titel: |   |  
				| 
 |  
				| Ok .... Dann wuchte ich mal das FehlerSkript rein   ABER ES IS LAAAAANG
  und ohne Code Formatter *g* 
 [code]
 -- iTunes.applescript
 -- CT-iT-rCoN
 
 --  Created by Christoph Eiswirth on Wed Nov 16 2005.
 --  Copyright (c) 2003 __Christoph Eiswirth__. All rights reserved.
 
 on clicked theObject
 -- BGcolor
 set BGColor to contents of text field "BGColor" of window "Main" of tab view item "Preferences"
 --NColor
 set NColor1 to contents of text field "NColor1" of window "Main" of tab view item "Preferences"
 set NColor2 to contents of text field "NColor2" of window "Main" of tab view item "Preferences"
 set NColor3 to contents of text field "NColor3" of window "Main" of tab view item "Preferences"
 set NColor4 to contents of text field "NColor4" of window "Main" of tab view item "Preferences"
 set NColor5 to contents of text field "NColor5" of window "Main" of tab view item "Preferences"
 --NF
 set NF1 to contents of text field "NF1" of window "Main" of tab view item "Preferences"
 set NF2 to contents of text field "NF2" of window "Main" of tab view item "Preferences"
 set NF3 to contents of text field "NF3" of window "Main" of tab view item "Preferences"
 set NF4 to contents of text field "NF4" of window "Main" of tab view item "Preferences"
 
 set tnoto to the name of theObject
 set iTunesAblage to contents of text field "iTunesAblage" of window "Main" of tab view item "iTunes"
 if tnoto is "iTunes" then
 global the_artist, the_song, ErsetzterText, ZuErsetzenText, SuchErsetzPaarWLblabla
 set nix to "                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                " -- To Replace all the lines
 
 -------------
 --_ArtistNames_--
 -------------
 tell application "iTunes"
 set the_artist to artist of current track
 set the_song to name of current track
 end tell
 set GreenDay to "^2Green Day"
 set Evanescence to "^1E^0vane^1S^0cence"
 set Hoobastank to "^7H^4oobastank"
 -------------
 --_ArtistNames_--
 -------------
 if iTunesAblage is "Normal" then
 tell application "iTunes" to set the_artist to artist of current track
 
 else if iTunesAblage is "Color" then
 if the_artist is "Evanescence" then -- Evanescence
 set the_artist to Evanescence
 else if the_artist is "Hoobastank" then -- Hoobastank
 set the_artist to Hoobastank
 else if the_artist is "Green Day" then
 set the_artist to GreenDay
 else
 set ZuErsetzenText to the_artist
 set ErsetzterText to my SuchErsAusWerteListeWL1()
 set the_artist to ZuErsetzenText
 
 end if
 end if
 if iTunesAblage is "Normal" then
 tell application "iTunes" to set the_song to name of current track
 else if iTunesAblage is "Color" then
 if the_song is "Going Under" then -- Going Under
 set the_song to "^1G^0oing ^1U^0nder"
 
 else if the_song is "Bring Me To Life" then -- Bring me To Life
 set the_song to "^1B^0ring ^1M^0e ^1T^0o ^1L^0ife"
 
 else if the_song is "My Immortal" then -- My Immortal
 set the_song to "^1M^0y ^1I^0mmortal"
 
 else if the_song is "My Immortal(Band Version)" then -- My Immortal BV
 set the_song to "^1M^0y ^1I^0mmortal"
 
 else if the_song is "Haunted" then -- Haunted
 set the_song to "^1H^0aunted"
 
 else if the_song is "Field of Innocence" then -- Field of Innocence
 set the_song to "^1F^0ield ^1O^0f ^1I^0nnocence"
 
 else if the_song is "Surrender" then
 set the_song to "^1S^0urrender"
 
 else if the_song is "Everybody's Fool" then
 set the_song to "^1E^0verybody^1'^0s ^1F^0ool"
 
 else if the_song is "Tourniquet" then
 set the_song to "^1T^0ourniquet"
 
 else if the_song is "Imaginary" then
 set the_song to "^1I^0maginary"
 
 else if the_song is "Taking Over Me" then
 set the_song to "^1T^0akingOverMe"
 
 else if the_song is "Hello" then
 set the_song to "^1H^0ello"
 
 else if the_song is "My Last Breath" then
 set the_song to "^1M^0y ^1L^0ast ^1B^0reath"
 
 else if the_song is "Whisper" then
 set the_song to "^1W^0hisper"
 
 ----_Hoobastank_-----
 
 else if the_song is "Out of Control" then
 set the_song to "^7O^4ut ^7o^4f ^7C^4ontrol"
 
 else if the_song is "Unaffected" then
 set the_song to "^7U^4naffected"
 
 else if the_song is "Just One" then
 set the_song to "^7J^4ust ^7O^4ne"
 
 else if the_song is "Running Away" then
 set the_song to "^7R^4unning ^7A^4way"
 
 else if the_song is "What Happened To Us?" then
 set the_song to "^7W^4hat ^7H^4appened ^7T^4o ^7U^4s ^3?"
 
 else if the_song is "Too Little Too Late" then
 set the_song to "^7T^4oo ^7L^4ittle ^7T^4oo ^7L^4ate"
 
 else if the_song is "" then
 set the_song to ""
 
 else if the_song is "" then
 set the_song to ""
 
 else if the_song is "" then
 set the_song to ""
 
 else if the_song is "" then
 set the_song to ""
 
 else if the_song is "" then
 set the_song to ""
 
 else if the_song is "" then
 set the_song to ""
 
 else if the_song is "" then
 set the_song to ""
 
 else if the_song is "" then
 set the_song to ""
 
 else if the_song is "" then
 set the_song to ""
 
 else if the_song is "" then
 set the_song to ""
 
 else if the_song is "" then
 set the_song to ""
 
 else if the_song is "" then
 set the_song to ""
 
 else if the_song is "" then
 set the_song to ""
 
 else if the_song is "" then
 set the_song to ""
 
 else if the_song is "" then
 set the_song to ""
 
 else if the_song is "" then
 set the_song to ""
 
 else if the_song is "" then
 set the_song to ""
 
 else if the_song is "" then
 set the_song to ""
 
 else if the_song is "" then
 set the_song to ""
 else
 set ZuErsetzenText to the_song
 set ErsetzterText to my SuchErsAusWerteListeWL1()
 set the_song to ZuErsetzenText
 end if
 end if
 
 ----------------------------------------------------------------------------------
 if iTunesAblage is "Color" then
 tell application "iTunes"
 if player state is playing then
 set end1 to BGColor & the_song & " ^3-" & BGColor & " " & the_artist & " ^1=>" & NColor3 & NF3 & BGColor & "Tun" & NColor2 & NF2 & BGColor & "s" -- Normal
 tell application "Call of Duty MP" to activate
 tell application "System Events"
 keystroke ">"
 keystroke end1
 keystroke "<"
 end tell
 else if player state is paused then -- Paused
 
 set end3 to NColor3 & NF3 & BGColor & "Tun" & NColor2 & NF2 & BGColor & "s" & NColor3 & NF3 & BGColor & "s N" & NColor4 & NF4 & BGColor & "t Pl" & NColor1 & NF1 & BGColor & "y" & NColor3 & NF3 & BGColor & "ng"
 tell application "Call of Duty MP" to activate
 tell application "System Events"
 keystroke ">"
 keystroke end3
 keystroke "<"
 end tell
 
 else if player state is stopped then --Stopped
 
 set end3 to NColor3 & NF3 & BGColor & "Tun" & NColor2 & NF2 & BGColor & "s" & NColor3 & NF3 & BGColor & "s N" & NColor4 & NF4 & BGColor & "t Pl" & NColor1 & NF1 & BGColor & "y" & NColor3 & NF3 & BGColor & "ng"
 tell application "Call of Duty MP" to activate
 tell application "System Events"
 keystroke ">"
 keystroke end3
 keystroke "<"
 end tell
 end if
 end tell
 
 else if iTunesAblage is "Normal" then
 tell application "iTunes"
 if player state is playing then
 set end1 to "^7" & the_song & " - " & the_artist & " =>" & " iTunes" -- Normal
 tell application "Call of Duty MP" to activate
 tell application "System Events"
 keystroke ">"
 keystroke end1
 keystroke "<"
 end tell
 else if player state is paused then -- Paused
 
 set end3 to "iTunes is Not Playing"
 tell application "Call of Duty MP" to activate
 tell application "System Events"
 keystroke ">"
 keystroke end3
 keystroke "<"
 end tell
 
 else if player state is stopped then --Stopped
 
 set end3 to "iTunes is Not Playing"
 tell application "Call of Duty MP" to activate
 tell application "System Events"
 keystroke ">"
 keystroke end3
 keystroke "<"
 end tell
 end if
 end tell
 end if
 
 else if tnoto is "iTunesColored" then
 set contents of text field "iTunesAblage" of window "Main" of tab view item "iTunes" to "Normal"
 else if tnoto is "iTunesNormal" then
 set contents of text field "iTunesAblage" of window "Main" of tab view item "iTunes" to "Color"
 
 
 end if
 
 end clicked
 
 
 ----------------
 
 on SuchErsAusWerteListeWL1()
 global ErsetzterText, ZuErsetzenText, SuchErsetzPaarWLblabla
 -- BGcolor
 set BGColor to contents of text field "BGColor" of window "Main" of tab view item "Preferences"
 --NColor
 set NColor1 to contents of text field "NColor1" of window "Main" of tab view item "Preferences"
 set NColor2 to contents of text field "NColor2" of window "Main" of tab view item "Preferences"
 set NColor3 to contents of text field "NColor3" of window "Main" of tab view item "Preferences"
 set NColor4 to contents of text field "NColor4" of window "Main" of tab view item "Preferences"
 set NColor5 to contents of text field "NColor5" of window "Main" of tab view item "Preferences"
 --NF
 set NF1 to contents of text field "NF1" of window "Main" of tab view item "Preferences"
 set NF2 to contents of text field "NF2" of window "Main" of tab view item "Preferences"
 set NF3 to contents of text field "NF3" of window "Main" of tab view item "Preferences"
 set NF4 to contents of text field "NF4" of window "Main" of tab view item "Preferences"
 --Anfang Skript ( Such und Ersatz )
 set SuchErsetzPaarWLblabla to {¬
 {SuchT:"e", ErsatzT:"" & NColor2 & NF2 & BGColor}, ¬
 {SuchT:"a", ErsatzT:"" & NColor1 & NF1 & BGColor}, ¬
 {SuchT:"i", ErsatzT:"" & NColor3 & NF3 & BGColor}, ¬
 {SuchT:"o", ErsatzT:"" & NColor4 & NF4 & BGColor}, ¬
 {SuchT:"I", ErsatzT:"" & NColor4 & NF4 & BGColor}, ¬
 {SuchT:"A", ErsatzT:"" & NColor1 & NF1 & BGColor}, ¬
 {SuchT:"E", ErsatzT:"" & NColor2 & NF2 & BGColor}, ¬
 {SuchT:"O", ErsatzT:"" & NColor4 & NF4 & BGColor}, ¬
 {SuchT:"-", ErsatzT:"" & NColor5 & "-" & BGColor}, ¬
 {SuchT:"+", ErsatzT:"" & NColor5 & "+" & BGColor}, ¬
 {SuchT:"<", ErsatzT:"" & NColor5 & "<" & BGColor}, ¬
 {SuchT:">", ErsatzT:"" & NColor5 & ">" & BGColor}, ¬
 {SuchT:"=", ErsatzT:"" & NColor5 & "=" & BGColor}, ¬
 {SuchT:")", ErsatzT:"" & NColor5 & ")" & BGColor}, ¬
 {SuchT:"(", ErsatzT:"" & NColor5 & "(" & BGColor}, ¬
 {SuchT:"/", ErsatzT:"" & NColor5 & "/" & BGColor}, ¬
 {SuchT:"#", ErsatzT:"" & NColor5 & "#" & BGColor}, ¬
 {SuchT:"|", ErsatzT:"" & NColor5 & "|" & BGColor}, ¬
 {SuchT:"&", ErsatzT:"" & NColor5 & "&" & BGColor}, ¬
 {SuchT:"%", ErsatzT:"" & NColor5 & "%" & BGColor}, ¬
 {SuchT:"$", ErsatzT:"" & NColor5 & "$" & BGColor}, ¬
 {SuchT:"~", ErsatzT:"" & NColor5 & "~" & BGColor}, ¬
 {SuchT:"*", ErsatzT:"" & NColor5 & "*" & BGColor}, ¬
 {SuchT:"_", ErsatzT:"" & NColor5 & "_" & BGColor}, ¬
 {SuchT:"!", ErsatzT:"" & NColor5 & "!" & BGColor} ¬
 }
 
 my SuchErsetzPaarRepeater()
 end SuchErsAusWerteListeWL1
 
 on SuchErsetzPaarRepeater()
 set LangSuchErsetzPaarWL to count SuchErsetzPaarWLblabla
 repeat with ItZa from 1 to LangSuchErsetzPaarWL
 set AktSuchErsPaarWLZeile to item ItZa of SuchErsetzPaarWLblabla
 set SuchT to SuchT of AktSuchErsPaarWLZeile
 set ErsatzT to ErsatzT of AktSuchErsPaarWLZeile
 set ZuErsetzenText to ¬
 TexErsetzer(ZuErsetzenText, SuchT, ErsatzT)
 end repeat
 end SuchErsetzPaarRepeater
 
 on TexErsetzer(ZuErsetzenText, SuchT, ErsatzT)
 tell (a reference to AppleScript's text item delimiters)
 set {od, contents} to {contents, {SuchT}}
 try
 set {ZuErsetzenTextList, contents} to {(text items of ZuErsetzenText), {ErsatzT}}
 set {ZuErsetzenText2, contents} to {(ZuErsetzenTextList as text), od}
 return item 1 of result
 on error errMeld number errZA
 set contents to od
 error errMeld number errZA
 end try
 end tell
 end TexErsetzer
 [code]
 
 Als Fehler Unterstreicht mir XCode die Zeile :
 set SuchErsetzPaarWLblabla to {¬
 und meint " Expected expression, etc. but found unkown token. ( -2741 )
 [/code]
 |  |  
		| Nach oben |  |  
		|  |  
		| Snow Administrator
 
  
  
 Anmeldedatum: 21.11.2000
 Beiträge: 1946
 Wohnort: Deiningen
 
 | 
			
				|  Verfasst am: 08.01.2006 - 10:07    Titel: |   |  
				| 
 |  
				| Die einzelnen Anführungszeichen jeweils am Ende einer Zeile stören und halten XCode davon ab, das skript zu kompilieren. 
 Ohne diese Anführungszeichen geht's:
 
 set SuchErsetzPaarWLblabla to {¬
 {SuchT:"e", ErsatzT:"" & NColor2 & NF2 & BGColor}, ¬
 {SuchT:"a", ErsatzT:"" & NColor1 & NF1 & BGColor}, ¬
 {SuchT:"i", ErsatzT:"" & NColor3 & NF3 & BGColor}, ¬
 {SuchT:"o", ErsatzT:"" & NColor4 & NF4 & BGColor}, ¬
 {SuchT:"I", ErsatzT:"" & NColor4 & NF4 & BGColor}, ¬
 {SuchT:"A", ErsatzT:"" & NColor1 & NF1 & BGColor}, ¬
 {SuchT:"E", ErsatzT:"" & NColor2 & NF2 & BGColor}, ¬
 {SuchT:"O", ErsatzT:"" & NColor4 & NF4 & BGColor}, ¬
 {SuchT:"-", ErsatzT:"" & NColor5 & "-" & BGColor}, ¬
 {SuchT:"+", ErsatzT:"" & NColor5 & "+" & BGColor}, ¬
 {SuchT:"<", ErsatzT:"" & NColor5 & "<" & BGColor}, ¬
 {SuchT:">", ErsatzT:"" & NColor5 & ">" & BGColor}, ¬
 {SuchT:"=", ErsatzT:"" & NColor5 & "=" & BGColor}, ¬
 {SuchT:")", ErsatzT:"" & NColor5 & ")" & BGColor}, ¬
 {SuchT:"(", ErsatzT:"" & NColor5 & "(" & BGColor}, ¬
 {SuchT:"/", ErsatzT:"" & NColor5 & "/" & BGColor}, ¬
 {SuchT:"#", ErsatzT:"" & NColor5 & "#" & BGColor}, ¬
 {SuchT:"|", ErsatzT:"" & NColor5 & "|" & BGColor}, ¬
 {SuchT:"&", ErsatzT:"" & NColor5 & "&" & BGColor}, ¬
 {SuchT:"%", ErsatzT:"" & NColor5 & "%" & BGColor}, ¬
 {SuchT:"$", ErsatzT:"" & NColor5 & "$" & BGColor}, ¬
 {SuchT:"~", ErsatzT:"" & NColor5 & "~" & BGColor}, ¬
 {SuchT:"*", ErsatzT:"" & NColor5 & "*" & BGColor}, ¬
 {SuchT:"_", ErsatzT:"" & NColor5 & "_" & BGColor}, ¬
 {SuchT:"!", ErsatzT:"" & NColor5 & "!" & BGColor} ¬
 }
 _________________
 Peter
 -
 Fischer-Bayern.de|Shadetreemicro.com
 |  |  
		| Nach oben |  |  
		|  |  
		| spirigwi •----->
 
  
  
 Anmeldedatum: 10.07.2003
 Beiträge: 1517
 Wohnort: Olten-CH
 
 | 
			
				|  Verfasst am: 08.01.2006 - 11:43    Titel: |   |  
				| 
 |  
				| Na, Script- Maus der Mouse, hab ich mit dem Snow-Tipp etwa zu viel versprochen? da staunste wohl nicht schlecht   
 Auch im handler war noch ein Anf-Zeichen zu viel, nun sollte alles problemlos laufen
 
  	  | Zitat: |  	  | ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo 
 on SuchErsAusWerteListeWL1() --oooooooooooooooooooooooooooooooooooooooooooooooo
 global ErsetzterText, ZuErsetzenText, SuchErsetzPaarWLblabla
 (*--XCode Teil, der ist o.k
 -- BGcolor
 set BGColor to contents of text field "BGColor" of window "Main" of tab view item "Preferences"
 --NColor
 set NColor1 to contents of text field "NColor1" of window "Main" of tab view item "Preferences"
 set NColor2 to contents of text field "NColor2" of window "Main" of tab view item "Preferences"
 set NColor3 to contents of text field "NColor3" of window "Main" of tab view item "Preferences"
 set NColor4 to contents of text field "NColor4" of window "Main" of tab view item "Preferences"
 set NColor5 to contents of text field "NColor5" of window "Main" of tab view item "Preferences"
 --NF
 set NF1 to contents of text field "NF1" of window "Main" of tab view item "Preferences"
 set NF2 to contents of text field "NF2" of window "Main" of tab view item "Preferences"
 set NF3 to contents of text field "NF3" of window "Main" of tab view item "Preferences"
 set NF4 to contents of text field "NF4" of window "Main" of tab view item "Preferences"
 *)
 --Anfang Skript ( Such und Ersatz )
 --so wie von Snow korrigiert:
 set SuchErsetzPaarWLblabla to {¬
 {SuchT:"e", ErsatzT:"" & NColor2 & NF2 & BGColor}, ¬
 {SuchT:"a", ErsatzT:"" & NColor1 & NF1 & BGColor}, ¬
 {SuchT:"i", ErsatzT:"" & NColor3 & NF3 & BGColor}, ¬
 {SuchT:"o", ErsatzT:"" & NColor4 & NF4 & BGColor}, ¬
 {SuchT:"I", ErsatzT:"" & NColor4 & NF4 & BGColor}, ¬
 {SuchT:"A", ErsatzT:"" & NColor1 & NF1 & BGColor}, ¬
 {SuchT:"E", ErsatzT:"" & NColor2 & NF2 & BGColor}, ¬
 {SuchT:"O", ErsatzT:"" & NColor4 & NF4 & BGColor}, ¬
 {SuchT:"-", ErsatzT:"" & NColor5 & "-" & BGColor}, ¬
 {SuchT:"+", ErsatzT:"" & NColor5 & "+" & BGColor}, ¬
 {SuchT:"<", ErsatzT:"" & NColor5 & "<" & BGColor}, ¬
 {SuchT:">", ErsatzT:"" & NColor5 & ">" & BGColor}, ¬
 {SuchT:"=", ErsatzT:"" & NColor5 & "=" & BGColor}, ¬
 {SuchT:")", ErsatzT:"" & NColor5 & ")" & BGColor}, ¬
 {SuchT:"(", ErsatzT:"" & NColor5 & "(" & BGColor}, ¬
 {SuchT:"/", ErsatzT:"" & NColor5 & "/" & BGColor}, ¬
 {SuchT:"#", ErsatzT:"" & NColor5 & "#" & BGColor}, ¬
 {SuchT:"|", ErsatzT:"" & NColor5 & "|" & BGColor}, ¬
 {SuchT:"&", ErsatzT:"" & NColor5 & "&" & BGColor}, ¬
 {SuchT:"%", ErsatzT:"" & NColor5 & "%" & BGColor}, ¬
 {SuchT:"$", ErsatzT:"" & NColor5 & "$" & BGColor}, ¬
 {SuchT:"~", ErsatzT:"" & NColor5 & "~" & BGColor}, ¬
 {SuchT:"*", ErsatzT:"" & NColor5 & "*" & BGColor}, ¬
 {SuchT:"_", ErsatzT:"" & NColor5 & "_" & BGColor}, ¬
 {SuchT:"!", ErsatzT:"" & NColor5 & "!" & BGColor} ¬
 }
 my SuchErsetzPaarRepeater() --ooooooooooooooooooooooooooooooooooooooooooooo
 end SuchErsAusWerteListeWL1
 
 on SuchErsetzPaarRepeater() --ooooooooooooooooooooooooooooooooooooooooooooo
 set LangSuchErsetzPaarWL to count SuchErsetzPaarWLblabla
 repeat with ItZa from 1 to LangSuchErsetzPaarWL
 set AktSuchErsPaarWLZeile to item ItZa of SuchErsetzPaarWLblabla
 set SuchT to SuchT of AktSuchErsPaarWLZeile
 set ErsatzT to ErsatzT of AktSuchErsPaarWLZeile
 -- dasselbe natürlich auch für den handler: hier kein Anführungszeichen!
 --Soviel`s mir ist, hats im Modell im Pool ebenfalls keine AnfZeichen, sonst würde das Modell auch nicht laufen
 set ZuErsetzenText to ¬
 TexErsetzer(ZuErsetzenText, SuchT, ErsatzT)
 end repeat
 end SuchErsetzPaarRepeater
 
 on TexErsetzer(ZuErsetzenText, SuchT, ErsatzT) --oooooooooooooooooooooooooo
 tell (a reference to AppleScript's text item delimiters)
 set {od, contents} to {contents, {SuchT}}
 try
 set {ZuErsetzenTextList, contents} to {(text items of ZuErsetzenText), {ErsatzT}}
 set {ZuErsetzenText2, contents} to {(ZuErsetzenTextList as text), od}
 return item 1 of result
 on error errMeld number errZA
 set contents to od
 error errMeld number errZA
 end try
 end tell
 end TexErsetzer
 | 
 
 PS zu
 OS X-Snippets-skript : SUCHEN/ERSETZEN "EINGABEMASKE" AppleScript pur! :
 
 Ich hätte das niemals hingekriegt ohne die sorgfältige, geduldige Hilfe von Snow und aber! insbesondere die geniale Werte-Listen-Erzeugung !, dann diese enorm übersichtlichen und kurzgepressten Funktionshandler enstammen allesamt SNOW`s Konzept.
 Ich hab das lediglich mit Snows Hilfe in eine "Eingabemaske" ähnliche Struktur zusammenfügen können. Ich hoffe dass man das im OS X-Snippets auch so sieht, anders wäre das ja "sich mit fremden Federn schmücken".
 Kurz: wenn du Snow(und oft genügt auch schon sein Forum) richtig einsetzest für AppleSkript dann resultiert:
 
 • er liefert die Sprache(Vokabeln, Grammatik, idioms) und Korrektur, wo man oft blind vor hellerleuchteten Bildschirm sitzt.
 • Du bist der Poet
 
 Damit kann man einen Apple-Rechner(und nur einen solchen, Dosen machen da von Anfang an schlapp) voll und ganz in den Griff kriegen
 Einziges Restproblem: Druckerdialoge
 ansonsten, hugh.
 _________________
  Skript-Fan => ein  �  -Fan =>Scr¿¿-KongFuSius_Kurpfusius
 
 Zuletzt bearbeitet von spirigwi am 08.01.2006 - 12:52, insgesamt 5-mal bearbeitet
 |  |  
		| Nach oben |  |  
		|  |  
		| scriptingmouse13 •-->
 
  
  
 Anmeldedatum: 04.11.2003
 Beiträge: 125
 Wohnort: .DS_Store
 
 | 
			
				|  Verfasst am: 08.01.2006 - 12:21    Titel: |   |  
				| 
 |  
				| Hmn ... ja gut jetzt gehts... aber irgendwie hatt ich da auch keine Anführungszeichen hingemacht  .. Achso ja das könnnte daran liegen dass ich mitlerweile XCode auf den neuesten stand gebracht hab... hatte vorher noch 1.0  ... ok aber ich hab 1 Problem noch...wenn wir schon über xCode sprechen und ihr auch grade so schöne tipps gebt ^^ (danke nochmal hat mich jetz echt weitergebracht) ... Ich hab so meine Probleme mit Erscheinen und Verschwinden lassen gewisser objekte ... z.b. das Text Feld (NS Text Field) Jetzt mach ich doch set visible of Text Field "bla" of window "Blabla" to false/true oder ?... das selbe bei den ganzen Buttons -.- gibts da irgendwo ne liste oder sowas ?  Wäre nett wenn mir jmd. hilft  |  |  
		| Nach oben |  |  
		|  |  
		| Snow Administrator
 
  
  
 Anmeldedatum: 21.11.2000
 Beiträge: 1946
 Wohnort: Deiningen
 
 | 
			
				|  Verfasst am: 08.01.2006 - 13:39    Titel: |   |  
				| 
 |  
				| Du musst dir die Möglichkeiten der einzelnen Objekte im Funktionsverzeichnis ansehen. Dieses findest du ja in jedem Projekt unter Resources --> AppleScriptKit.sdef
 
 
 'visible' true/false funktioniert mit dem Textfeld und auch mit Buttons, da beide diese Eigenschaft von 'view' erben.
 
 Anmerkung: hier mit XCode 2.0 getestet
 _________________
 Peter
 -
 Fischer-Bayern.de|Shadetreemicro.com
 |  |  
		| Nach oben |  |  
		|  |  
		| scriptingmouse13 •-->
 
  
  
 Anmeldedatum: 04.11.2003
 Beiträge: 125
 Wohnort: .DS_Store
 
 | 
			
				|  Verfasst am: 08.01.2006 - 15:17    Titel: |   |  
				| 
 |  
				| Also ich hab jetzt mitlerweile 1.2 und lad jetz im moment 1.5 ... geht eigentlich 2.0 auf 10.3.9 ? ... Naja auf jedenfall hab ich : 
 2 Radio Buttons... mit denen ich Zwischen groß und kleinschreibung verstell ( ich hab 26 Text Fields ... für jeden buchstaben 1) wobei ich hier noch fragen wollte ob man per Applescript Groß und klein zerteilen kann.. also sagen wir ... eine Variable hat den text "a" und ich will jetzt aber das als großbuchstaben... wie könnt ich das machen ( ich bräucht das selbe natürlich auch umgekehrt... )... So weit so gut, jetzt soll wenn ich auf den Radio Button "Klein" drück zum testen 1 Text Field verschwinden .. T1 genannt... also hab ich dieses script :
 
 
 
 
  	  | Code: |  	  | on clicked theObject
 set TN to the name of theObject
 --*******************************--
 -- Text Field Variables ( Prefs )
 set T1 to text field "T1" of window "Main" of tab view item "Preferences"
 --*******************************--
 if TN is "Klein" then
 set visible of T1 to false
 end if
 end clicked
 
 | 
 
 So... ( ach ja danke nochmal für dieses set name of theObject @ Snow... das is absolut genial
  ) 
 So ... also klick ich auf Buld + Run... keine fehler... keine warnungen... gut... geh auf das Tab View Item "Preferences" und klick auf den Radio Button "klein" ... toll jetzt bekomm ich folgenden error :
 NSCannotCreateScriptCommandError (10)
 Hab nachgeschaut *g*
 the application received an invalid or unrecognized Apple event
 
 .... Jetzt hab ich doch mal nur so aus fun auf den Radio Button "Groß" gedrückt und bekomm den gleichen error, obwohl der noch gar keine aktion zugeordnet bekommen hat :/ ... Ich hab im Applescript window ( Apfel + 7 ) die namen angegeben, clicked  und natürlich das script angeklickt....
  Hilfe  |  |  
		| Nach oben |  |  
		|  |  
		| Snow Administrator
 
  
  
 Anmeldedatum: 21.11.2000
 Beiträge: 1946
 Wohnort: Deiningen
 
 | 
			
				|  Verfasst am: 08.01.2006 - 15:34    Titel: |   |  
				| 
 |  
				| Habe das Thema mal verschoben, da es sich ja um eine reine AppleScript Studio Angelegenheit handelt. 
 Zu deinem Problem mit den Radiobuttons. Du schreibst, dass du keine Aktion zugewiesen hast - aber du hast den Radiobuttons den "on clicked"-Handler zugewiesen.
 
 Dadurch werden natürlich auch Befehle ausgeführt - und zwar diese, die nicht extra durch eine if-Bedingung gefiltert werden:
 
 set TN to the name of theObject
 --*******************************--
 -- Text Field Variables ( Prefs )
 set T1 to text field "T1" of window "Main" of tab view item "Preferences"
 
 
 Stimmt diese Referenzierung?
 
 text field "T1" of window "Main" of tab view item "Preferences"
 
 Bei meinen eigenen Projekten war window "Main" stets das Hauptfenster.
 Es hätte bei mir dann so geheißen:
 
 text field "T1" of tab view item "Preferences" of window "Main"
 
 Hängt natürlich alles davon ab, wie du das Programm im Interface Builder gestaltet hast.
 _________________
 Peter
 -
 Fischer-Bayern.de|Shadetreemicro.com
 |  |  
		| Nach oben |  |  
		|  |  
		| scriptingmouse13 •-->
 
  
  
 Anmeldedatum: 04.11.2003
 Beiträge: 125
 Wohnort: .DS_Store
 
 | 
			
				|  Verfasst am: 08.01.2006 - 16:02    Titel: |   |  
				| 
 |  
				| Hmn ... Ja ich hab schon alles gemacht... also ich hab mein Window "Main" dann hab ich n Tab View dazu gemacht, eins davon "Preferences" genannt ( auch im AS Fenster ) und dann halt noch die 2 Radio Buttons... die ich wie schon gesagt Groß und Klein genannt hab ( auch im AS fenster... ) 
 Ok ich hab jetz zumindest mal den fehler... also es liegt wohl an dem "of tab view item "Preferences" denn wenn ich dies weglösche, dann zeigt er mir den (4) fehler an... d.h object nich gefunden oder so.. Also schätz ich mal dass es nich tab view item heisst
  kein plan... echt |  |  
		| Nach oben |  |  
		|  |  
		| Snow Administrator
 
  
  
 Anmeldedatum: 21.11.2000
 Beiträge: 1946
 Wohnort: Deiningen
 
 | 
			
				|  Verfasst am: 08.01.2006 - 16:43    Titel: |   |  
				| 
 |  
				| Radiobuttons sind Teil einer Matrix. Das siehst du im Interface Builder, wenn du das Objekt mit den Radio Buttons nur einmal anklickst. Der Titel der Inspector-Palette sollte nun "NSMatrix Inspector" lauten. Die Markierung sollte um alle Radiobuttons herum gehen. 
 Dieser Matrix kannst du nun im AppleScript-Panel einen Namen geben.
 
 Nun zu den einzelnen Buttons: Mit einem Doppelklick auf eine Reihe, wird nur ein Radiobutton und dessen Beschriftung grau hinterlegt. Dies ist das Objekt "Button Cell". Bitte im AppleScript Panel einen Namen vergeben.
 
 Das gleiche machst du für den zweiten Radio Button.
 
 Hier nun ein Skriptbeispiel, mit dem du den aktuell ausgewählen Radiobutton abfragen kannst (habe das in "awake from nib" verpackt) und in einem Textfeld einen entsprechenden Wert anzeigen lassen kannst, je nach dem, welcher Button geklickt wird.
 
 on clicked theObject
 set TN to name of theObject
 
 if TN = "BtnGross" then
 set content of text field "Anzeige" of window "main" to "Grossschreibung"
 else if TN = "BtnKlein" then
 set content of text field "Anzeige" of window "main" to "Kleinschreibung"
 end if
 end clicked
 
 on awake from nib theObject
 set selBtn to title of current cell of matrix "BtnMatrix" of window "main"
 set content of text field "Anzeige" of window "main" to selBtn
 end awake from nib
 
 Ich hoffe, das bringt dich etwas weiter.
 _________________
 Peter
 -
 Fischer-Bayern.de|Shadetreemicro.com
 |  |  
		| 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
 |  | 
 |