I have trouble with a table view, which should show the content of a file
The content of the file has already been stored there by writing the content of a data source to the file.
everything works well, except of the last three items of the file of every row. These items are numbers. the others are text.
For Example: The file content from the data source is :
items are stored from tableview with 6 cols and 3 rows:
1|asd|A|1,0|1,0|1,0|2|asd|B|2,0|2,0|4,0|3|ASD|C|3,0|3,0|9,0|«constant rdwreof »
the script is able to read the content, but just writes the first three columns of each row.
I found out that I set a table formatter to the last 3 cols. After removing the formatter it did work but ergh… not formatted of course.
Anyone who knows how to read from file to tableview with formatted columns???
there the relevant open script
on frittenOpen()
set theContents to ""
tell open panel
set title to "Frittenbude: Öffnen"
set prompt to "Öffnen"
set can choose directories to true
set can choose files to true
end tell
set theResult to display open panel
if theResult is 1 then
try
set fileName to (path name of open panel)
set theFile to open for access fileName as POSIX file
set theContents to read theFile as string
close access theFile
on error
try
display dialog "Fehler beim Öffnen der Datei!" with icon 2
close access file theFile
return false
end try
return true
end try
set oldTextItemDelimiters to AppleScript's text item delimiters
set AppleScript's text item delimiters to {"/"}
set neuerName to (last text item of (fileName as string))
set AppleScript's text item delimiters to oldTextItemDelimiters
load nib "MainMenu.nib"
set name of window "TheWindow" to neuerName
set title of window neuerName to neuerName
set visible of window neuerName to true
try
set update views of TheDataSource to false
set oldTextItemDelimiters to AppleScript's text item delimiters
set AppleScript's text item delimiters to {"|"}
set reihenAnzahl to (count of text items of theContents) / 6 as integer
set itemNummer to 0
repeat with m from 1 to reihenAnzahl
set theDataRow to make new data row at the end of data rows of TheDataSource
repeat with n from 1 to 6
set contents of data cell n of theDataRow to text item (n + itemNummer) of theContents
end repeat
set itemNummer to (itemNummer + n)
end repeat
set AppleScript's text item delimiters to oldTextItemDelimiters
set update views of TheDataSource to true
on error
display dialog "Fehler beim Öffnen der Datei!" with icon 2
return false
end try
else if theResult is 0 then
close open panel
return false
end if
return true
end frittenOpen