ScrapperMin a Web Automation Language

How to Set Parameter to run using console version (non GUI)

John Kenedy 2017-04-21

For example we have a sample script like below with filename HWZ.txt

        SET('PG', WC_GetPage('', ''));
        SET('PS', WC_GetPostStringRaw('', GET('PG'), '1', FORMAT('vb_login_username={PARAM0}&vb_login_md5password_utf={0}&vb_login_md5password={1}', SO_GetMd5Hash('{PARAM1}'),SO_GetMd5Hash('{PARAM2}')), ''));
        SET('PG2', WC_PostPageComplete(WC_GetLastActionUrl(), GET('PS'), ''));
        IF(GET('PG2'), 'CONTAINS', 'Thank you for logging', 
            LOG('Successfully Login');
            SET('PG3', WC_GetPage('{PARAM3}', ''));
            SET('URL', JOIN('', '', FILTER('0', SO_TagMatch(GET('PG3'), '/newreply.php?do=newreply&noquote=1&p=', '"'))));
            SET('PG4', WC_GetPage(GET('URL'), ''));
            SET('PS2', WC_GetPostStringRaw(GET('URL'), GET('PG4'), '3', 'message={PARAM4}', 'preview'));
            SET('PG5', WC_PostPageComplete(WC_GetLastActionUrl(), GET('PS2'), GET('URL')));
            EXIT('Post successfully');
        ,EXIT('Invalid Login'));

It is ScrapperMin script, where Function1(function2(function3), function2b()); etc like except that you can create array of string by concatenanting string with semicolon

        MyFunc('array index 0';'array index 1', 'second string')

Where MyFunc will accept a parameter with string[] and second parameter with string.
Back to above script, there interesting part is : WC_GetPostStringRaw

Which will get the HTTP POST string format "username=myid&password=mypass&securitytoken=AutoGetFromForm" and you just need to pass in myid and mypass, and the securitytoken etc and all other input inside the form index '1' of that page will be gotten from the HTML, and you only pass what interest you to fill in, like the username, and password. {PARAM0}, {PARAM1} and {PARAM2} is username, password and password again. The script detect {PARAM and whenever it detects it, it will replace with the script argument files, in this example script have three {PARAM from 0 to 2 which means the script requires 3 parameters. You run the script using

        scrappermin.exe -scr=HWZ.txt -args=param.txt

where param.txt contains

        password again
        message of bump

Of course you need to register in the site and have account before actually able to run the script successfully.
After having the POST string, you just call WC_PostPageComplete, to do POST using your final POST string where you have filled in the required fill such as username and password. And it will return the webpage and we check for string "Thank you for logging", if exist basically we have successfully log into the site.

What we do next is to find the thread ID by first getting the page content into PG3, and scrape the page ID that will be in the end of this string "newreply&noquote=1&p=". We use FILTER to get the first (index 0) of the occurence, and leave the rest. Then concatenante with the forum reply url using JOIN.
Finally we get the page to do posting of the forum. and using WC_GetPostStringRaw to get the form at index 3 which is the form to fill in for posting comment, we fill in "message" value pair with our input at {PARAM4} and remove the preview key pair and do a post.
And we shall see our comment posted to the forum.

ScrapperMin.exe can be scheduled in Task Scheduler and the parameter must be put correctly, then periodically it will bump your thread.
You can create your own script using ScrapperMinW.exe (windows form) and test run it, once successful you can write your own script to do Web Automation task of any website you need.