Pages

Affichage des articles dont le libellé est AppleScript : Files. Afficher tous les articles
Affichage des articles dont le libellé est AppleScript : Files. Afficher tous les articles

2 juin 2008

Write data to a file

on writeFile(theText, thePath, appendData)
try
set thePath to thePath as string
set idFile to open for access file thePath with write permission
if appendData is false then set eof of the idFile to 0
write theText to idFile starting at eof
close access id_file
on error
close access file thePath
return false
end try
end writeFile

>>Ouvrir le script dans l'éditeur

Read data from a file

on readFile(thePath)
try
set thePath to thePath as string
set idFile to open for access file thePath
set fileData to read idFile
close access idFile
on error errMsg number errNum
close access file thePath
return false
end try
return fileData
end readFile

>>Ouvrir le script dans l'éditeur