[perl-win32-gui-users] Quick Question

2003-10-17 Thread Cruickshanks, Darin
All,
 
This shouldn't really go to this list but here goes.
 
I have a script where a user will enter a date in this format
25/11/2003 
 
Does anyone know of a way with Perl to get the 'day' from this?
(Mon,Tue etc)
 

Darin



Darin Cruickshanks
Labs Manager, Computing Service
University of Essex
[EMAIL PROTECTED]
01206 873585

 


RE: [perl-win32-gui-users] Quick Question

2003-10-17 Thread Howard, Steven (US - Tulsa)
If you are using Activestate Perl, Date::Calc should be part of your
standard distribution. If it is not part of your distribution, you can get
it from CPAN. It has a lot of very useful functions. Look through it to see
what all it has.
 
Using Date::Calc, here is one way you could do what you have asked:
 
use Date::Calc qw(:all);

my $date = '25/11/2003';

my @dateparts = split m#\/#, $date;

# call the function from Date::Calc using arguments Year, Month, Day
my $dow = Day_of_Week(@dateparts[2, 1, 0]);

# print numeric day of week:

print $dow . "\n"; 

# make an array for day names:

my @days = qw(Sunday Monday Tuesday Wednesday Thursday Friday Saturday);

print "The day of the week for $date is $days[$dow]\n"


 
-Original Message-
From: Cruickshanks, Darin [mailto:[EMAIL PROTECTED] 
Sent: Friday, October 17, 2003 3:43 AM
To: perl-win32-gui-users@lists.sourceforge.net
Subject: [perl-win32-gui-users] Quick Question
 
All,
 
This shouldn't really go to this list but here goes.
 
I have a script where a user will enter a date in this format   25/11/2003 
 
Does anyone know of a way with Perl to get the 'day' from this?  (Mon,Tue
etc)
 
Darin

Darin Cruickshanks
Labs Manager, Computing Service
University of Essex
[EMAIL PROTECTED]  
01206 873585
 
- This message (including any attachments) contains confidential information
intended for a specific individual and purpose, and is protected by law.  -
If you are not the intended recipient, you should delete this message and
are hereby notified that any disclosure, copying, or distribution of this
message, or the taking of any action based on it, is strictly prohibited.


Re: [perl-win32-gui-users] Quick Question

2003-10-17 Thread Anthony George
-Original Message-
From: "Cruickshanks, Darin" <[EMAIL PROTECTED]>
To: 
Date: Fri, 17 Oct 2003 09:43:20 +0100
Subject: [perl-win32-gui-users] Quick Question

> I have a script where a user will enter a date in this format
> 25/11/2003 
>  
> Does anyone know of a way with Perl to get the 'day' from this?
> (Mon,Tue etc)
>  

Grab Date::Calc, and:

use Date::Calc qw/Day_of_Week/;

$dow = Day_of_Week($year,$month,$day);

  Anthony George <[EMAIL PROTECTED]> Systems Engineer.
Do your technical services need medical attention?  We can help.  EMSTS, 
LLC.  800-304-8269   231-720-1600   http://www.emsts.com  2516 Glade 
Muskegon,MI 49444

(-)
This electronic mail transmission, including all attachments,
is intended only for the use of the individual to whom it is
addressed and may contain protected information or other
privileged and confidential information.  If you are not the
intended recipient, you are hereby notified that any 
dissemination, disclosure, copying, or use of this 
transmission, any attachment, or any protected 
information or other privileged and confidential information 
contained herein is strictly prohibited.  If you have received 
this communication in error, please notify the sender 
immediately by email and delete the original message and all 
attachments. Thank you.
_EMLCNFDNT
(-)





[perl-win32-gui-users] Outlook - list all folders

2003-10-17 Thread angelo . magnone

Does anyone have any examples of how to list all the folder names for a
particular Outlook profile?
I'm looking at using Win32::OLE but can't figure out how to list ALL folder
names.

Any help would be appreciated.
Thanks!


This e-mail may be privileged and/or confidential, and the sender does not
waive any related rights and obligations. Any distribution, use or copying of
this e-mail or the information it contains by other than an intended recipient
is unauthorized. If you received this e-mail in error, please advise me (by
return e-mail or otherwise) immediately. 

Ce courrier électronique est confidentiel et protégé. L'expéditeur ne renonce
pas aux droits et obligations qui s'y rapportent. Toute diffusion, utilisation
ou copie de ce message ou des renseignements qu'il contient par une personne
autre que le (les) destinataire(s) désigné(s) est interdite. Si vous recevez
ce courrier électronique par erreur, veuillez m'en aviser immédiatement, par
retour de courrier électronique ou par un autre moyen.




[perl-win32-gui-users] off-topic: Quick Question

2003-10-17 Thread Johan Lindstrom

At 10:43 2003-10-17, Cruickshanks, Darin wrote:

I have a script where a user will enter a date in this format   25/11/2003

Does anyone know of a way with Perl to get the 'day' from this?  (Mon,Tue etc)


I'll help you help yourself by pointing to the two modules you need.

C:\> perldoc Date::Parse
C:\> perldoc Date::Format

But it is off-topic, and a better place for this is:
http://www.perlmonks.org/


/J

 --  --- -- --  --  -- -  - -
Johan LindströmSourcerer @ Boss Casinos [EMAIL PROTECTED]

Latest bookmark: "Random Tips on ParseRecDescent"
http://www.perlmonks.org/index.pl?node_id=180778
dmoz (1 of 30): /Computers/Software/Accounting/Tax/ 90




RE: [perl-win32-gui-users] Problems formatting text box - Favour! !

2003-10-17 Thread Ounsted, Toby
Hi,
 
Would someone be able to test the below and confirm whether it's just me?
Specifically I can't get coloured text if the 'align'  is in place for the
text field, but commented out the colours come back.  What am I doing
wrong?!
 
Thanks,
 
Toby.
 
use Win32::GUI;
 
$Desktop = Win32::GUI::GetDesktopWindow();
 
$Desktop_Width = Win32::GUI::Width($Desktop);
$Desktop_Height = Win32::GUI::Height($Desktop);
$Hello_Left = $Desktop_Width / 4;
$Hello_Top = $Desktop_Height / 4;
$Hello_Width = $Desktop_Width / 2;
$Hello_Height = $Desktop_Height / 2;
$Message = "\r\n\r\n\r\nHello World\r\n\r\n";
 
 
$Hello_Window = new Win32::GUI::Window(
-name => "Hello World",
-dialogui => 1,
-left => $Hello_Left,
-top => $Hello_Top,
-width => $Hello_Width,
-height => $Hello_Height,
-text => "Hello Window",
-minsize => [ $Hello_Width, $Hello_Height,],
-maxsize => [ $Hello_Width, $Hello_Height,],
-topmost => 1,
);
 
$font = Win32::GUI::Font->new(
 
-name => "Times New Roman", 
-size => 48,
);

 
$Hello_Window->AddTextfield(
-name => "Hello_Text",
-font => $font,
-foreground => [0,255,0],
-background => [0,0,255],
-multiline => 1,
-text => $Message,
-left   => 0,
-top=> 0,
-width => $Hello_Width,
-height => $Hello_Height - 100,
-readonly => 1,
-align => center,
);
 
$Hello_Window->Show();
 
Win32::GUI::Dialog();
 
sub Window_Terminate {
-1;
}
 
 
-Original Message-
From: Ounsted, Toby [mailto:[EMAIL PROTECTED]
Sent: 14 October 2003 12:40
To: Perl-Win32-Gui-Users (E-mail)
Subject: [perl-win32-gui-users] PRoblems formatting text box
 
Hi all,
 
I'm trying to generate a text box within a window.
 
$Countdown_Window->AddTextfield(
-name => "Countdown_Text",
-font => $font,
-foreground => [0,255,0],
-background => [0,0,255],
-multiline => 1,
-text => $Message,
-left   => 0,
-top=> 0,
-width => $Countdown_Width,
-height => $Countdown_Height - 100,
-readonly => 1,
#  -align => center,
);
 
 
Simple problem; when I comment out the 'align =>...'  statement then the
text appears green on blue as per the prescribed colours.  When I apply the
'align => center' statement then the text is center aligned but comes out
black on grey (system colours).  Does anyone know why the align is affecting
the colour and what can be done to fix it?
 
Versions:
Win32::GUI 0.0.558
Perl v5.8.0
 
 
Many thanks in advance,
 
Toby.
 
 
 
 


RE: [perl-win32-gui-users] Outlook - list all folders

2003-10-17 Thread Howard, Steven (US - Tulsa)
I used something like this in a project I started a couple of years ago.
I'll post the script so you can see what it looks like, but it has been a
long time since I have even looked at this script. I know it works, and it
does get the folders on some levels, and you can see that. Some of the loops
and prints are in there just because I was learning when I wrote this, and
needed to see what was being returned.
 
This was the beginning of a little project to consolidate the data on when
people were scheduled to be out of the office. It has some stuff I was doing
to learn to navigate through the folders, and it navigates to a calendar
object on our network, pulls relevant data, and puts it into Excel. I'd take
out everything but the stuff you were asking for if I had a little time to
spend on it, but as it is, I think you can see what I am doing, and get the
information you need from it.
 
Let me know if you have further questions after you get a chance to look at
this, and I'll see what I can do to help.
 
Hope this helps,
 
Steve H.
 
 

use Win32;
use Win32::OLE;
use Win32::OLE::Const 'Microsoft Outlook';
use Win32::OLE::NLS qw( :DATE :LOCALE );
use BitWise qw(RGB);# this is my module. You
probably need to remove all references to RGB
# or to BitWise.

*Error = *Win32::OLE::LastError;  # Create a shortcut because I'm a
lazy typist.

# open an outlook object:
my $otl = Win32::OLE->new('Outlook.Application');
# create a session:
my $sess = $otl->Session();

# print the total number of Folders to search:
print "Folders on this level: " . $sess->Folders->Count();
my $totalFolders = $sess->Folders->Count();

foreach (1 .. $totalFolders)
{
   # print each key and value for each folder on this level:
   print "$_ is " . $sess->Folders(1)->{$_}. "\n" foreach sort keys
%{$sess->Folders(1)};
   print "\n\n\n\n";
}

# all work below this point is work I was actually doing to pull items from
a spreadsheet
# and put them in an Excel spreadsheet.

my $cal = $sess->Folders('Public Folders')->Folders('All Public
Folders')->Folders('National Practices');
$cal =
$cal->Folders('Americas')->Folders('US')->Folders('Clusters')->Folders('Mid
America')->Folders('Calendars');
$cal = $cal->Folders('US TULSA DTO IT DEPT');
#outkeys ($cal);

print "\nItems:\n";
my $item = $cal->Items(304);
#outkeys ($item);

# now get an Excel object and input the info;

my $xl = Win32::OLE->new('Excel.Application');
$xl->{Visible} = 1;
my $book = $xl->WorkBooks->Add();
my $sheet = $book->Worksheets(1);
my $row = 2;
$sheet->Columns('A')->{ColumnWidth} = 30;
$sheet->Columns('B:C')->{ColumnWidth} = 15;
$sheet->Columns('D')->{ColumnWidth} = 80;
$sheet->Range("A1:D1")->{Interior}->{Color} = RGB(0,0,0);
$sheet->Range("A1:D1")->{Font}->{Color} = RGB(255, 255, 255);
$sheet->Range("A1:D1")->{Font}->{Size} = 14;
$sheet->Range("A1:D1")->{Font}->{Bold} = 1;
$sheet->Range("A1")->{Value} = "SUBJECT";
$sheet->Range("B1")->{Value} = "BEGIN";
$sheet->Range("C1")->{Value} = "END";
$sheet->Range("D1")->{Value} = "BODY";

# lets see what is in the Start key - I am looking for a date and time.

foreach (1 .. $cal->{UnReadItemCount})
{
my $item = $cal->Items($_);
  #print $item->Subject() . "\t" if $item;
  $sheet->Range("A$row")->{Value} = $item->Subject();
my $start = $item->{Start};
#print $start->Date(DATE_LONGDATE) . " " . $start->Time() . "\t" if
$start;
  $sheet->Range("B$row")->{Value} = $start;#=
$start->Date(DATE_LONGDATE) . " " . $start->Time()  if $start;
  my $end = $item->{End};
  #print $end->Date(DATE_LONGDATE) . " " . $end->Time() . "\n" if $end;
  $sheet->Range("D$row")->{Value} = $item->Body();
  $sheet->Range(sprintf"C%d", $row++)->{Value} =
$end;#->Date(DATE_LONGDATE) . " " . $end->Time()  if $end;
}
#my $subject = $item->Subject();
#print $subject . "\n";
#my $iteration = 1;

#while ($cal->Items($iteration))
#{
#   print $cal->Items($iteration)->Subject() . "\n";
#   $iteration++;
#}








sub outkeys
{
   my $hashref = $_[0];
   print "$_ = $hashref->{$_}\n" foreach sort keys %{$hashref};
}
 
 
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Friday, October 17, 2003 7:37 AM
To: perl-win32-gui-users@lists.sourceforge.net
Subject: [perl-win32-gui-users] Outlook - list all folders
 
 
Does anyone have any examples of how to list all the folder names for a
particular Outlook profile? 
I'm looking at using Win32::OLE but can't figure out how to list ALL folder
names. 
Any help would be appreciated. 
Thanks! 

This e-mail may be privileged and/or confidential, and the sender does not
waive any related rights and obligations. Any distribution, use or copying
of this e-mail or the information it contains by other than an intended
recipient is unauthorized. If you received this e-mail in error, please
advise me (by return e-mai

Re: [perl-win32-gui-users] Problems formatting text box - Favour! !

2003-10-17 Thread Aldo Calpini
Ounsted, Toby wrote:
> Hi,
>
> Would someone be able to test the below and confirm whether it's just me?
> Specifically I can't get coloured text if the 'align'  is in place for the
> text field, but commented out the colours come back.  What am I doing
> wrong?!

Toby,
it doesn't show this behaviour for me. the colors are always correct.
but nonetheless:
 -align => center,
should be:
 -align => "center",


hope this helps.

cheers,
Aldo

__END__
$_=q,just perl,,s, , another ,,s,$, hacker,,print;




RE: [perl-win32-gui-users] Outlook - list all folders

2003-10-17 Thread Ounsted, Toby
Adapted from a similar script by Rob Hanson on perl-win32-users - hope this
helps.
 
use strict;
use Win32::OLE;
 
# use existing instance if Outlook is already running, or launch a new one
my $ol;
eval {$ol = Win32::OLE->GetActiveObject('Outlook.Application')};
die "Outlook not installed" if $@;
unless (defined $ol) {
  $ol = Win32::OLE->new('Outlook.Application', sub {$_[0]->Quit;})
or die "Oops, cannot start Outlook";
}
 
my $mailbox = seekFolder($ol->Session, 'Mailbox - Doe, John');
 
listFolders($mailbox);
 
sub seekFolder {
  my $obj = shift;
  my $target = shift;
 
  for (my $i = 1; $i <= $obj->Folders->Count; $i++) {
if ( $obj->Folders->Item($i)->Name eq $target ) {
  return $obj->Folders->Item($i);
}
  }
}
 
 
sub listFolders {
my $parent = shift;
for (my $t = 1; $t <=$parent->Folders->Count;$t++){
print $t . ": " . $parent->Folders->Item($t)->Name . "\n";
}
}
 
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: 17 October 2003 13:37
To: perl-win32-gui-users@lists.sourceforge.net
Subject: [perl-win32-gui-users] Outlook - list all folders
 
 
Does anyone have any examples of how to list all the folder names for a
particular Outlook profile? 
I'm looking at using Win32::OLE but can't figure out how to list ALL folder
names. 
Any help would be appreciated. 
Thanks! 

This e-mail may be privileged and/or confidential, and the sender does not
waive any related rights and obligations. Any distribution, use or copying
of this e-mail or the information it contains by other than an intended
recipient is unauthorized. If you received this e-mail in error, please
advise me (by return e-mail or otherwise) immediately. 

Ce courrier électronique est confidentiel et protégé. L'expéditeur ne
renonce pas aux droits et obligations qui s'y rapportent. Toute diffusion,
utilisation ou copie de ce message ou des renseignements qu'il contient par
une personne autre que le (les) destinataire(s) désigné(s) est interdite. Si
vous recevez ce courrier électronique par erreur, veuillez m'en aviser
immédiatement, par retour de courrier électronique ou par un autre moyen.





RE: [perl-win32-gui-users] Outlook - list all folders

2003-10-17 Thread Jeremy Blonde
I had serious issues using Win32::OLE to access Outlook.  Memory usage was 
outrageous.  I found the CDO library to be much easier to use and much lighter 
on the resources.  It's been a while since I've dug into it, but I believe it 
has the ability to access any folder within Outlook, either based on an already 
existing Outlook instance, or by creating it's own.  You have to change the 
threading model in the registry (under MAPI.Session) to be "Apartment" I 
believe, otherwise the CDO library doesn't work correctly (although this may 
have been specific to the version I was using).
 
The code below is snippets from my script, it won't work as is.
 
Jeremy Blonde
 
 
Win32::OLE->Initialize(Win32::OLE::COINIT_OLEINITIALIZE);
#$Win32::OLE::Warn = 0;
my($SESSION) = Win32::OLE->new('MAPI.Session'); # Session Object
 
my($profile) = "$server\n"."$MAILBOX";
 
my($session, $profile) = @_;
# Logon using the specified $profile
print "Logging on...";
 
${$session}->Logon("","",0,1,0,0,${$profile});
 
my $infostore = ${$session}->GetInfoStore();
if (!$infostore) {
  print "unsuccessful!\n";
  Logoff(\${$session});
  return;
}
  
print "  Scanning $infostore->{Name}\n";
# Get the RootFolder
${$rootfolder} = $infostore->RootFolder();

# Get the folders collection
my($folders) = ${$parent}->Folders();  

# Get the first folder in the collection
my($folder) = $folders->GetFirst();   

while ($folder) {
  # Skip the Journal since it doesn't hold attachments
  if ($folder->{Name} eq "Journal") {
$folder = $folders->GetNext();
next;
  }
 
my($folderName) = $folder->{Name};
 
# Recurse through any sub-folders
if ($folder->Folders->Count()) {
   Scan_Folder(\$folder);
}

# Scan through the e-mail messages in the folder
if ($folder->Messages->Count()) {
  print "  Scanning: $folderName...\n";   
  Scan_Messages(\$folder);
}
 
Thanks,
Jeremy Blonde 
Network Technician 
Davis Joint Unified School District 
530.757.5300 ext. 117 
-Original Message-
From: Ounsted, Toby [mailto:[EMAIL PROTECTED]
Sent: Friday, October 17, 2003 7:19 AM
To: '[EMAIL PROTECTED]'
Cc: Perl-Win32-Gui-Users (E-mail)
Subject: RE: [perl-win32-gui-users] Outlook - list all folders


Adapted from a similar script by Rob Hanson on perl-win32-users - hope this 
helps.
 
use strict;
use Win32::OLE;
 
# use existing instance if Outlook is already running, or launch a new one
my $ol;
eval {$ol = Win32::OLE->GetActiveObject('Outlook.Application')};
die "Outlook not installed" if $@;
unless (defined $ol) {
  $ol = Win32::OLE->new('Outlook.Application', sub {$_[0]->Quit;})
or die "Oops, cannot start Outlook";
}
 
my $mailbox = seekFolder($ol->Session, 'Mailbox - Doe, John');
 
listFolders($mailbox);
 
sub seekFolder {
  my $obj = shift;
  my $target = shift;
 
  for (my $i = 1; $i <= $obj->Folders->Count; $i++) {
if ( $obj->Folders->Item($i)->Name eq $target ) {
  return $obj->Folders->Item($i);
}
  }
}
 
 
sub listFolders {
my $parent = shift;
for (my $t = 1; $t <=$parent->Folders->Count;$t++){
print $t . ": " . $parent->Folders->Item($t)->Name . "\n";
}
}
 
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: 17 October 2003 13:37
To: perl-win32-gui-users@lists.sourceforge.net
Subject: [perl-win32-gui-users] Outlook - list all folders
 
 
Does anyone have any examples of how to list all the folder names for a 
particular Outlook profile? 
I'm looking at using Win32::OLE but can't figure out how to list ALL folder 
names. 
Any help would be appreciated. 
Thanks! 

This e-mail may be privileged and/or confidential, and the sender does not 
waive any related rights and obligations. Any distribution, use or copying of 
this e-mail or the information it contains by other than an intended recipient 
is unauthorized. If you received this e-mail in error, please advise me (by 
return e-mail or otherwise) immediately. 

Ce courrier électronique est confidentiel et protégé. L'expéditeur ne renonce 
pas aux droits et obligations qui s'y rapportent. Toute diffusion, utilisation 
ou copie de ce message ou des renseignements qu'il contient par une personne 
autre que le (les) destinataire(s) désigné(s) est interdite. Si vous recevez ce 
courrier électronique par erreur, veuillez m'en aviser immédiatement, par 
retour de courrier électronique ou par un autre moyen.