Dialogfeld immer offen mit Start und Stop Knopf

T

TanteKäthe

Neues Mitglied
Thread Starter
Dabei seit
20.05.2005
Beiträge
11
Reaktionspunkte
0
Hallo Applescripter :)

Möchte mir ein Programm schreiben, das automatisiert von einer Datei alle paar Minuten ein Backup macht. Dies funktioniert gut.
Aber ich hätte gerne ein offenes Dialogfeld mit einem Start und einem Stop Knopf um das Script zu starten und zu stoppen. Bisher habe ich eben nur eine Endlosschleife eingebaut, dann muss man das Programm abschiessen, wenn man fertig ist. (das ist aber eine schlechte Lösung!)

Habt ihr einen Tip?

Viele Grüße
Peter

Hier wäre so ein Auswahl-Dialog:
display dialog "Backup Rountine starten?" buttons {"Start", "Stop"} default button 1
if the button returned of the result is "" then
-- action for 1st button goes here
else
-- action for 2nd button goes here
end if

Hier ist das Backupscript:

set SourceFileName to "test2.xml"
set SourceFolder to "Macintosh HD:Users:pb:Desktop:TestBackup"
set DestinationFolder to "Macintosh HD:Users:pb:Desktop:TestBackup:Backup"
set wieoft to 3
set zaehler to 1
repeat while zaehler < wieoft
set totalSeconds to (time of (current date))
set tag to (day of (current date))
set monat to (month of (current date))
set NameDesFiles to monat & " " & tag & " " & totalSeconds as string
tell application "Finder"
copy document file (SourceFolder & ":" & SourceFileName as alias) to folder (DestinationFolder as alias)
set name of document file (DestinationFolder & ":" & SourceFileName as alias as alias) to NameDesFiles & "_" & SourceFileName
end tell
--set zaehler to zaehler + 1
delay 600
end repeat
 
...

Hallo TanteKäthe,

bau dir doch einen Quit Handler ein.

Gruß Andi
 
Zurück
Oben Unten