Hello,
Once upon a time, I needed a script to add a random quote from a file at the bottom of my mail. I got some help from here and I used the method nr2 as stated in this thread: viewtopic.php?t=855
But I got a new computer, and now, this is not working anymore. Instead of just picking up one quote, the script goes on and reads and executes whatever it can execute from the text file.
Here is the script:
FileRead, List, D:\Dropbox\Dokumenter\underskrifter\tags.txt
Sort, List, Random
Send, % SubStr(List, 1, InStr(List, "`r`n")-1)
What can I do to make it stop after it writes the line from the file?
Thanks in advance for your answers.
Regards,
Cyril
Script for random quotes not working anymore
- cyrilmalka
- Posts: 7
- Joined: Feb 22nd, ’19, 02:54
Please make sure the text file contains quotes, each in a new line.
Maybe your file is formatted differently, in this can you may need to change the last line to
Send, % SubStr(List, 1, InStr(List, "`n")-1)
Maybe your file is formatted differently, in this can you may need to change the last line to
Send, % SubStr(List, 1, InStr(List, "`n")-1)
- cyrilmalka
- Posts: 7
- Joined: Feb 22nd, ’19, 02:54
Hello, Tom,
Thank you for your answer.
Yes, the file containing the quotes contains one quote per line. It has been working fine until now. I didn't touch anything. I bought a new computer, exported my Fastkeys to the new computer.
The txt-file is the same I just copied it from one computer to an other.
I tried the change you suggested, it didn't change anything.
If I start the script on Notepad++ for example, it writes all the quotes, one pr. line and after a while, if I don't touch anything, it writes gibberish.
I don't understand what happens at all.
Here is a 50 seconds video so you can see what happens (if it helps): https://somup.com/c0l31GkIiO
There is the same kind of code twice: Once from one file for the promotion, and then the second one with the taglines. The problem happens only with the tagline.
I write "sig+" which contains this:
--
Amicalement,
Cyril
Cyril Malka sur Instagram => http://instagram.com/cyril_malka
%CODE_kurser%
... %CODE_tagline%
And then, what you see in the video happens.
Regards,
Cyril
Thank you for your answer.
Yes, the file containing the quotes contains one quote per line. It has been working fine until now. I didn't touch anything. I bought a new computer, exported my Fastkeys to the new computer.
The txt-file is the same I just copied it from one computer to an other.
I tried the change you suggested, it didn't change anything.
If I start the script on Notepad++ for example, it writes all the quotes, one pr. line and after a while, if I don't touch anything, it writes gibberish.
I don't understand what happens at all.
Here is a 50 seconds video so you can see what happens (if it helps): https://somup.com/c0l31GkIiO
There is the same kind of code twice: Once from one file for the promotion, and then the second one with the taglines. The problem happens only with the tagline.
I write "sig+" which contains this:
--
Amicalement,
Cyril
Cyril Malka sur Instagram => http://instagram.com/cyril_malka
%CODE_kurser%
... %CODE_tagline%
And then, what you see in the video happens.
Regards,
Cyril
I tested it again on my end and it works as expected. I see you have another code in CODE_kurser macro. Check it out, maybe this is causing the trouble.
- cyrilmalka
- Posts: 7
- Joined: Feb 22nd, ’19, 02:54
Hello, Tom,
Thanks for your help.
I tried to remove the first one. It didn't help.
They are identical codes, just two different .txt files. The one works (kurser), the other didn't (tags).
So I finally copied the text from the text-file that didn't work (tags) on a copy of the text-file that worked (kurser) and it works again.
Apparently there must have been something in the one text file that went wrong. It was corrupted in a way.
Now it works.
Thanks for your time.
Regards,
Cyril
Thanks for your help.
I tried to remove the first one. It didn't help.
They are identical codes, just two different .txt files. The one works (kurser), the other didn't (tags).
So I finally copied the text from the text-file that didn't work (tags) on a copy of the text-file that worked (kurser) and it works again.
Apparently there must have been something in the one text file that went wrong. It was corrupted in a way.
Now it works.
Thanks for your time.
Regards,
Cyril