Setting the filetype of the [text] object

Jun 23, 2011 at 4:18pm

Setting the filetype of the [text] object

I’m currently using the [text] object to save long lists of integers into a file, which can then later be read back into the patcher using the [text] object again. I’m able to save/write files fine, but when I try and load/read the saved file I am unable to select it as the file is written as a document with no file extension.

How do I set it so the written files are of a .txt file type so that the [text] object will read them? I’ve noticed there’s a ‘filetype’ message you can send to the [text] object – I suspect this is what I need to use but don’t quite understand how to use it correctly.

I’m currently just using the ‘read’ and ‘write’ messages with no arguments so that it brings up the file browser in order for the user to compose/select the name of the file.

Jun 23, 2011 at 8:35pm

send a message like: [write filename.txt]

Jun 24, 2011 at 12:27pm

But I don’t want to use an argument such as “filename.txt” as I want the user to be able to select the path and name of the file. But I do want “.txt” added to the end. Could this be done using something like [sprintf] in some way?

Jun 24, 2011 at 12:39pm

[message: TEXT] -> [savedialog]-> [prepend write] ->[coll]

Jun 24, 2011 at 12:49pm

I am not sure if savedialog addes the .txt. if not use [sprintf %s.txt] before sending to coll.

Jun 24, 2011 at 1:42pm

Yeah the [savedialog] object really helped thanks!

The algorithm that I’ve settled on is [savedialog] -> [sprintf %s.txt] -> [tosymbol] -> [prepend write] -> [text]


You must be logged in to reply to this topic.