If you have a problem or need to report a bug please email : support@dsprobotics.com
There are 3 sections to this support area:
DOWNLOADS: access to product manuals, support files and drivers
HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects
USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here
NEW REGISTRATIONS - please contact us if you wish to register on the forum
Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright
Txt file loading problem
9 posts
• Page 1 of 1
Txt file loading problem
Hey,
Can someone enlight me on this?
I just can't open this text file with the text load primitive.
I guess it has something to do with raw and rich text formatting, ASCII or something like that…
What I'm trying to do is to get the available free space for a disk…
The 2 files are generated by 2 different expressions thru PowerShell and lead, obviously to 2 different kind of formatting…
I know that this has already been done with ruby, but it's just that I don't like to not know...
Please, can someone confirm this? (just open the text files with the txt load primitive)
Any help would be greatly appreciated
Can someone enlight me on this?
I just can't open this text file with the text load primitive.
I guess it has something to do with raw and rich text formatting, ASCII or something like that…
What I'm trying to do is to get the available free space for a disk…
The 2 files are generated by 2 different expressions thru PowerShell and lead, obviously to 2 different kind of formatting…
I know that this has already been done with ruby, but it's just that I don't like to not know...
Please, can someone confirm this? (just open the text files with the txt load primitive)
Any help would be greatly appreciated
"Essential random order for chaotic repetitive sequences"
-
tektoog - Posts: 141
- Joined: Sat Oct 30, 2010 11:49 pm
- Location: Geneva - Switzerland
Re: Txt file loading problem
Flowstone does not support multi-byte encoding. The not working one is encoded with UTF 16 (= 2 bytes per char). You got away with the first one, as it uses 1 byte per char although still UTF encoded. This can give you issues outside of the standard ASCII range (7 bit), because there the indices don't match anymore.
If you want to be 100% sure, save your text ANSI-encoded (= full ASCII, 8 bit).
If you want to be 100% sure, save your text ANSI-encoded (= full ASCII, 8 bit).
"There lies the dog buried" (German saying translated literally)
- tulamide
- Posts: 2714
- Joined: Sat Jun 21, 2014 2:48 pm
- Location: Germany
Re: Txt file loading problem
Thx Tulamide for your explanations.
So would you know what kind of argument I should add to the expression to format the redirected file as a correct ANSI format?
Also when I get the result in a string component and then pass it thru an integer prim…
I kind of feel dumb to ask that, but how can I get the right number? It seems I've never encountered this issue before...
So would you know what kind of argument I should add to the expression to format the redirected file as a correct ANSI format?
Also when I get the result in a string component and then pass it thru an integer prim…
I kind of feel dumb to ask that, but how can I get the right number? It seems I've never encountered this issue before...
"Essential random order for chaotic repetitive sequences"
-
tektoog - Posts: 141
- Joined: Sat Oct 30, 2010 11:49 pm
- Location: Geneva - Switzerland
Re: Txt file loading problem
if your project is something commercial maybe check out the native ruby text load, it has the option of loading practically any encoding.
If you were making a plugin designed to load text files, it'd make a lot of sense.
If you were making a plugin designed to load text files, it'd make a lot of sense.
-
wlangfor@uoguelph.ca - Posts: 912
- Joined: Tue Apr 03, 2018 5:50 pm
- Location: North Bay, Ontario, Canada
Re: Txt file loading problem
I never worked with PowerShell, but a quick google search got this:
But I'm afraid you have to find out on your own, how this will help you!
Flowstone integers are signed 32 bit. That means the maximum positive value they can hold is 2,147,483,647. Of course, on a 64-bit file system you exceed the limit. Luckily, Ruby's integer are of "on demand" bit depth, so it is no issue for Ruby to work with that big numbers. Once you made the number smaller than above mentioned signed 32-bit limit, you can output it to green.
Quick'n'dirty direct conversion example in Ruby, where the only input is a string and the only output an integer:
- Code: Select all
Set-Content -LiteralPath "$filePath" -Encoding Ascii
But I'm afraid you have to find out on your own, how this will help you!
Flowstone integers are signed 32 bit. That means the maximum positive value they can hold is 2,147,483,647. Of course, on a 64-bit file system you exceed the limit. Luckily, Ruby's integer are of "on demand" bit depth, so it is no issue for Ruby to work with that big numbers. Once you made the number smaller than above mentioned signed 32-bit limit, you can output it to green.
Quick'n'dirty direct conversion example in Ruby, where the only input is a string and the only output an integer:
- Code: Select all
output(0, @in.to_i / 1024 / 1024 / 1024)
#outputs rounded Gigabytes
"There lies the dog buried" (German saying translated literally)
- tulamide
- Posts: 2714
- Joined: Sat Jun 21, 2014 2:48 pm
- Location: Germany
Re: Txt file loading problem
wlangfor@uoguelph.ca wrote:check out the native ruby text load, it has the option of loading practically any encoding
In native Ruby, yes; but unfortunately, the Ruby interpreter embedded in FS only includes support for ASCII-8BIT, UTF-8, and US-ASCII (in v3.0.6 at least - type "Encoding.list" into a RubyEdit primitive to see the supported encodings).
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
Don't stagnate, mutate to create!
-
trogluddite - Posts: 1730
- Joined: Fri Oct 22, 2010 12:46 am
- Location: Yorkshire, UK
Re: Txt file loading problem
Thanks for your answers, guys!
After a good meal and looking deeper into this, my conclusion is that it's not easy to get a conversion from one format to another with just a command line... a full script would be needed to get to the desired result, involving external batch processing blahblahblah…
Great, useful info! does it work with other keywords? good way to learn the possible commands with this method...
Well,looking forward to a possible TXTLoad primitive update then...
After a good meal and looking deeper into this, my conclusion is that it's not easy to get a conversion from one format to another with just a command line... a full script would be needed to get to the desired result, involving external batch processing blahblahblah…
trogluddite wrote:type "Encoding.list" into a RubyEdit primitive to see the supported encodings
Great, useful info! does it work with other keywords? good way to learn the possible commands with this method...
Well,looking forward to a possible TXTLoad primitive update then...
"Essential random order for chaotic repetitive sequences"
-
tektoog - Posts: 141
- Joined: Sat Oct 30, 2010 11:49 pm
- Location: Geneva - Switzerland
Re: Txt file loading problem
tektoog wrote:Great, useful info! does it work with other keywords? good way to learn the possible commands with this method...
Ruby has a lot of methods which can be useful for discovering what features are available, either by typing them into an empty RubyEdit or by displaying them using the "watch" method from running code. You can find out what variables and constants are declared, what methods an object or Class has, the current environment variables, and a whole lot more. Generally, they're more useful for debugging than for learning from, but there are a few undocumented FS Ruby features which have been discovered by using them to poke around under the hood.
For example, calling ".instance_methods" on the name of a class will list all of the methods which object of that class can respond to (or you can just call ".methods" on any individual instance).
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
Don't stagnate, mutate to create!
-
trogluddite - Posts: 1730
- Joined: Fri Oct 22, 2010 12:46 am
- Location: Yorkshire, UK
Re: Txt file loading problem
Thanks a lot for your enlightment!
I definitely will need 2 lives...
I definitely will need 2 lives...
"Essential random order for chaotic repetitive sequences"
-
tektoog - Posts: 141
- Joined: Sat Oct 30, 2010 11:49 pm
- Location: Geneva - Switzerland
9 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 47 guests