Do you know where your variables are? PerlMonks

### Win32 Stuff

by vroom (Pope)
 on May 25, 2000 at 21:51 UTC Need Help??
RAR compressed archives batch extraction
on Jun 12, 2009 at 13:22 UTC
by nikosv
Open source software for batch extraction of RAR compressed archives. Handles password protected, multi-part and encrypted archives with ease. Portable, no installation required, no registry polluting, minimal memory footprint. Written entirely in Perl and gets its core functionality by interfacing with the unrar.dll dynamic library for Windows (http://www.rarlab.com/rar/UnRARDLL.exe) Unrar Extract and Recover
Corrupt MS Word 2007 Text Extractor
on Apr 03, 2009 at 16:58 UTC
by socrtwo
DOCX files are really zipped collections of XML and other binary files. The text in the docx files is contained in the word/document.xml file within the collections. Some basic formatting information is also contained in the word/_rels/document.xml.rels file. The code presented here uses a modification of the docx2txt script to extract text from corrupt Word 2007 files where Word 2007 and the original doc2txt fails to. It uses CakeCMD to unzip instead of Info-Zip found in the original docx2txt script, because CakeCMD will unzip corrupt xml files where Info-Zip fails or does not work as well. This script also uses Perl/Tk to make a GUI, with the aim of a wider audience. The Perl/Tk code was inspired by the easy great beginner tutorials by Binny V A here: http://www.geocities.com/binnyva/code/perl/perl_tk_tutorial/. CakeCMD is by Leung Yat Chun Joseph and can be found here: http://www.quickzip.org/softwares-cakecmd. It uses the open source ICSharpCode.SharpZipLib.dll library. Cake CMD also requires the Microsoft dotNet 2.0 framework here: http://tinyurl.com/8vgak. Docx2txt is by Sandeep Kumar and can be found starting here: http://docx2txt.sourceforge.net/. My real name is Paul Pruitt, my E-mail is socrtwo@s2services.com. My website containing a couple hundred links of data recovery resources is here: http://www.s2services.com. I built an executable for this package which can be found there too on the index page.
Perl wrapper for unrar.dll
on Mar 19, 2009 at 11:09 UTC
by nikosv
The unrar.dll library is written in C and provides functions for extracting/uncompressing rar archives. In the developer distribution there are code examples on interfacing with the library in many languages but not in Perl, so I wrote one which is going to be included in the development edition after Winrar 3.9 gets released. It offers an example of Perl interfacing with C libraries, mapping C structures to Perl structures, using raw pointers from Perl and how to use of Win32 low level API calls. To use it you need to : 1. have the Win32::API module installed 2. get unrar.dll from http://www.rarlab.com/rar/UnRARDLL.exe and place it inside your Windows\System32 directory 3.run it as : for listing the contents of the file : perl unrar_wrapper.pl L filename.rar for extracting contents of file : perl unrar_wrapper.pl X filename.rar Any suggestions/comments/corrections are welcome
on Mar 11, 2009 at 17:11 UTC
by VinsWorldcom
This started when a colleague asked for an easy way to get some values from the same cells out of 100+ Excel sheets and put them in a single Excel workbook, 1 row for each sheet's data.

Map drives and printers from Perl
on Jun 01, 2008 at 02:56 UTC
by thparkth
It's very easy to map a drive or a printer on your Windows workstation from Perl. This makes it very practical to write login scripts in Perl. I have not been able to find a pure-Perl method to check for the success of these operations. They always return success and no error variables are set.
on Jan 05, 2008 at 03:47 UTC
by blahblahblah
Last year I finally had to give up my plain-text mail client and start using outlook, and also lost my linux workstation. Transitioning to outlook wasn't as hard as I'd expected -- it has a lot of keyboard shortcuts -- but I missed the unix calendar program's daily mails. I threw together this quick script to email myself a daily calendar preview, and set it up in my task scheduler to run every morning.
perl-assoc 0.4
on Aug 16, 2006 at 22:17 UTC
by Maze
a simple listing script for associations on a win32 system like assoc for win 2000/XP - there is now some limited support for changing extensions but it's buggy, due to the way windows behaves to third party changing of the associations - that's purely cosmetic though however there is no creating or deleting of extensions: I think this might be a bug in the TieRegistry.pm because it doesn't seem to be able to create or delete key 'default' values could be used on win 9.x or others without assoc since 0.1 added options and help and rewrote to make clearer (thanks ikegami) but for some reason looking up a specific extension has been broken... at a loss here... since: 0.2 fixed bugs - albiet a little sloppily turns out looking up specific extension was just me using = instead of ==, *slaps forhead* since: 0.25 added functionality for changing (not deleting or creating) a single association and listing more than one extension, also a foil to bail when it tries to be executed in a non win32 enviroment since: 0.3 bugfixes, code cleanup (/F switch now applies to all output) applied deletion and creation #code according to TieRegistry documentation, doesn't seem to work though
perl-assoc 0.1
on Aug 16, 2006 at 20:29 UTC
by Maze
a simple listing script for associations on a win32 system like assoc for win 2000/XP except there isn't yet any functionality to change association Just list them...quite uselessly - just proof of concept
on Mar 01, 2006 at 02:51 UTC
by Anonymous Monk
A way to configure LimitLogin for 2003 Servers remotely through perl. Special Thanks to Toby Everett for the crash course in VBscript -> Perl Conversion.
Win32 Directory Sync/Briefcase
on Nov 08, 2005 at 23:56 UTC
by runrig
I needed a replacement for Windows "briefcase" directories, and only needed to sync from a remote directory to a local directory (never the other way as MS briefcases let you do). Should work recursively on sub-directories, but not very tested in that regard (update: I believe there is a bug in this regard when more than one level of sub-directory needs to be created, and no files exist in the higher level). Perl's file stat (and thus '-s' and '-M') are very slow over a VPN connection, so I needed to use the Windows API for getting that information. Also, a real MS briefcase uses a hidden database file which, if corrupted, trashes your briefcase...which I have been bitten by more than once. Thanks to ikegami and others for pointing me in the right direction.

Updated: Check for error when getting directory handle.

Updated: Check for error when reading directory.

Convert PowerPoint Presentation to Word Document with Win32::OLE
on Sep 14, 2005 at 19:31 UTC
by polypompholyx
I wrote this because I needed to convert a large number of presentations into lecture notes. The script does a fairly robust job of transferring pictures, tables, formatted text and titles from PowerPoint to Word. Although the code may be a little specific to the job I was doing, it's entirely done using OLE, and will be useful to anyone who would like to use Win32::OLE with PowerPoint, for which I have never found any sizeable online examples before. There are lots of handy comments too, so you can avoid all the pitfalls I fell into...
Copying files to an authenticated Win32 share
on Sep 13, 2005 at 09:54 UTC
by grinder

I need to transfer files from one Windows machine to another. I've always needed to one way or another, over the years, and have always hacked up fragile workarounds, usuall involving batch files, "RunAs" commands, shares using hard-coded drive letters and so on.

All the pieces are already bundled with the Perl distribution, it was just a question of putting them together. This code, then, lays down an approach to the problem in a Perl-only manner.

A "better" Putty keep-alive
on Aug 11, 2005 at 15:27 UTC
by diotalevi
When I leave my Putty sessions open overnight or even over lunch, they die from lack of activity. For whatever reason, putty's built in keep-alive isn't good enough. This program hangs around until you've been inactive for awhile and every minute frobs any open putty windows with control-g. That's just the key I liked, use your own if you like.
Win/Snare syslog message parser
on Jun 02, 2005 at 14:40 UTC
by bofh_of_oz

The result of a project i'm working on...

Win32 servers should send their event log messages to a central syslog server, and we are interested in receiving only errors and warnings. An Open Source tool Snare allows us to specify what messages we want to send out. However, the messages themselves carry too much information, so they need to be parsed, which is what that script is for.

The script needs syslog-ng to be installed on the receiving computer. The configuration options specific to this script are here:

destination database { program("/usr/bin/perl /usr/local/bin/sqllog.pl
+"); };

filter f_db { facility(local7) and level(err, warning); };

log { source(net); filter(f_db); destination(database); };
[download]

It all works this way: A Win32 server uses (properly configured) Snare to send syslog messages to a receiving server. The server runs syslog-ng (with above options included) and so redirects those syslog messages to the script. The script is parsing the message, breaks it down, logs into database, and sends out a notification email on error messages.

System usage monitor
on May 31, 2005 at 13:27 UTC
by bofh_of_oz
The script is monitorint the usage of CPU, memory, and hard drive (or rather, logical drives) on a Win32 computer.

When you run it for the first time, it gathers essential server data (hostname, logical drives, total memory) and uses it to populate the central logging database. After this is done, the script continues to run but now it updates the database with the actual usage data.

The HDD (or partition/logical drive) usage is collected daily since it does not change very often. The memory usage stats are updated every minute. The CPU usage is calculated as average for all processors on a computer. The CPU usage stats are collected every second; however, to reduce the number of update queries to database (and the network load as well), we store them internally and do a batch update once a minute.

Extract Lotus Notes Mail to HTML
on Apr 21, 2005 at 07:11 UTC
by Corion

This script extracts a Lotus Notes database into separate HTML files. As I only use the Lotus Notes R4.5 client, there are many deficiencies:

• The maximum message number is hardcoded
• Embedded graphics get lost
• Embedded formatting information gets lost

"Other than that", the information gets saved into an HTML::Template formatted file (see separate reply).

DumpArrayToExcel
on Mar 30, 2005 at 10:21 UTC
by aubell
In ActivePerl,It's easy to use OLE.Use my package ,It's more easy to Dump an array to Excel.Just say: use MyDump('Dump2Excel'); Dump2Excel([1,2,3,4,5,6,7,8,9,10]); No matter how long the array is.
Win32 SystemTimeToFileTime
on Jan 19, 2005 at 12:45 UTC
by ZlR

This is a perl 5.6 function that will do a SystemTimeToFileTime conversion, without using Win32::API.

The FileTime is an internal win32 date format described by microsoft as "a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 (UTC)" .

This function takes for argument a time in the form of a ($sec,$min,$hour,$mday,$mon,$year) list and returns the equivalent date in the Filetime format.

In my case this was usefull to write computed times into the registry, which allowed to control start and stop times of some windows functions and services . For this reason the result is a coma separated list which was expected by the registry. Join the result if you need the "raw" Fileformat

Note that this code works for Perl 5.6 , which Math::BigInt lacks proper hex conversion functions : thanks a lot to ysth for the 5.6 equivalent as the as_hex() . Also thanks to this post for the as_int :)

PDFLM
on Dec 14, 2004 at 20:29 UTC
by TStanley
After seeing brian_d_foy describe how he used PDF::Create and PDF::Labels to create some mailing labels, I decided to expand on his code a little bit, and wrap it in a Tk based gui.
Putty Session Generator
on Oct 21, 2004 at 16:10 UTC
by d_jabsd
This script will parse a config file and generate registry keys and shortcuts that you can add to your taskbar for easy access to saved putty sessions. Any and all comments/enhancements are welcome. I use this site extensively, so I figured its time I give something back. Although the script isn't perfect, it works well for me and can be easily modified to accomodate your personal setup. Enjoy.
Messager
on Sep 14, 2004 at 16:21 UTC
by TStanley
The Net::Send module wrapped with a simple Tk interface
on Jun 14, 2004 at 08:59 UTC
by dfaure

Using Win32::API, this module allows the user to use the Win32 ReadDirectoryChangesW API call in order to monitor events relating to files and directory trees.

See MSDN here for a complete description of the features.

Win32 Multiple Clipboards II
on Jun 06, 2004 at 18:41 UTC

Win32 Multiple Clipboards was implemented in a really silly way. I don't know how I missed the obvious. Here's a different implementation that eats a lot less memory, and doesn't use threads and sharing etc...

In fact, what I missed last time was the timer. And since there's no readable documentation for Win32::GUI I came across this by a combination of poking thourgh GUI.pm and luck. It worked out pretty well, and now I'm actually using this.

You will probably need Win32::GUI cause it's not with default ActiveState's installation, otherwise, this should work right out of the box.

Screenshot

Win32 Multiple Clipboards
on Apr 20, 2004 at 13:27 UTC

I love the idea of Klipper in KDE, and I always lack that functionality in Windows; you copy some text, move around to another application, select a new text to replace and accidentally hit Ctrl+C instead of Ctrl+V. So your old text is gone, and you have to find it back and copy again.

This is an attempt to make a small tray application to keep your latest 5 clipboard copies and let you choose one of them.

### Requirements:

• required perl 5.8.0 or higher.
• Win32::GUI.
• Problem: we cannot splice the array, so I'm deleting the array elements manually.

### Bugs:

• uses a lot of memory. Not recommended if you copy around huge amounts of data.
• Can only handle text.

I'm using ActivPerl 5.8.3 and run this with wperl clip.pl'' from a startup script. You will also need an icon of some sort.

Update: Screenshot

traymon.pl - Easily add a System Tray icon to an exisiting program
on Apr 04, 2004 at 06:18 UTC
by bbfu

Monitors another process, showing an icon in the system tray while the other process is running. This process can be an already active process (specified by PID), or can be a command to be launched by this program. Programs launched by traymon.pl do not have a console window, so it can be used to monitor them as background processes.

If you have some control over the program to be monitored, and can get it to set a named event, you can also include icon frames to animate the system tray icon while the event is set. This can be used to tell when the program is performing some special action, has received a connection from a user, etc.

You can also define a custom menu to be shown when the icon is right-clicked. The menu actions can be any valid Perl code, and a couple of convinience functions are predefined. The default menu consists of an 'Exit' option, that terminates the program being monitored (via kill 9).

system.pl
on Mar 28, 2004 at 19:50 UTC
by fxmakers
Allows you to retrieve all your hardware and OS configuration using WMI.
The information is saved to an ini file in order to parse data easily and reproduce a "phpSysInfo" script(works on Win2000/XP).
trouble using Image::Magick at Win32
on Jan 19, 2004 at 04:57 UTC
by chanio
After doing all the manual installation of the full .dll codes that let you use the application as a standalone one. And installing PerlMagick as the README file states, you should do some extra work that is not explained anywhere.

Shame because it is a great application, but I was fed up of having trouble with some Perl scripts not detecting the modules...

No code, just do the following:

* Copy Image-Magick.ppd and all the x86/ directory into c:\ (it is the only way of finding it-don't ask why) (see http://www.dylanbeattie.net/magick/other_os.html for any doubts)

* copy all the CORE*.dll files into c:\perl\bin

* copy all the IM*.dll files (from the Modules directory) into C:\imagemagick ! (even if you have the application working in another place)

* Add in apache httpd.conf the following line...

How to Start a Process in a Remote Win32 Machine using Perl and WMI
on Jan 12, 2004 at 11:05 UTC
by maa

I have often seen the wuation "how do I start a remote process on windows using Perl?" posted here. Personally, I use PSExec with a perl wrapper around it but that's not suitable for everyone.

This script is does the job (simply) using Win32::OLE and the native WMI (see MSDN for info).

For use in a corporate environment you should probably use Win32::EventLog to record what you did!

on Aug 26, 2003 at 14:45 UTC
by PodMaster
    perl tasklist.pl
...
smss.exe  --  Smss.exe (Microsoft)
Windows NT4/2000/XP only.á SMSS is the Session Manager SubSystem.á
SMSSÆs purpose is to start, manage, and delete user sessions (or
client sessions under Terminal Server).á Under Terminal Server the
management part includes dealing with the different subsystems (OS/2,
Win32, POSIX) which a client session may wish to run.
Recommendationá:á An integral part of the operating system, leave
alone.
...

See pod for more.

update: fixed minor bug. then i fixed another one ;)(if you already have a tasklist.storable, it's best to delete it)

Wild.pm
on Aug 15, 2003 at 14:01 UTC
by PhilHibbs
Globs filenames for Win32 Perl scripts
You need to set PERL5OPT=-MWild
Save it in your perl/lib directory
Tk Find In Files
on May 30, 2003 at 17:54 UTC
by msemtd
A graphical "find in files" or find -exec grep thingy for feature-poor Win32 systems. This was written as an exercise in the use of the grid layout manager and some neat Tk tricks such as most-recently-used lists stored in the registry. There are 3 files as it has been modularised - tkfif.pl fif.pm & MRUList.pm. Hmmm, I'm not sure how to post 3 files here! Anyhow, here it is...
Scan Win32 Machines in domain for P2P software
on May 21, 2003 at 11:21 UTC
by davis
More or less in response to Tracking Kazaa?, I built a quick-n-dirty script that searches machines' registries in the domain for common P2P software.
The initial idea was suggested by zengargoyle.
I'm sure there's a better way to search through the registry than this - suggestions welcome.
Thanks to benn for suggesting that I add other P2P software to the mix.
Update: The software now looks in the HKEY_LOCAL_MACHINE/Software key, and a couple more programs have been added.
Thanks to Marza for the suggestions below
Sqltest - A SQL password testing utility with Perl/Tk
on May 09, 2003 at 11:41 UTC
by perlsage

A small SQL password testing tool I wrote few years back, hope its some use to someone.

Features:
• generates a html report
• has Perl/Tk gui
• password(s), server(s) and/or userid(s) can be given in a file
Service monitor with Perl and PerlSvc
on Apr 17, 2003 at 11:25 UTC
by perlsage
A simple service monitor using Perl and PerlSvc, reads settings from registry, monitors services.

Features:
• windows service.
• error reporting to windows eventlog.
• service status reporting to database using ODBC
Suggestions for improvements are welcome, my first post <:)
on Mar 10, 2003 at 15:46 UTC
by jds
After some discussion on how to do this, here is a small script to programmatically change the Dial-In status of a user in Active Directory (this is the 'Remote Access Permission' on the 'Dial-In' tab from AD Users & Computers). You would of course enumerate a group or have some other list of users in order to make mass changes. Also, despite earlier problems I have had, OLE is now my friend!
on Mar 04, 2003 at 14:08 UTC
by jds
This is an account creation script specifically aimed at Active Directory. It is obviously very specific to our environment, but makes use of some concepts that may be useful to others.
Viewing network shares
on Feb 26, 2003 at 11:57 UTC
by Hyler

I was asked to have a look at security issues for a group of Windows computers, and one of the things I thought about was shared directories. Which directories are visible? I could click away in the network browser but that would be tiresome. Why not practically extract and report it in some language? I work mostly with Windows, and play around sometimes with ActivePerl (5.8.0). There is the package Win32::NetResource available, let's have a look at it... And already in the documentation is what I want; "Enumerating all resources on a particular host".

Usage: Give computername(s) as arguments to script. If no arguments given, it uses computernames hardcoded into the script.

I adjust it somewhat, to go over an array of computer names to check, and write it to a text file. Hmm, why not display it more nicely? use Tk;

A hierarchical listing (HList) would be nice. Could also use a Tree.

Oops, a gotcha. The script barfs if a sharename contains periods (.), since period (.) is the default separator in the entrypath for a Tk::HList and Tk::Tree. The solution was to configure the HList to use something else as a separator. A forward slash (/) would be good, since a / would/could not be used in a sharename. See also the $hlist->add in the inner foreach loop where the children are added. Wouldn't it be nice to make it more visible which is what? The computername looking different from the sharename? This I wrestled with for a while. I didn't want to make the whole HList bold, only the toplevel nodes. Look, look, look, browse, browse, browse. Tk::ItemStyle to the rescue! The trick was to 1. Create a font ($boldfont) with the weight bold
2. Create a style ($boldstyle) which uses the bold font 3. For the widgets where I want it, apply the -style. By wrapping the HList in Scrolled, scrollbars will appear if necessary. To make it more readable, do the rest of the settings with a -configure for the widget. When I'd removed all comments, notes, tests and "debugging" prints, I was impressed and almost disappointed that the script was only thirty-odd lines. I decided to post it here at Perlmonks as an example (hints) for Win32::NetResource and Perl/Tk. Now that this is working, I'm thinking of expanding it to display the permissions for the shares (NetShareGetInfo), maybe also flag if the permissions are Everyone-Full Control. Program Archiver on Oct 29, 2002 at 18:00 UTC by Three Archive.pl is an ini driven archive program that takes programs in a current directory and archives them. I wrote this to get rid of manual archiving of files. I use pkzip25 but change it to what ever you need. To learn how to use this program do archive.pl -help To set up your archive directory use archive.pl -make It asks for archive source, destination, and many other options see help. It then creates the destination and puts a directory with the format of YyyyyMmm. Then it zips up the directory and puts in the the above folder with the format of DddHhhmi.zip This program tracks the following. • Monthly history of change in history.txt in the year month directory • Inside the zip it has a archive.txt with the changes in the current zip since the zip before. BTW: I don't think this would be too hard to port to UNIX. rmpriv.pl on Oct 08, 2002 at 21:48 UTC by Iron-Jeff Deletes view-private files from a ClearCase view in Windows. It should work in UNIX, too, but I think the Win32 category fits better because on unix you could simply do: cleartool lspriv -s -oth | xargs rm -rf Win32::ole and MSWord on Sep 15, 2002 at 15:48 UTC by Kenny Using perl, of course, launch MSWord and build a complex word document. This shows off how to do page setup, headers and footers, insert text, insertsymbol, add a table, put text in the table. I think this is a great example if you just want to get going. Find Home directories without User Accounts (NT4 and AD) on Sep 11, 2002 at 15:48 UTC by OzzyOsbourne Compares directories on the servers against who is using them in user manager. If no one claims the directory as a home directory in user manager, it is dubbed an orphan and printed to orphans.txt. An e-mail is sent to when the script is complete. This will Get NT4 accounts, or Active Directory (AD) Accounts. Win32::OLE Outlook and E-mail security update on Jul 27, 2002 at 16:30 UTC by Anonymous Monk The Outlook E-mail Security Update provides additional levels of protection against malicious e-mail messages. The update changes the way that Outlook can be controlled programmatically (Microsoft knowledgebase Q262701). Sending mail and accessing the Adress book display a dialog box asking you to confirm the action Dmitry Streblechenko at http://www.dimastr.com as released Redemption (http://www.dimastr.com/redemption/), an OLE object that works around limitations imposed by the Outlook Security Patch. Here is an example of using Redemption with Perl for sending e-mails : editd on Jul 26, 2002 at 22:29 UTC by tye Works like pushd and popd but brings up an editor with the stack of directories and lets you edit them. I have vi.bat that does "start c:\path\to\vim\gvim %*" so I can just type "vi file" at the command prompt and not have it wait for gvim to exit. I also have vim.bat which doesn't include "start" (just "c:\path\to\vim\gvim %*") so I can do SET VISUAL=vim and editd.bat will use vi to let me edit the directory stack. In fact, I call it vid.bat on my computers. This probably requires WinNT/Win2K. (code) Win32 disk monitor, email notify, event log on Jul 16, 2002 at 00:38 UTC by ybiC Check free disk space on a Win32 localhost. Automatically detects and checks all fixed disk drives (hard disks or partitions with assigned drive letters). Optional email notification on alarum and Event Log entry on program run. Intended to run as a periodically scheduled task. Clearly not a replacement for expensive commercial monitoring packages, but potentially beneficial for small business with a single Win32 file/print server. If you spot any signs of PERL-ly code here and let me know, I'll make sure to mention your help here and in pod credits Props to thunders for join() tip, Kanji for spotting 0-bytes-free bug, and to fsn for mondo SMTP info/tips/help, Email alarum looks something like this: Envelope-to: pastor@church.org To: pastor@church.org From: wdf.pl@myserver Subject: ALERT - MYSERVER DISK SPACE GETTING LOW Date: Mon, 15 Jul 2002 20:01:04 -0500 This message was automatically generated by the wdf.pl program. pastor@church.org officemgr@church.org MYSERVER D:\ less than 30% free space C:\ 57 percent used 43 percent free 5,132,570,624 bytes total 2,909,786,112 bytes used 2,222,784,512 bytes free D:\ 80 percent used 20 percent free 20,412,596,224 bytes total 16,364,945,408 bytes used 4,047,650,816 bytes free  Update: Squashed Bugs: no-alarum-on-0-bytes-free, non-functional email option New Features: Event Logging, argument for nearby SMTP server Simple script to change win32 wallpaper on Jul 12, 2002 at 01:54 UTC by bbfu Simple script to change the MS Windows wallpaper from the command-line. Really just a wrapper around the SetSystemParametersInfo() API call, via Win32::API. I'm using it as part of another small app. I'm writing (for my GF) to pick random papers. :) A killall for Windows on Jun 04, 2002 at 13:55 UTC by Dog and Pony Plain and simple, it is a variant of the killall script that can be found on some *NIX flavours - basically, you give it one or several names of processes (like 'calc', 'wordpad' or whatever has gone south atm), and it kills them. (No, it is no exact clone). I have only had the possibility to try this out on Windows 2000, so i don't know if it will work on other flavours. I kinda suspect that it relies a bit on features that is NT only, which would mean NT, 2k and XP. So feedback is appreciated. :) "Why not use the taskmanager?", I hear you ask. Because when something has gone really bad (lots of CPU), it is a pain to bring it up, scroll the list and try to click on and kill the process gone bad. In at least my case I almost always have a few DOS windows up, and usually know the process gone bad. Or one could type it in the Run menu too, more easy at least. And, of course there are plenty other uses if one rips the code and modifys it. :) nt2ldap on May 21, 2002 at 14:07 UTC by ZinMostaccho With a user of windows NT, determine data information the server LDAP. Crond on May 21, 2002 at 12:57 UTC by zeroquo A Crond service, like Crond of Unix systems. its interpreted the crontab file. Enjoy ! Flexcopy on May 21, 2002 at 12:48 UTC by zeroquo Flexcopy is a Cluster Service Script, for replicate a simple directory content to 2 recipient, enabling cascade arquitecture on network down. if_info.pl on May 17, 2002 at 12:02 UTC by dada this script exploits some system APIs to emulate Unix's ifconfig -a on a Win32 machine. should work for Windoze versions 98 and later or NT SP4 and later (2000/XP/...). it's all fair to me except that the operational status seems to always report UNREACHABLE. go figure... this was already posted in reply to List all network interfaces on the local machine?, but I think it deserves a mention in the Code Catacomb (sorry for the duplication :-). Me in a loop with Win32::Clipboard on Apr 07, 2002 at 16:42 UTC by Rudif I wanted to convert a large number (several hundred) of strings from mixed case to upper case. Strings were accessible one at a time, through a dialog belonging to a particular application. So, I sat down to do the work:  repeat open the dialog on next item retype string in uppercase [download] Ugh. Retyping was the longest and most error-prone part of the operation. And easiest to mechanize, if I could hook Perl into my loop. I remembered Win32::Clipboard and quickly whipped up this script, ucclip.pl. Now the slog became bearable (almost pleasant, in a cyborg sort of way):  start the script repeat open the dialog on next item copy string to clipboard (select, ^C) - script uppercases it paste back into the dialog (^V) [download] Deleting Microsoft's hidden web caches created by IE5 on Feb 15, 2002 at 05:09 UTC by cLive ;-) Finds and removes those nasty "index.dat" files that IE hide on your Windows machine. For more information, see this article. perlcaller.pl on Jan 21, 2002 at 17:20 UTC by DaveRoberts This script is intended to be called by sysmon.pl - and manages the log file associated with this service. sysmon.pl on Jan 21, 2002 at 17:17 UTC by DaveRoberts This script controls the System Monitoring Service (SysMon). SysMon is an NT service that executes various perl scripts and command files using a non-deterministic schedule. SysMon allows scripts to be added and removed as it executes, and creates a log of each scripts execution, as well as a history of previous executions. I use this to distribute scripts to, and to manage, around 30 NT based servers on a relativly thin network. see POD for more info. Note that this script requires the perlcaller script to operate succesfully.... ppminst.pl on Jan 21, 2002 at 16:41 UTC by DaveRoberts This script is used to install and update a number of perl packages using the Perl Package Manager (PPM). The perl packages to be managed, and their repositaries, are defined within the script. When executed the script will report on the status of packages, and attempt to install any that are missing. If any packages have already been installed using the PPM a check will be made and these updated if a later revision is available. Packages not installed by PPM will not be upgraded. The script is useful for ensuring several perl installations have a base set of modules installed. Refresh ActivePerl Documentation (New Windows Help Format) on Dec 21, 2001 at 21:31 UTC by$code or die

As JMD noted in ActiveState Perl build 630, the latest versions of Active Perl no longer install the HTML document set that they used to. It is now bundled with a compiled Windows Help file that is not updated when you install a module with PPM.

There has also been discussion and criticism of this change in the ActiveState mailing lists. One solution is to install the ActivePerl HTML documents with "PPM install ActivePerl-HTML" While this restores the old functionality, one might miss the searchable index that the new help format provides.

This script combines both methods. It will update the compiled Windows Help File with the changes made to the old HTML documents.

It requires Microsoft's HTML Help Workshop, and it requires you to install ActivePerl-HTML with PPM.

Running this script should scan your ActivePerl HTML folder and create a new Windows Help file. Since the compilation of the help file takes 2-3 minutes, I have not written this as a PPM extension, but rather a standalone script to synchronise the documentation periodically.

To run the script, install ActivePerl-HTML, the MS HTML Help Workshop, and make sure that $HTML_Compiler matches the path to HHC.exe. There are some crufty bits of code that I will remove soon, but it works. Note: the Help compiler will report several errors. Those errors are within the html documents themselves rather than the project files we write to compile the help file. It should be safe to ignore those errors, unless you want to clean up the module documentation. Extracting memos from an Outlook Inbox on Dec 21, 2001 at 19:39 UTC by grinder Someone in the chatter box asked whether anybody had any Perl code to deal with Outlook on Windows. I used Outlook at my previous job, and when I left I wrote the following code to extract all the messages and dump them out into files. The code is rather exploratory and not really well-written. For a start, it consumes a horrendous amount of RAM, directly proportional to the size of your Inbox (because in instantiates all the objects in an array that unfortunately is not evaluated lazily). A lot of the magic numbers come from MSDN documentation, but the accompanying notes I wrote at the time appear to have drifted away. Oh well, it's a starting point. Win32-API-Guid on Dec 21, 2001 at 02:51 UTC by Rudif If you are Windoze COM programmer, you may find use for this guid generator, perhaps when you clone an existing MSVC project and you need to change the guids therein. Requires Win32-API. Update: generate() now returns one guid in scalar context, array of one or more guids in array context. Update 2: Thank you$code or die for pointing out the GuidGen() function in libwin32-018.
I just installed ActivePerl build 630 and tried GuidGen() - after some searching. I could not find it mentioned in the new chm documentation. Attempt to call Win32::GuidGen() as you suggested produces an error "Undefined subroutine &Win32::GuidGen called at ...". Text search for GuidGen in C:\Perl produced a few examples of calls via package Win32::Resource, which does not seem to be documented either, but following these examples worked for me:

#!perl -w
use strict;
#my $guid = Win32::GuidGen(); #Undefined subroutine &Win32::GuidGen called at Noname1.pl line 3. use Win32::Resource; my$guid2 = Win32::Resource::GuidGen();

print "$guid2\n"; __END__ {A8D7B8DA-1AA8-4575-A51F-8EA05E93D032} [download] However, Win32::Resource::GuidGen() does not seem to support an optional argument for generating a list of several guids at a time. 'h' - a Win32 command-line history on Nov 11, 2001 at 17:53 UTC by osfameron A command line history recall for Win32. Tries to emulate some of the functionality of Unix versions. I'm quite pleased with the use of Win32::Console to emulate Term::Readline's (non-functional) addhistory method. (but happy to get suggestions of better ways to do this!!) Note: If this can be done better, safer etc. please let me know - I will welcome review, criticism etc.! Update: Replaced the batch wrapper (which is redundant since I'm just writing to STDIN...). On the other hand, this also means that we lose the ability to recall a numbered item. hmmm. Win32: Shell extension for viewing POD (proof of concept) on Oct 31, 2001 at 16:06 UTC by osfameron We had an interesting chat about Shell extensions in WinNT in the Thread "Windows Drag and Drop". I think that viewing POD from the Explorer window would be a useful use of Windows Shell extensions. So this code is a) a wrapper around pod2html, and b) some instructions on how to create the Shell extensions. As per Drag and Drop thread, I'd appreciate any clarification from a WinNT guru, but it works for me. Proof of concept: please note all warnings in documentation Update:v 0.002: Added an option to create a hyperlink to the source code the POD is taken from. You can switch this off by setting constant SOURCE=>0 Wild - Perl extension for improved program interface. Wild-card expansion for @ARGV. on Sep 27, 2001 at 22:37 UTC by hsmyers Will handle DOS-style wild-card expansion of '*' and '?'. Additionally it introduces '@', '!', and '~' as filename prefixes with the following effects: '@' -- treat each line of the file as though it were a command line, '!' -- directory recursion operator, '~' -- exclusion operator creates an exclusionary list, a sort of negative @ARGV. As a last step in WildARGV(), the union of the two is removed from @ARGV. '!' forces lookups to be recursive. SysEnvAdd.pl on Jul 19, 2001 at 19:52 UTC by RayRay459 This program will add a System Environment Variable. It will require a reboot to take effect. CD-RW or Zip disk backup program on Jun 20, 2001 at 02:36 UTC by bikeNomad This is a backup script suitable for running from a scheduler or interactively. It backs up one or more directory trees to a removable disk (CD-RW, Zip, floppy) or to a directory, perhaps on a network. You can specify files to include or exclude, as well as the destination, handling of deleted files, and size quotas using a configuration file. It will prompt the user to insert a disk if necessary; otherwise, it's not interactive. Win32 only (had to make it for my girlfriend's computer). update: added support for wildcards in includes and excludes. Compare Directories/Permissions across all servers on Mar 23, 2001 at 22:16 UTC by OzzyOsbourne Uses File::Find and Win32::FileSecurity to dump file permissions to a text file on shares that you specify. Usage code.pl {share} {outputlog} Output:server(tab)share(tab)account(tab)permission1(tab)permission2(tab)...(enter) If the account does not have a permission, the script double tabs, for easy visual inspection. By importing the resultant tab-delimited log into a spreadsheet program, you can sort by account(colC), then share(colB), then server(colA), to very simply compare directory rights across your file and prints. Thanks to Tyke. bootlog.txt shrinker on Mar 09, 2001 at 00:59 UTC by dmckee Parses C:\bootlog.txt on Windows 98 machines to extract 'important' lines - ie: the ones where it's all gone wrong. Dead simple multi.pl on Mar 06, 2001 at 21:47 UTC by premchai21 A short script that simply takes a program and runs it with a few different sets of arguments. Extract Outlook Telephone Numbers on Mar 02, 2001 at 19:10 UTC by Corion This is a small example on how to use the MS Outlook object model from within Perl (under Win32 of course) to extract contacts data. If you have the Outlook object model chart at hand, it's easy to automate other tasks such as sending mail or creating contacs as well. This snippet needs Outlook to be open and the Contacts view must be active, because I was too lazy to drill my way down from Outlook->Application to the Contacts view. Update:I added the missing <code> tags myself. Even more stupid I am ... Update 2:Some documentation - the 069 is my local area code. XEmacs printing script on Feb 10, 2001 at 04:06 UTC by macguges Got XEmacs? Got Windows NT (or its evil twin, Windows 2000?) Got a line printer daemon (somewhere, lurking near a printer)? Then this script is for you. Explore the wonders of printing from your favorite editor, even under Windows. (Cygwin environment may be necessary, and is a nifty idea anyway. Your lpd's IP & printer queue name may differ.) Auto prepare code for production on Jan 24, 2001 at 22:44 UTC by Ovid We had a situation at work where programs running in our test environment behave differently than programs in our production environment. Specifically, when copying programs to our production environment, we wanted to automatically comment out use warnings, debugging code, or anything else that was merely being used for development. To use this code, append a "#//" at the end of every line that should not be in production. If you have a block of code that shouldn't be in production, wrap the code in #/* and #*/ tags. Then, run this code, specifying source and destination directories, and it will automatically comment out the appropriate code. It will skip itself and all programs that do not end with the extensions in$extensions

Further, it can process files that you specify, all files in the current directory, all directories or subdirectories, make the target directory if it doesn't exist, and more. It needs some work, but it's fairly flexible.

It uses some Windows specific code, but I'm sure it can easily be ported to a *nix environment.

on Dec 02, 2000 at 00:02 UTC
by nop
This is a small wrapper around Spreadsheet::WriteExcel. It lets you quickly open a workbook, and spit data into it by row by column (analogous to writing a tab delim text file, or using write and writeln in Pascal). Sometimes it is easier to think of generating a report by row by column, rather than popping all around the sheet.

The package also supports multiple tabs (sheets) nicely, setting them up automatically the first time a new tab is referenced. The package also supports common formats, and allows you to create "metaformats" (ala cascading style sheets).

Here's a example that shows the module in action:
use strict;
use warnings;
use diagnostics;

use Excel;

my $excel = Excel->new("test_excel1.xls");$excel->writeln('tab1', "Header");
$excel->writeln('tab1');$excel->writeln('tab1', qw(1 3 4 5 6));
$excel->writeln('tab1', qw(A B C D E F));$excel->writeln('tab1');
$excel->writeln('tab1', qw(1.1 1000 101011.33 -14 -14.555 .000001));$excel->writeln('tab1', map {[$_, 'money']} qw(1.1 1000 101011.33 -14 +-14.555 .000001));$excel->writeln('tab1', map {[$_, 'bigmoney']} qw(1.1 1000 101011.33 - +14 -14.555 .000001));$excel->writeln('tab1', map {[$_, 'pct']} qw(1.1 1000 101011.33 -14 -1 +4.555 .000001));$excel->writeln('tab1', "VErrry long striiiiiiiiiiiiiiiiiiiiiiiiiiing"
+);

$excel->writeln('tab1', ['hello', 'bold'], [.003, 'pct','bold']); foreach (qw(1 2 3 4 5)) {$excel->write('tab2', [$_, 'money', 'bold']); }$excel->writeln('tab2', 'hello', [.003, 'pct','bold'], 'goodbye', 9999
+9999999999);

foreach (qw(red blue yellow green orange)) {
$excel->writeln('tab3', 'hello', [$_, $_, 'bold']); }$excel->writeln('tab4', ['i am a header', 'header']);
$excel->writeln('tab4', ['i am a header', 'header', 'sumline']);$excel->writeln('tab4', ['i am a header', 'header', 'size20']);
[download]
on Nov 02, 2000 at 18:38 UTC
by $code or die Repost - I thought that the code tags would be added automatically because the box below is expecting code! My mistake. A example script to use SecureTrading in Perl on Win32 systems. SecureTrading does online credit card authorization. The perl scripts on their site only run on *nix systems. They didn't reply to my offer of them putting this example on their website :( It uses Win32::OLE, so you will need to download the ASP COM object from securetrading.com for this script to work. Before you flame me - I don't work for securetrading and this is NOT an advert :-). I worked ALL last night getting this to work because I refused to use ASP instead of Perl, and I had no option about the platform unfortunately. Win32::SystemInfo on Sep 07, 2000 at 20:21 UTC by Guildenstern Updated version of my Win32::MemoryInfo that returns information on available/installed RAM/page file. Now renamed SystemInfo, this module also returns Processor info for Windows9x, Windows NT and Windows 2000. This has not been tested on very many processor/OS variations, so any feedback/bugs will be appreciated. Includes POD Win32::MemoryInfo on Aug 31, 2000 at 01:19 UTC by Guildenstern Memory information for Win32. Total and available physical, page, and virtual memory. This is my first ever module, so any constructive criticism will be eagerly welcomed! Update (1 Sept 00): Completely reworked the after tye's comments. This module is very different from the original. This module has been superceded by Win32::SystemInfo. Win32/Outlook Mail Forwarder on Aug 24, 2000 at 23:50 UTC by Guildenstern Forwards email messages saved to text from MS Outlook (requires 3rd party DLL, unfortunately) to my web phone so I can be in touch when out of cube. Win32SnapWalk on Jul 10, 2000 at 17:16 UTC by t0mas A package to list the currently running processes on a Win32 box. It uses Win32::API. winsane.pl on Jul 02, 2000 at 19:47 UTC by Intrepid I have updated this code today (22 July, 2000) This lib is an overkill approach to dealing with vagaries of paths on Win32. Please see the POD below the code itself, it explains it more clearly (I think) than the previous lengthy description did. OS.pl on Jun 28, 2000 at 21:37 UTC by Intrepid A work-around for the absence of a defined value in the built-in special variable$^O (platform, Operating System) in some Perls on Win 95/98. In present form, simply determines if the platform is Win32 or not. The usual `require "OS.pl";' statement is all that's needed.
Retrieve Win32 Executable Version information
on Jun 01, 2000 at 22:08 UTC
by Corion
versioninfo.pl - This small program reads the version information of a Win32 PE/COFF executable and dumps the embedded version string.
on Jun 15, 2000 at 23:18 UTC
by Hydro
This is a Perl script that makes use of the Win32:GUI module. Hopefully this will be a good example of the many features that can be used in GUI. This is the updated version of my finddata.pl program with comments added. I still haven't got the Stop button to work or been able to read the data based on an item of data that is clicked. You will need a data file named "datafile.txt" in the same directory and must run the program with a -t parameter like:

perl finddata.pl -t

The datafile needs to be in the format:

I would appreciate any insight.
finddata.pl
on May 31, 2000 at 20:45 UTC
by perlcgi
This cool utility is included as a mini-demonstation of
what is possible with Perl on Win32 using Win32::GUI.
This code, the associated database and bitmap may be downloaded from here
If anyone can figure out why the "Stop" button does not
work properly or how to read the individual items of each
column based on the index item clicked on then Jonathan would appreciate the input.
Also Jonathan will be happy to answer anybody's questions
about the code if he can.
"It was done on a trial and error basis ... definitely not written off the cuff and then worked properly.
It required some rewrites of course. ;] Anyway, have fun with the code and any experimenting you want to do on it."

Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (1)
As of 2021-10-16 02:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
My first memorable Perl project was:

Results (69 votes). Check out past polls.

Notices?