Changing File Kind
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Changing File Kind
I create a file with the extension .ncx (it's the toc.ncx file, used in the creation of an eBook, in fact). The file is shown in the Finder as being of File Kind Text. I believe that for the correct associations to work during ePub creatiion, the File Kind should be Unix Executable File. Can I force this Kind in LiveCode script?
Re: Changing File Kind
Hola exheusden,
check "filetype" in the dictionary!
You can set this to the file type you want right before you save a file to disc from Livecode.
Best
Klaus
check "filetype" in the dictionary!
You can set this to the file type you want right before you save a file to disc from Livecode.
Best
Klaus
Re: Changing File Kind
Indeed you can, but what has the type got to do witht he kind? I understood the Type (and Creator) to be a left-over from pre-MacOS X. Are you saying that Type and Kind are the same? And, if so, what is the Kind/Type of a Unix Executable File (offering the file to the FileType utility provides only unreadable characters, which can't be copied)?Klaus wrote:Hola exheusden,
check "filetype" in the dictionary!
You can set this to the file type you want right before you save a file to disc from Livecode.
Best
Klaus
Re: Changing File Kind
Hi exheusden,
sorry for misunderstanding!
I never heard the term "file kind" so I automatically presumed that you meant "file type".
So what exactly do you mean with "file kind"?
On the other hand, you can "fool" the Finder to decide from the SUFFIX what file a file is by setting the filetype
to empty before saving your file from within LiveCode:
...
set the filetype to ""
put VariableWithTextOrWhatever into url("file:" & path_ti_file")
...
Now this file will appear in the Finder as one might exspect, as long as the file SUFFIX is known to the Finder.
Example:
...
set the filetype to ""
put fld "A Field" into ulr("file:mytextfile.txt")
...
Now "mytextfile.txt" will appear as a text file and will be opened with TextEdit when you doubleclick the file.
Know what I mean? Just try it if not
Best
Klaus
sorry for misunderstanding!
I never heard the term "file kind" so I automatically presumed that you meant "file type".
So what exactly do you mean with "file kind"?
On the other hand, you can "fool" the Finder to decide from the SUFFIX what file a file is by setting the filetype
to empty before saving your file from within LiveCode:
...
set the filetype to ""
put VariableWithTextOrWhatever into url("file:" & path_ti_file")
...
Now this file will appear in the Finder as one might exspect, as long as the file SUFFIX is known to the Finder.
Example:
...
set the filetype to ""
put fld "A Field" into ulr("file:mytextfile.txt")
...
Now "mytextfile.txt" will appear as a text file and will be opened with TextEdit when you doubleclick the file.
Know what I mean? Just try it if not

Best
Klaus
Re: Changing File Kind
Klaus, that sounds like an interesting trick, which I shall try.
The File Kind is displayed by the Finder in the Preview panel of the Finder when in column view. Items displayed are Name, Kind, Size, Created, Modified, Last opened. Usually, the Kind is dependent on the extension, but this is not always the case. In this instance, for example, I am creating a file with extension .ncx, yet it is shown with Kind Plain Text.
What the relationship is between LiveCode's FileType and MacOS X's Kind, I have no idea.
The File Kind is displayed by the Finder in the Preview panel of the Finder when in column view. Items displayed are Name, Kind, Size, Created, Modified, Last opened. Usually, the Kind is dependent on the extension, but this is not always the case. In this instance, for example, I am creating a file with extension .ncx, yet it is shown with Kind Plain Text.
What the relationship is between LiveCode's FileType and MacOS X's Kind, I have no idea.
Re: Changing File Kind
Ah, now I get it!
The last four letters of a "filetype" decide the KIND of a document! -> "TEXT", "JPEG", "PNGf" etc.
If you do "put the long files" you will see the fieltyp of the files in the current folder as the last item of the list
and you will also see, that many of them do NOT have any filetype anymore!
This is because Apple is moving away with every new version of OS X from the old filetype mechanism
and will instead use the suffix of a file to determine its kind.
So my trick will probably be the best, if not only method to do the right thing, which means:
Make it the Finder's problem!
Best
Klaus

The last four letters of a "filetype" decide the KIND of a document! -> "TEXT", "JPEG", "PNGf" etc.
If you do "put the long files" you will see the fieltyp of the files in the current folder as the last item of the list
and you will also see, that many of them do NOT have any filetype anymore!
This is because Apple is moving away with every new version of OS X from the old filetype mechanism
and will instead use the suffix of a file to determine its kind.
So my trick will probably be the best, if not only method to do the right thing, which means:
Make it the Finder's problem!

Best
Klaus
-
- VIP Livecode Opensource Backer
- Posts: 10046
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: Changing File Kind
4W FileTyper uses AppleScript to change the old Mac file type codes. You can get it from the Stacks section in RevNet:
Development->Plugins->GoRevNet
You're welcome to use anything in it you find helpful.
Development->Plugins->GoRevNet
You're welcome to use anything in it you find helpful.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn