Hi,
We have been using Macroscheduler for some time, and it has been a great cost savings. We are now tasked to do something we haven't done before, and not sure how to do it. So hopefully someone can share some insight.
Here is the background on the current script we have. Our script interacts with a web based applications, and fills the necessary fields with information from a CSV file and submits the information. The company doesn't offer API, so we use Macroscheduler to perform the tasks. The script runs continously till the CSV file is complete.
Now we are required to input a significant amount of "text" into a memo field in the browser. Since we are currently using a CSV file, adding paragraphs of text to the CSV will be overwhelming.
Ideally, we would be able to tell MacroScheduler to pick up the text from a static text file.
Can that be done? If so.. how?
Any help or suggestions would greatly be appreciated.
Populate Memo Field with text file
Moderators: JRL, Dorian (MJT support)
Exactly. Yes use a text file.Ideally, we would be able to tell MacroScheduler to pick up the text from a static text file.
Look into ReadFile> if your text to be written is an entire file or ReadLn> if you are going to read then write specific lines of a text file. Either way you will be assigning the text from the file to a variable. Once you have the text assigned to a variable send the variable value to the memo field probably using the same techniques you currently use to put the csv data into the edit field.
You don't mention how you are currently doing the csv to edit field but you could use the Send> function or you might try putting the text to the clipboard using PutClipBoard> then pasting the clipboard data into the memo field using:
Press ctrl
Send>v
Release ctrl
In either case make sure your window and memo field have focus.
Cool.
I looked at the ReadFile command, and it seems pretty straigth forward, but I can't seem to get it to work.. maybe I am not seeing something.
Form what I understand, ReadFile syntax is this ReadFile>(textfile),(variablename).
So based on that, I wrote this little script:
ReadFile>c:\mysample.txt,myText
Message>myText
It runs.. and the message box comes out and says, "myText", versus the content of the text file.
I copied and pasted the "c:\mysample.txt", and the file does open. So I know the file name and path is right.
So what am I doing wrong here? Why is "myText" variable, not receiving the content of the text file?
I use the message a lot to test my variables.. so I know it should show the content.
Any insight woudl be great.
I looked at the ReadFile command, and it seems pretty straigth forward, but I can't seem to get it to work.. maybe I am not seeing something.
Form what I understand, ReadFile syntax is this ReadFile>(textfile),(variablename).
So based on that, I wrote this little script:
ReadFile>c:\mysample.txt,myText
Message>myText
It runs.. and the message box comes out and says, "myText", versus the content of the text file.
I copied and pasted the "c:\mysample.txt", and the file does open. So I know the file name and path is right.
So what am I doing wrong here? Why is "myText" variable, not receiving the content of the text file?
I use the message a lot to test my variables.. so I know it should show the content.
Any insight woudl be great.
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Remove any trailing spaces and change Message to MessageModal just so you can be sure you see it.
Copy and paste this code in:
Copy and paste this code in:
Code: Select all
ReadFile>c:\mysample.txt,myText
MessageModal>myText
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Ok.. this makes absolutely no sense.. it works now.
Not sure what I did.. but here is what I use to read the txt file, send a message for verification, and then populate a memo field:
ReadFile>C:\mysample.txt,mytextfile
Message>mytextfile
Let>FieldValue=%mytextfile%
Thanks again for all the help.
- Ton
Not sure what I did.. but here is what I use to read the txt file, send a message for verification, and then populate a memo field:
ReadFile>C:\mysample.txt,mytextfile
Message>mytextfile
Let>FieldValue=%mytextfile%
Thanks again for all the help.
- Ton
It makes sense. My guess this is the reason why:
You may have unintentionally removed the extra space while editing which is why the script works now. The rule of thumb is never put extra spaces in your scripts unless they are meaningful.
Try your script both ways and see the difference.
Other syntax variations that can cause trouble:
"ReadFile>C:\mysample.txt, mytextfile"
"ReadFile>C:\mysample.txt ,mytextfile"
"ReadFile> C:\mysample.txt,mytextfile"
If you got the ReadFile correct, the Message statement could be wrong:
"Message>mytextfile "
rather than
"Message>mytextfile"
This syntax makes it obvious what the variable name is:
"Message>%mytextfile%
(But you can't use that trick in the ReadFile statement)
Gale
If your original script contained "ReadFile>C:\mysample.txt,mytextfile " then the variable name would be "mytextfile ", not "mytextfile".Remove any trailing spaces
You may have unintentionally removed the extra space while editing which is why the script works now. The rule of thumb is never put extra spaces in your scripts unless they are meaningful.
Try your script both ways and see the difference.
Other syntax variations that can cause trouble:
"ReadFile>C:\mysample.txt, mytextfile"
"ReadFile>C:\mysample.txt ,mytextfile"
"ReadFile> C:\mysample.txt,mytextfile"
If you got the ReadFile correct, the Message statement could be wrong:
"Message>mytextfile "
rather than
"Message>mytextfile"
This syntax makes it obvious what the variable name is:
"Message>%mytextfile%
(But you can't use that trick in the ReadFile statement)
Gale
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
And if you LIKE spaces then look at the IGNORESPACES directive.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?