Fischer-Bayern.de
 FAQFAQ   SuchenSuchen   MitgliederlisteMitgliederliste   BenutzergruppenBenutzergruppen   RegistrierenRegistrieren 
 ProfilProfil   Einloggen, um private Nachrichten zu lesenEinloggen, um private Nachrichten zu lesen   LoginLogin 

problem

 
Neues Thema eröffnen   Neue Antwort erstellen    Fischer-Bayern.de Foren-Übersicht -> AppleScript X
Vorheriges Thema anzeigen :: Nächstes Thema anzeigen  
Autor Nachricht
legofan
•->
•->


Anmeldedatum: 23.05.2011
Beiträge: 16

BeitragVerfasst am: 20.08.2011 - 12:22    Titel: problem Antworten mit Zitat

ich hab mir dieses kleine Programm geschrieben allerdings funktioniert es bie manchen buchstaben nicht richtig

Code:

set re to display dialog "" buttons {"Verschlüsseln", "Entschlüsseln"}
set re to the button returned of re
display dialog "Text zum " & re & " eingeben" default answer "" buttons {"OK"} default button 1
set unkrypttext to the text returned of the result
set kt to ""
set error_log_bolean to false
set error_log to ""
repeat with i from 1 to count unkrypttext
   set ukti to text item i of unkrypttext
   
   if ukti is "a" then set ukn to 0.1
   if ukti is "b" then set ukn to 0.2
   if ukti is "c" then set ukn to 0.3
   if ukti is "d" then set ukn to 0.4
   if ukti is "e" then set ukn to 0.5
   if ukti is "f" then set ukn to 0.6
   if ukti is "g" then set ukn to 0.7
   if ukti is "h" then set ukn to 0.8
   if ukti is "i" then set ukn to 0.9
   if ukti is "j" then set ukn to 1.0
   if ukti is "k" then set ukn to 1.1
   if ukti is "l" then set ukn to 1.2
   if ukti is "m" then set ukn to 1.3
   if ukti is "n" then set ukn to 1.4
   if ukti is "o" then set ukn to 1.5
   if ukti is "p" then set ukn to 1.6
   if ukti is "q" then set ukn to 1.7
   if ukti is "r" then set ukn to 1.8
   if ukti is "s" then set ukn to 1.9
   if ukti is "t" then set ukn to 2.0
   if ukti is "u" then set ukn to 2.1
   if ukti is "v" then set ukn to 2.2
   if ukti is "w" then set ukn to 2.3
   if ukti is "x" then set ukn to 2.4
   if ukti is "y" then set ukn to 2.5
   if ukti is "z" then set ukn to 2.6
   if ukti is "1" then set ukn to 2.7
   if ukti is "2" then set ukn to 2.8
   if ukti is "3" then set ukn to 2.9
   if ukti is "4" then set ukn to 3.0
   if ukti is "5" then set ukn to 3.1
   if ukti is "6" then set ukn to 3.2
   if ukti is "7" then set ukn to 3.3
   if ukti is "8" then set ukn to 3.4
   if ukti is "9" then set ukn to 3.5
   if ukti is "0" then set ukn to 3.6
   if ukti is " " then set ukn to 3.7
   if ukti is "!" then set ukn to 3.8
   if ukti is "?" then set ukn to 3.9
   if ukti is "." then set ukn to 4.0
   if ukti is "," then set ukn to 4.1
   set bit to 0.1
   if re is "verschlüsseln" then
      set kn to ukn + bit
   else
      set kn to ukn - bit
      
   end if
   
   repeat
      if kn > 4.1 then
         set kn to kn - 4.1
      else if kn < 0.1 then
         set kn to kn + 4.1
      else
         exit repeat
      end if
   end repeat
   
   set kti to "  (error [" & ukti & "] bit=" & bit & ")  "
   if kn is 0.1 then set kti to "a"
   if kn is 0.2 then set kti to "b"
   if kn is 0.3 then set kti to "c"
   if kn is 0.4 then set kti to "d"
   if kn is 0.5 then set kti to "e"
   if kn is 0.6 then set kti to "f"
   if kn is 0.7 then set kti to "g"
   if kn is 0.8 then set kti to "h"
   if kn is 0.9 then set kti to "i"
   if kn is 1.0 then set kti to "j"
   if kn is 1.1 then set kti to "k"
   if kn is 1.2 then set kti to "l"
   if kn is 1.3 then set kti to "m"
   if kn is 1.4 then set kti to "n"
   if kn is 1.5 then set kti to "o"
   if kn is 1.6 then set kti to "p"
   if kn is 1.7 then set kti to "q"
   if kn is 1.8 then set kti to "r"
   if kn is 1.9 then set kti to "s"
   if kn is 2.0 then set kti to "t"
   if kn is 2.1 then set kti to "u"
   if kn is 2.2 then set kti to "v"
   if kn is 2.3 then set kti to "w"
   if kn is 2.4 then set kti to "x"
   if kn is 2.5 then set kti to "y"
   if kn is 2.6 then set kti to "z"
   if kn is 2.7 then set kti to "1"
   if kn is 2.8 then set kti to "2"
   if kn is 2.9 then set kti to "3"
   if kn is 3.0 then set kti to "4"
   if kn is 3.1 then set kti to "5"
   if kn is 3.2 then set kti to "6"
   if kn is 3.3 then set kti to "7"
   if kn is 3.4 then set kti to "8"
   if kn is 3.5 then set kti to "9"
   if kn is 3.6 then set kti to "0"
   if kn is 3.7 then set kti to " "
   if kn is 3.8 then set kti to "!"
   if kn is 3.9 then set kti to "?"
   if kn is 4.0 then set kti to "."
   if kn is 4.1 then set kti to ","
   
   if kti contains "error" then
      if error_log_bolean is false then
         set error_log to error_log & "  (error [" & ukti & "] bit=" & bit & ")  "
      else
         set error_log to error_log & return & "  (error [" & ukti & "] bit=" & bit & ")  "
      end if
      set error_log_bolean to true
   else
      
      set kt to kt & kti
   end if
end repeat
if error_log_bolean is false then
   set texti to kt
else
   set texti to kt & return & "errorlog:" & return & error_log
end if
display dialog texti

das meiste geht nur die Zeichen c, f ,i, w,x,2,3,7,8,? gehen nicht. Twisted Evil Hat jemand ne idee weshalb das so ist? Ich weiß es nämlich nicht. Embarassed
Nach oben
Benutzer-Profile anzeigen Private Nachricht senden
hubionmac
•--->
•--->


Anmeldedatum: 26.02.2004
Beiträge: 245
Wohnort: Münster

BeitragVerfasst am: 20.08.2011 - 19:20    Titel: Antworten mit Zitat

Ich habe keinen Schimmer warum sich AppleScript weigert bestimmte real Werte als solche zu erkennen, aber mit der Wandlung des Wertes zum string kann man diesen strangen Bug umschiffen...

Zitat:
set re to display dialog "" buttons {"Verschlüsseln", "Entschlüsseln"}
set re to the button returned of re
display dialog "Text zum " & re & " eingeben" default answer "" buttons {"OK"} default button 1
set unkrypttext to the text returned of the result
set kt to ""
set error_log_bolean to false
set error_log to ""
repeat with i from 1 to count unkrypttext
   set ukti to text item i of unkrypttext
   
   if ukti is "a" then set ukn to 0.1
   if ukti is "b" then set ukn to 0.2
   if ukti is "c" then set ukn to 0.3
   if ukti is "d" then set ukn to 0.4
   if ukti is "e" then set ukn to 0.5
   if ukti is "f" then set ukn to 0.6
   if ukti is "g" then set ukn to 0.7
   if ukti is "h" then set ukn to 0.8
   if ukti is "i" then set ukn to 0.9
   if ukti is "j" then set ukn to 1.0
   if ukti is "k" then set ukn to 1.1
   if ukti is "l" then set ukn to 1.2
   if ukti is "m" then set ukn to 1.3
   if ukti is "n" then set ukn to 1.4
   if ukti is "o" then set ukn to 1.5
   if ukti is "p" then set ukn to 1.6
   if ukti is "q" then set ukn to 1.7
   if ukti is "r" then set ukn to 1.8
   if ukti is "s" then set ukn to 1.9
   if ukti is "t" then set ukn to 2.0
   if ukti is "u" then set ukn to 2.1
   if ukti is "v" then set ukn to 2.2
   if ukti is "w" then set ukn to 2.3
   if ukti is "x" then set ukn to 2.4
   if ukti is "y" then set ukn to 2.5
   if ukti is "z" then set ukn to 2.6
   if ukti is "1" then set ukn to 2.7
   if ukti is "2" then set ukn to 2.8
   if ukti is "3" then set ukn to 2.9
   if ukti is "4" then set ukn to 3.0
   if ukti is "5" then set ukn to 3.1
   if ukti is "6" then set ukn to 3.2
   if ukti is "7" then set ukn to 3.3
   if ukti is "8" then set ukn to 3.4
   if ukti is "9" then set ukn to 3.5
   if ukti is "0" then set ukn to 3.6
   if ukti is " " then set ukn to 3.7
   if ukti is "!" then set ukn to 3.8
   if ukti is "?" then set ukn to 3.9
   if ukti is "." then set ukn to 4.0
   if ukti is "," then set ukn to 4.1
   set bit to 0.1
   if re is "verschlüsseln" then
      set kn to ukn + bit
   else
      set kn to ukn - bit
      
   end if
   
   repeat
      if kn > 4.1 then
         set kn to kn - 4.1
      else if kn < 0.1 then
         set kn to kn + 4.1
      else
         exit repeat
      end if
   end repeat
   
   set kti to " (error [" & ukti & "] bit=" & bit & ") "
   set kn to kn as text
   if kn is 0.1 as text then set kti to "a"
   if kn is 0.2 as text then set kti to "b"
   if kn is 0.3 as text then set kti to "c"
   if kn is 0.4 as text then set kti to "d"
   if kn is 0.5 as text then set kti to "e"
   if kn is 0.6 as text then set kti to "f"
   if kn is 0.7 as text then set kti to "g"
   if kn is 0.8 as text then set kti to "h"
   if kn is 0.9 as text then set kti to "i"
   if kn is 1.0 as text then set kti to "j"
   if kn is 1.1 as text then set kti to "k"
   if kn is 1.2 as text then set kti to "l"
   if kn is 1.3 as text then set kti to "m"
   if kn is 1.4 as text then set kti to "n"
   if kn is 1.5 as text then set kti to "o"
   if kn is 1.6 as text then set kti to "p"
   if kn is 1.7 as text then set kti to "q"
   if kn is 1.8 as text then set kti to "r"
   if kn is 1.9 as text then set kti to "s"
   if kn is 2.0 as text then set kti to "t"
   if kn is 2.1 as text then set kti to "u"
   if kn is 2.2 as text then set kti to "v"
   if kn is 2.3 as text then set kti to "w"
   if kn is 2.4 as text then set kti to "x"
   if kn is 2.5 as text then set kti to "y"
   if kn is 2.6 as text then set kti to "z"
   if kn is 2.7 as text then set kti to "1"
   if kn is 2.8 as text then set kti to "2"
   if kn is 2.9 as text then set kti to "3"
   if kn is 3.0 as text then set kti to "4"
   if kn is 3.1 as text then set kti to "5"
   if kn is 3.2 as text then set kti to "6"
   if kn is 3.3 as text then set kti to "7"
   if kn is 3.4 as text then set kti to "8"
   if kn is 3.5 as text then set kti to "9"
   if kn is 3.6 as text then set kti to "0"
   if kn is 3.7 as text then set kti to " "
   if kn is 3.8 as text then set kti to "!"
   if kn is 3.9 as text then set kti to "?"
   if kn is 4.0 as text then set kti to "."
   if kn is 4.1 as text then set kti to ","
   if kti contains "error" then
      if error_log_bolean is false then
         set error_log to error_log & " (error [" & ukti & "] bit=" & bit & ") "
      else
         set error_log to error_log & return & " (error [" & ukti & "] bit=" & bit & ") "
      end if
      set error_log_bolean to true
   else
      
      set kt to kt & kti
   end if
end repeat
if error_log_bolean is false then
   set texti to kt
else
   set texti to kt & return & "errorlog:" & return & error_log
end if
display dialog texti

_________________
hubionmac.com akzeptiere Paypal und Pizza
Nach oben
Benutzer-Profile anzeigen Private Nachricht senden Website dieses Benutzers besuchen
Skeeve
•---->
•---->


Anmeldedatum: 20.04.2006
Beiträge: 1067

BeitragVerfasst am: 21.08.2011 - 19:20    Titel: Antworten mit Zitat

Ohne es geprüft zu haben: Mit ziemlicher Sicherheit liegt es daran, daß bestimmte Real Werte nicht ganz genau als Binärzahl dargestellt werden können. Sie ergeben halt einen periodischen Binärbruch.

Darum lernt man eigentlich gleich im ersten Semester Informatik Realzahlen nicht auf Gleichheit zu vergleichen.

In diesem Fall würde ich entweder mit 10 multiplizieren und in einen nteger wandeln oder gleich auf eine passende Formal gehen um diesen elenden Spaghetticode zu umgehen.
_________________
"All problems are solved in slightly less than half an hour" (Chumbawamba, "Hey Hey We're The Junkies")
Nach oben
Benutzer-Profile anzeigen Private Nachricht senden
jiuer7845
•--->
•--->


Anmeldedatum: 06.04.2021
Beiträge: 368

BeitragVerfasst am: 09.10.2021 - 09:49    Titel: Antworten mit Zitat

Travis Scott Jordan 1

Yeezy Shoes

Yeezy Supply

Air Jordans

Jordan 11s

Jordan 11

Jordans Shoes

Retro Jordans

Moncler Jackets

Nike Air Jordan

Moncler Outlet

Off-White

Yeezy 450

Yeezy 500

Yeezy

Yeezy 700

Yeezy Supply

Off White Shoes

NFL Jerseys

Jordan Shoes

Jordans Shoes

Yeezy 350 V2

Adidas Yeezy

Yeezy

Yeezy 700

Yeezy

Nike Outlet

Yeezy Shoes

UNC Jordan 1

Jordan 13

Jordan AJ 1

Yeezy Foam Runner

Nike Outlet

Nike Outlet

AJ1

Yeezy Supply

Yeezy Zebra

Jordan 1 Low

Air Jordans

Pandora Charms

Adidas UK

Nike Store

Adidas Yeezy Official Website

Yeezy 350

Jordan 1

Nike Outlet

YEEZY SUPPLY

Pandora Charms

Nike Shoes

Nike Outlet

Pandora Outlet

Jordan Shoes

Air Jordan 4

Pandora Jewelry

Pandora Rings

Pandora Bracelets

Adidas Yeezy

Yeezy

Pandora Charms

Nike Outlet

Adidas Yeezy

Air Max 720

Nike Air Max 270

Air Jordan 11

Air Force 1

Air Jordan 1

Nike Jordans

Jordan 1s

Pandora UK

Nike Jordan 1

Jordan 1

Yeezy Slides

Nike Air VaporMax

Nike Vapormax Flyknit

Air Jordan 1 Mid

Adidas yeezy

Yeezy Shoes

Adidas Yeezy

Yeezy 350

Nike Shoes

Nike Outlet

Yeezy

NFL Shop Official Online Store

Nike UK

Yeezy

Yeezy 350
_________________
https://www.pandoras-jewelry.com/ Pandora Jewelry
https://www.pandoraoutlet.org/ Pandora Outlet
https://www.jordanshoess.com/ Jordan Shoes
https://www.air-jordan4.com/ Air Jordan 4
https://www.charms-pandora.com/ Pandora Charms
Nach oben
Benutzer-Profile anzeigen Private Nachricht senden Website dieses Benutzers besuchen AIM-Name
jiuer7845
•--->
•--->


Anmeldedatum: 06.04.2021
Beiträge: 368

BeitragVerfasst am: 16.12.2021 - 10:13    Titel: Antworten mit Zitat

Jordans 4
Jordan Retro 4
Jordan Shoes
Travis Scott Jordan 1
Yeezy Shoes
Yeezy Supply
Air Jordans
Jordan 11s
Jordan 11
Jordans Shoes
Moncler Outlet
Off-White
Yeezy 450
Yeezy 500
Yeezy
Yeezy 700
Yeezy Supply
Off White Shoes
NFL Jerseys
Retro Jordans
Moncler Jackets
Nike Air Jordan
Jordan Shoes
Jordans Shoes
Yeezy 350 V2
Adidas Yeezy
Yeezy
Yeezy 700
Yeezy
Nike Outlet
Yeezy Shoes
Yeezy Foam Runner
Nike Outlet
Nike Outlet
AJ1
UNC Jordan 1
Jordan 13
Jordan AJ 1
Yeezy Supply
Yeezy Zebra
Jordan 5
Jordan 1 Low
Air Jordans
Pandora Charms
Adidas UK
Nike Store
Adidas Yeezy Official Website
Yeezy 350
Jordan 1
Nike Outlet
YEEZY SUPPLY
Nike Shoes
Nike Outlet
Pandora Outlet
Jordan Shoes
Air Jordan 4
Pandora Jewelry
Pandora Bracelets
Adidas Yeezy
Yeezy
Pandora Charms
Nike Outlet
Adidas Yeezy
Air Max 720
Air Jordan 1
Nike Jordans
Jordan 1s
Pandora UK
Nike Jordan 1
Jordan 1
Yeezy Slides
Nike Air VaporMax
Nike Vapormax Flyknit
Air Jordan 1 Mid
Adidas yeezy
Yeezy 350
Nike Shoes
Nike Outlet
Yeezy
NFL Shop Official Online Store
Nike UK
Yeezy
Yeezy 350
_________________
https://www.pandoras-jewelry.com/ Pandora Jewelry
https://www.pandoraoutlet.org/ Pandora Outlet
https://www.jordanshoess.com/ Jordan Shoes
https://www.air-jordan4.com/ Air Jordan 4
https://www.charms-pandora.com/ Pandora Charms
Nach oben
Benutzer-Profile anzeigen Private Nachricht senden Website dieses Benutzers besuchen AIM-Name
Beiträge der letzten Zeit anzeigen:   
Neues Thema eröffnen   Neue Antwort erstellen    Fischer-Bayern.de Foren-Übersicht -> AppleScript X Alle Zeiten sind GMT + 2 Stunden
Seite 1 von 1

 
Gehe zu:  
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


AppleScript für absolute Starter