Results 1 to 3 of 3
  1. corpx's Avatar
    Posts
    209 Posts
    Global Posts
    219 Global Posts
       #1  
    I just wrote this. Any thoughts/comments?

    http://www.webos-internals.org/wiki/...ges_Using_Perl
  2. #2  
    I need a text conversation out of my palmdatabase for a court date. Downloaded and installed activestate perl and I'm getting an error about not having the DateTime.pm installed. Tried installing it, didn't work... Tried googling so many different things to try and get it to work with no luck. Any ideas?
    .:jIbMo:. (biatch)

    Sprint Palm Pre, previously Moto Q9c, Moto Q

    Palm is da bomb, don't hate!
  3. #3  
    Quote Originally Posted by jimbohsp View Post
    I need a text conversation out of my palmdatabase for a court date. Downloaded and installed activestate perl and I'm getting an error about not having the DateTime.pm installed. Tried installing it, didn't work... Tried googling so many different things to try and get it to work with no luck. Any ideas?
    Way overdue, but I just figured this out myself.

    run cmd.
    in the command line
    Code:
    C:\> cpan
    from the cpan prompt; the following commands will install the missing modules:
    Code:
    cpan> install Bundle::CPAN
    cpan> reload cpan
    cpan> install DateTime
    cpan> install DBI
    You can now close out the cpan prompt:
    Code:
    cpan> exit
    now that the preliminaries are out of the way, it's time to actually run the scripts

    from the command line change into the directory that both perl scripts AND the PalmDatabase.db3 are in. the following is just an example for if the perl scripts are located on your desktop in a folder called "pre-perl-script"
    Code:
    C:\> cd "Users\<yourname>\Desktop\pre-perl-script"
    Now you are in the folder "pre-perl-script"

    The following code is an example if pre-perl-scripts folder contains the perl scripts found on the webos-internals site named "perl_script1.pl" and "perl_script2.pl".

    where "perl_script1.pl" contains the code:
    Code:
    #!/usr/bin/perl
     
    use DBI;
     
    $dbh = DBI->connect( "dbi:SQLite:PalmDatabase.db3" ) || die "Cannot connect: $DBI::errstr";
     
     
    $res = $dbh->selectall_arrayref( q( SELECT firstName, lastName,id FROM com_palm_messaging_data_ChatThread WHERE _class_id = 11) );
    foreach( @$res ) {
     
        $first = $_->[0];
        $last = $_->[1];
        $id = $_->[2];
        print "$id - $first $last \n";
     
    }
    and where "perl_script2.pl" contains the code:
    Code:
    #!/usr/bin/perl
     
    use DBI;
    use DateTime;
     
    ($input,$me,$you) = @ARGV;
     
    $time_zone = 'America/Chicago';
     
    if ($me eq '')
    {
        $me = 'Me';
    }
     
    if ($you eq '')
    {
        $you = 'You';
    }
     
    $me.= " : ";
    $you.= " : ";
     
     
    $dbh = DBI->connect( "dbi:SQLite:PalmDatabase.db3" ) || die "Cannot connect: $DBI::errstr";
     
     
    $res = $dbh->selectall_arrayref( qq( SELECT belongs_id FROM com_palm_messaging_data_ChatThread_com_palm_pim_FolderEntry_Chat_Messages WHERE has_id = $input) );
     
    foreach( @$res ) {
     
        $id = $_->[0];
        $temp = $dbh->selectall_arrayref( qq( SELECT timeStamp, messageText,flags FROM com_palm_pim_FolderEntry  WHERE messageType = 'SMS' and id=$id) );
        foreach $x (@$temp)
        {
            $time = $x->[0];
            $time = $time/1000;
            $tofrom = find_code ( $x->[2] );
            $dt = DateTime->from_epoch(epoch => $time);
            $dt->set_time_zone( $time_zone );
     
            print $dt->month.'/'.$dt->day.'/'.$dt->year.' '.$dt->hour.':'.$dt->minute.':'.$dt->second.' '.$tofrom.$x->[1];
        }
     
     
     print "\n";
     
    }
     
     
     
    sub find_code {
        ($code) = @_;
        if ($code == 133)
        {
            return $me;
        }
     
        if ($code == 5)
        {
            return $you;
        }
     
        return "Unknown";
     
    }
    You would now run the following which will output a text file that contains a list of names and their respective IDs.
    Code:
    C:\User\<your name>\Desktop\pre-perl-script> perl "perl_script1.pl" > "id_output.txt"
    NOTE: don't close out of the command line yet, but go into the text file with your favorite text editor and find the id of the thread you want to output and highlight and copy.

    Now the moment we have all been waiting for!!!
    obviously don't type out the asterisks part it is just telling you what to do
    Code:
    C:\User\<your name>\Desktop\pre-perl-script> perl "perl_script2.pl" *right click and paste the id here* optional_your_name optional_other_name > "message_output.txt"
    Thatís it! Now you will have a text file "message_output.txt" in the "pre-perl-script" folder on your desktop that contains the full message thread.

Tags for this Thread

Posting Permissions