<script type="text/javascript"> </script> <script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script>
#This script is aimed to do auto post for wordpress. Tested with wp 2.5
# on windows XP, activestate perl 5.8.820 with IEAutomation module installed.
#put all your articles/blogs in the folder $DIR. The script will use the file name
#as post title (without file extension, of course). Suppose you save your articles
#as .txt files, otherwise edit the statement “$post_title = substr($file,0,length($file)-4);”
#to get correct file name. For txt or htm, use length($file)-4, for html, use -5, and so on.
use Win32::IEAutomation;
#******************* Define variables *****************
$post_url = “http://netrancher.0fees.net/wp-admin/post-new.php”;
$DIR = ‘C:/download’;
&wplogin;
#************ open dirctory to read each files in it*************
opendir DH, $dir or die “cannot open dir $DIR: $!/n”;
foreach $file (readdir(DH)) {
next if $file eq “.”;
next if $file eq “..”;
open FH,”$DIR//$file” or warn “cannot open file $file: $!/n”;
undef $/;
$con = <FH>;
$/ = “/n”;
#******************* determine which category to put this file to
undef $cat_is,$cat_itc,$cat_os;
undef $cat_cs,$cat_git,$cat_net;
undef $cat_ai,$cat_db,$cat_pl;
if ($file =~ /network|wireless|wi-fi|wimax| lan | wan |/) {$cat_net = “0″}
if ($file =~ /Linux|unix|UNIX|[wW]indows|ubuntu|redhat|solaris/) {$cat_os = “0″}
if ($file =~ /certification|guide|cssip|ccna|ccnp|ccie|ocp|mcse|scsa/) {$cat_itc = “0″}
if ($file =~ /mysql|mssql| SQL | sql |oracle|database/) {$cat_db = “0″}
if ($file =~ /security|secur|forensic|hack|crack|authentic/) {$cat_is = “0″}
if ($file =~ /aritifical|intelligence|fuzzy|mind|brain|human/) {$cat_ai = “0″}
if ($file =~ /science|computing|architecture|computational|algorithmic|genetic/) {$cat_cs =”0″}
if ($file =~ /program|perl|python|developer|ruby|j2ee|j2se|java|vb|/.net/) {$cat_pl = “0″}
if ($file =~ /access|excel|office|word|powerpoint|sap|performance|troubleshoot|windows/) {$cat_git = “0″}
#************* prepare other variables for post ************
#
$post_title = substr($file,0,length($file)-4);
#************************ open IE to post-new.php*************
#*
$ie=Win32::IEAutomation->new(”Maximize =>1″,”Visiable => 1″);
$ie->gotoURL($post_url);
$ie->WaitforDone();
$ie->getTextBox(’name:’,”post_title”)->SetValue($post_title);
$ie->getButton(’id:’,”edButtonHTML”)->click();
$ie->getTextArea(’name:’,”content”)->SetValue($con);
sleep(2);
#************************ set post category ********************
if (defined $cat_ai) {
$ie->getSelectList(’id:’,”newcat_parent”)->SelectItem(”artifical intelligence”);}
if (defined $cat_db) {
$ie->getSelectList(’id:’,”newcat_parent”)->SelectItem(”Database”);}
if (defined $cat_git) {
$ie->getSelectList(’id:’,”newcat_parent”)->SelectItem(”General IT”);}
if (defined $cat_is) {
$ie->getSelectList(’id:’,”newcat_parent”)->SelectItem(”information security”);}
if (defined $cat_itc) {
$ie->getSelectList(’id:’,”newcat_parent”)->SelectItem(”IT certification”);}
if (defined $cat_net) {
$ie->getSelectList(’id:’,”newcat_parent”)->SelectItem(”networking”);}
if (defined $cat_os) {
$ie->getSelectList(’id:’,”newcat_parent”)->SelectItem(”Operating System”);}
if (defined $cat_pl) {
$ie->getSelectList(’id:’,”newcat_parent”)->SelectItem(”Programming Language”);}
if (defined $cat_cs) {
$ie->getSelectList(’id:’,”newcat_parent”)->SelectItem(”Computer Science”);}
#************************* set publish status *******************
#
sleep(2);
$ie->getSelectList(’name:’,”post_status”)->SelectItem(”Published”);
#************************ click the publish button **************
#
$ie->getButton(’id:’,”publish”)->click();
}
sub wplogin {
$myie = Win32::IEAutomation->new(”maximize => 1″,”visible => 1″);
$myie->gotoURL(”http://netrancher.0fees.net/wp-login.php”);
$myie->getTextBox(’id:’,”user_login”)->SetValue(”netrancher”);
$myie->getTextBox(’id:’,”user_pass”)->SetValue(”yourpassword”);
$myie->getButton(’name:’,”wp-submit”)->click();
sleep(3);
$myie->closeIE();
}