Can I do this?

General Macro Scheduler discussion

Moderators: Dorian (MJT support), JRL

Post Reply
DarkPink

Can I do this?

Post by DarkPink » Fri Dec 06, 2002 11:50 pm

Hi,

Before I buy the full version of Macro Scheduler, I want to make sure it can do what I want it to do.

I would like it to go onto my website, extract order information (such as Items purchased, name, address, phone number) then use this information to fill in a form on another website and also send off a confirmation e-mail to my customer. The data will always be different, and in different quantaties (for the items ordered).

Thanks in Advance :?:

Dark Pink

Can I do this

Post by Dark Pink » Fri Dec 06, 2002 11:51 pm

I was also looking at iOpus internet macros, but it doesn't seem to be as flexable with non-internet tasks.

Ernest

Post by Ernest » Sat Dec 07, 2002 12:20 pm

Hi DP,
maybe scanning the (static) webpage source code for the variable data would meet your requirements. :idea: (see command reference! for details)

to do command

read line from saved (webpage) source code/file e.g. 3rd line = ReadLn>
cut of unwanted (static) line parts, e.g. 48 from left= MidStr>
identify text (purchased item) before next Tag = Position>
start browser with target webpage = Run Program>
move to inputfield = Press Tab
input data = Send>
submit the input = Press Enter
send confirmation = SMTPSendMail>
write log = TimeStamp>

to ge the variables could be tricky, but is undoubtfully possible :wink:

rgds,
Ernest

DarK Pink

Can I do this

Post by DarK Pink » Sat Dec 07, 2002 9:59 pm

Thanks for the pointers. :D

I think in the long run I would be better off with Macro Scheduler, but in the short term there will be a steep learning curve. :(

Is there anyone who writes scripts for $ here? :idea:

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Sun Dec 08, 2002 11:12 am

Hi,

I would also look at the HTTPRequest command and consider avoiding automating a web browser altogether. Construct the GET request to retrieve the initial data to an HTML file and parse it using ReadLn etc. Then construct the POST request for posting the data to the new page.

Or look at automating Internet Explorer with VBScript - some samples at http://www.mjtnet.com/scripts.hts
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

DarkPinK

Can I do this

Post by DarkPinK » Mon Dec 09, 2002 3:08 am

One thing that might help is that I have the phrase "ship to" in the web page, followed by the Name and shipping address, so this would help me find this with macro. Should I just save the page to disk, and then run a macro on the HTML file. I would eventually like to put this all in a spead sheet as well.

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Mon Dec 09, 2002 12:57 pm

It's up to you - you can either save it to a text file and scan the file, or if you use the HTTPRequest command, for example, the HTML can end up in a variable and then you could use the Position command to locate the position of the 'ship to' string and then use MidStr to extract the data you are interested in. Both methods are similar but you would avoid reading in line by line by working on the variable. It probably depends more on how you intend to get the web page in the first place. The HTTPRequest function allows you to retrieve to a variable and/or to a file. If you automate a web browser you are more likely going to have to save to a file.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Ernest

Post by Ernest » Tue Dec 10, 2002 4:00 pm

Hi,
have a look at this, maybe usefull ... :idea:

Code: Select all

Let>line=TestTestTestTestTestTestTestTestTest"ARIAL">ship to: ToonTown</font ...
Let>tag=<

//check string pos. of "ship to"
Position>ship to,line,1,shippos

//ignore "ship to" + the following space
Add>shippos,9

//check for the "<" Tag which should follow the value/variable
Position><,line,%shippos%,tagpos

//one step back, to ignore the "<" Tag
Sub>tagpos,1

//read the value between "ship to" + space and TagPos - 1
MidStr>line,shippos,tagpos,destination

MessageModal>%destination%
Rgds,
Ernest

Ernest

Post by Ernest » Tue Dec 10, 2002 4:35 pm

Ooops,
You can delete this line from my prevoius script sample: Let>tag=<

---

And btw. if you want to create a "database"/spreadsheet you hopefully use the Comma Separated Value (*csv) - format which can be used with EXCEL, ACCESS, etc.

Code: Select all

:

GetDate>Date
Let>Delimiter=,
Let>Data=
Let>Header=Date, OrderNumber, Surname, Name, Postcode, City, Country, ...

//check if destination file is available
IfFileExists>C:\MyOrders.txt, FileFeed

//create destination file with header
WLN>C:\MyOrders.txt, RESULT, %Header%

//merge collected data to create a data record + write it to the file
Label>FileFeed
ConCat>Data,%Date%%Delimiter%%OrderNumber%%Delimiter%%Surname%%Delimiter%%Name%%Delimiter% ...
WLN>C:\MyOrders.txt, RESULT, %Data%
...
The destination file will look like this:

Date, OrderNumber, Surname, Name, Postcode, City, ...
09/12/2002,12345,Dark,Pink,4711,ToonTown,...

So you can import it to EXCEL etc.

Have fun,
E.

DarkPinK
Newbie
Posts: 4
Joined: Tue Dec 10, 2002 1:41 am

Thanks

Post by DarkPinK » Wed Dec 11, 2002 12:59 am

That is really cool E. :D Thanks for your help. The CSV Data code is really helpful.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts