Hej
Skriptet nedan fungerar under 10.4 men inte under 10.5.
Denna rad
"set mappStorlek to get physical size of folder tempRAW_Folder -- as integer"
ger som resultat missing value - vilket jag ännu inte lyckats lösa trots många olika försök.
Tacksam för tips.
Erland Segerstedt
Kusmark
Skritet nedan ograverat:
-- (G4)FyllaDVD_4,6GB-->dvd.scpt 2008-05-13
--DETTA SKRIPT FLYTTAR BILDER FRÅN RAWFILER_raid TILL DVD_BRÄNNA_MAPPEN.
property RawBilds_Lager : (alias "RAWFILER_raid:RawBilder_klart:")
property brannaMapp : (alias "RAWFILER_raid:branna_Mapp:")
property dialogerMappen : (alias ":Users:macpro:library:application support:Textboxen:")
property dvdArkivet : (alias "RAWFILER_raid:")
--DIALOGRUTA FÖR NYTT NR PÅ DVD_SKIVA
set lasa_textfil to (read file (((dialogerMappen) as text) & "dialog_DVDskiva.txt"))
set nyttDVDnr to result as integer
set nyttDVDnr to nyttDVDnr + 1
display dialog "Nytt nr på DVDskiva" & "_" default answer nyttDVDnr
set nyttDVDnr to (text returned of result) as text
set spara_textfil to (((dialogerMappen) as text) & "dialog_DVDskiva.txt")
my write_to_file(nyttDVDnr, spara_textfil, false)
--SLUT DIALOGRUTA FÖR NYTT NR PÅ DVD_SKIVA
set dvd_mappStorlek to 0
set mappLista_nyaMappar to {}
tell application "Finder"
set maxDVDnsMappStorlek to 4.6E+9 --for DVD, in MegaBytes
repeat with i from 1 to 1
set nyttDVDnr to nyttDVDnr
set nyttMappNamn to "RAW_skiva nr " & nyttDVDnr & "_" & my dagensDatum()
set nyttAliasMappNamn to "RAW_skiva nr " & nyttDVDnr & "_" & my dagensDatum()
set nyMapp to (make new folder in brannaMapp with properties {name:nyttMappNamn})
set nyAliasMapp to (make new folder in dvdArkivet with properties {name:nyttAliasMappNamn})
set the end of mappLista_nyaMappar to nyttMappNamn
end repeat
end tell
--KOD FÖR LADDNING AV BRÄNNAMAPPEN MED RÅFILSMAPPAR t o m 4,6 GB
tell application "Finder"
set maxDVDnsMappStorlek to 4.6E+9 --for DVD, in MegaBytes
set nyttMappNamn to "RAW_skiva nr " & nyttDVDnr & "_" & my dagensDatum()
set nyttAliasMappNamn to "RAW_skiva nr " & nyttDVDnr & "_" & my dagensDatum()
set n to (count folders of folder RawBilds_Lager)
set loop_Mapplista to 1
set mappLista_RawBilder to (every folder of RawBilds_Lager) as list
repeat with loop_RawBilder from 1 to n
if dvd_mappStorlek < maxDVDnsMappStorlek then
tell application "Finder"
set tempRAW_Folder to (item loop_RawBilder of mappLista_RawBilder) as alias
set mappNamn to (name of folder tempRAW_Folder)
set mappStorlek to get physical size of folder tempRAW_Folder -- as integer
if mappStorlek is equal to missing value then
display dialog missing value as text
else
end if
if dvd_mappStorlek + mappStorlek < (maxDVDnsMappStorlek) then
set temp_Mapp to (brannaMapp as text) & (item loop_Mapplista of mappLista_nyaMappar) as alias
make alias file to tempRAW_Folder at nyAliasMapp
move tempRAW_Folder to temp_Mapp
set dvd_mappStorlek to (dvd_mappStorlek + mappStorlek) --as integer
else
if dvd_mappStorlek + mappStorlek > (maxDVDnsMappStorlek) then
if dvd_mappStorlek > ((maxDVDnsMappStorlek)) then
tell application "Finder"
close front window
open disk "rawfilsLager"
set dvd_mappStorlek to ((round (dvd_mappStorlek / 1.074201E+9) * 100) / 100)
display dialog "DVD-skiva nr " & nyttDVDnr & " klar att brännas! Den väger " & dvd_mappStorlek & " GB." --default button {"OK", "Avbryt"}
return false
end tell
end if
end if
end if
end tell
end if
end repeat
end tell
--SLUT KOD FÖR LADDNING AV BRÄNNAMAPPEN MED RÅFILSMAPPAR t o m 4,6 GB
--SUBRUTINEN SKRIVA TILL TEXTFIL
on write_to_file(this_file, target_file, append_data)
try
set the target_file to the target_file as text
set the open_target_file to ¬
open for access file target_file with write permission
if append_data is false then ¬
set eof of the open_target_file to 0
write this_file to the open_target_file starting at eof
close access the open_target_file
return true
on error
try
close access file target_file
end try
return false
end try
end write_to_file
--SLUT SUBRUTINEN SKRIVA TILL TEXTFIL
--VILLKOR FÖR DATUM I DIALOGRUTA
on dagensDatum()
set idagDatum to (current date)
set numDag to the day of idagDatum as integer
set numDag to text -2 thru -1 of ("0" & numDag)
set numManad to the month of idagDatum as integer
set numManad to text -2 thru -1 of ("0" & numManad)
set numArtal to the year of idagDatum as integer
set numArtal to text -2 thru -1 of ("0" & numArtal)
set iDag to numArtal & numManad & numDag
end dagensDatum
--SLUT VILLKOR FÖR DATUM I DIALOGRUTA