Author Topic: write to file not behaving  (Read 1133 times)

Tags:
  • All members
  • Posts: 314
write to file not behaving
« on: 10 Oct 2019, 10:04 »
Hi,

I have a write to file action in my trigger, which fires on a settled market, upon a win

The action is simple
write to file ...winner.txt
Market Status Settled
Text ["sel_name"]

It is writing to the file OK, but for some reason, it is adding an extra space between each character, see image

I have a user variable 'fibValue' that will change upon discovering a winner - the problem I am having is that I have a conditional in the trigger which checks that the winners name is present in the placed bet, an of course, because MFP has recorded all these extra spaces, then a check on selections name is in file will not see the selection because the name, as shown in the image, will not be discovered...

I have a further action that will increment a fib value, so I can update the stake value, but on this occasion, nothing happened, even though the selection was present, but written incorrectly...

How can I stop this?

Thanks

  • All members
  • Posts: 314
Re: write to file not behaving
« Reply #1 on: 10 Oct 2019, 10:09 »
and for completeness, I am including the correctly formed placedBets file, where you will see the value for Matteo Berrettini was written...

  • All members
  • Posts: 314
Re: write to file not behaving
« Reply #2 on: 10 Oct 2019, 10:11 »
You need to fix the image insert - I tried multiple times to add in an image but it asks for an image URL - the only way around this is to just drag the image into the post, then get an error, and then I am allowed to browse to add in an image

  • Administrator
  • Posts: 8826
  • Gender: Female
*
Re: write to file not behaving
« Reply #3 on: 10 Oct 2019, 10:20 »
Quote
How can I stop this?

Either do not create the initial file in another text editor (let MF Pro create it), or save it in UTF-8 format, then use it in MF Pro. The extra space is added when writing Unicode characters to a non-UTF-8 file.

Quote
You need to fix the image insert 

Seems to be working fine with other users. What are the exact steps you are using to attach an image?
Always try your triggers in Test Mode before switching to real money!

Follow us on Twitter.

Join our WhatsApp chat!

Присоединяйтесь к официальному Telegram-каналу!

  • All members
  • Posts: 314
Re: write to file not behaving
« Reply #4 on: 10 Oct 2019, 11:32 »
OK, thanks for the reply...

I will look to save i UTF-8, a little tiresome, but if that's the way to allow this to work, then so be it.. Can I assume that I can also use Unicode, direct?

This is an interesting problem. I have a .NET application that writes selections to a text file, and I do this using a list<string> variable, which I then write the file using a System.IO.File.WriteAllLines(filePath, list) method, and there is no overload option to use ANY encoding, which means it will more likely be in ANSI - yet, MFP reads these files OK, BUT, by setting an initial ANSI encoded file, MFP has problems with it... I honestly think you should fix that, because I have been experimenting, and the default setting for creating a notepad file and saving it, is ANSI, and, by creating a file in the default format, this created a problem with MFP. I expect most users will be using Windows OS?

As you are aware, if I need to add selections into a text file, MFP has a write to file action, and by leaving out my initial creation of this file, and allow MFP to take care of the writing, then what if I have another trigger that has a conditional to access that file, such as "selection's name is in file ...." - when I save the trigger, I will get a popup to ask me if I want to browse to the file, and of course, if I have to wait until a trigger writes the file, it becomes inconvenient. The ideal fix is that you change or update your code to inspect the encoding of the text file, and allow the appropriate reader/writer to do it's thing - having been a coder/software developer for many years, you have to establish most, if not all, user scenario's. This has clearly gone wrong, and the only action I took was to have a text file that I created, but MFP handled it incorrectly. I really would have expected MFP to be able to handle a text file that I created in my windows OS, using notepad as the creator of the text file. I can confirm to you that the default encoding in windows is ANSI

#### StreamReader(filename, true).CurrentEncoding ##### could be a possible option...? (You have to cater for BOM)

I know I am a very picky person, which is probably a nuisance to you, but I try to provide feedback, to help you improve the quality of your software - I am doing the stuff you haven't had time to do in your coding and subsequent testing/monitoring, hence my feedback.

As for the image problem...
When I create my post, I have the option to browse for an image.

AFTER I had posted my question, I then thought I should add in the placedFile image, for completeness. The only option available in the quick reply, is to add in a url link to the image - which I don't have. The file is located on my hard disk and not via a link. So, to be be able to post the image, I ended up dragging the image into the text area, and then clicked post. By doing that, the website throws an error to inform me that the text field cannot be more than 20,000 character (not sure if that number is correct - but it is along those lines) - once I get the error, I am then given a browse option, at which point, I can browse to the image and post it.

This is very simple to fix, you simply add in a link to the text area to allow the user to browse to locate an image.

It is not relevant whether any users have reported this, I have reported it, and I have shown you that there is no option to browse for the image, and yet, by purposely dragging the image into the text area, an error is thrown, after which point you have the option to browse. It would be much better if you provide the option to browse, but the original quick reply doesn't - that's what you need to fix it.

  • Administrator
  • Posts: 8826
  • Gender: Female
*
Re: write to file not behaving
« Reply #5 on: 10 Oct 2019, 13:27 »
Quote
The only option available in the quick reply

So please hit the "Reply" link next and use the extended interface to attach files (and use any other options if necessary).
Always try your triggers in Test Mode before switching to real money!

Follow us on Twitter.

Join our WhatsApp chat!

Присоединяйтесь к официальному Telegram-каналу!

  • All members
  • Posts: 314
Re: write to file not behaving
« Reply #6 on: 10 Oct 2019, 14:04 »
Thanks for stating the obvious.

To react to that, I am an HCI specialist - which is the acronym for Human Computer Interaction. It is the users experience which is most important here, and as you have the quick reply, maybe you don't realise it, but it does 'coax' the mind into using this, rather than the Reply link. Let me give you an analogy - you are walking down the street, on your left, there is a bicycle, nothing special, just a bike (the Reply link) - on your right, there is a red Ferrari, engine roaring (Quick reply, large textbox with interesting looking icons) - which do you think your mind would be more interested in? Hence, your mind is coaxed to the quick reply.

I do believe that my opinion is the 'correct' one, and to improve the HCI, you really should have included the browse option in the quick reply.

There is of course no point in pursuing this further as the topic was that the file had an incorrect entry, but it is something to think about.

 

Please note, BetFair is seems to be currently OFFLINE