I coded up a quick script to display a computer's name on the screen. It works just as intended on my system running the script from the command line or or double clicking it from explorer after running it through pp. But when I put it on a different machine it doesn't seem to do anything, I suspect it is throwing an error but I just can't see it.The idea for this script is to have a quick command users here can just type into a windows search box ala "click start, type command, press enter" and have their computer's network name displayed.
If it helps here is the command line I used for pp.
"C:\Dwimperl\perl\site\bin\pp.bat" --output="C:\Dwimperl\perl\Script
+s\myName.exe" --gui --compress 6 --bundle "C:\Dwimperl\perl\Scripts\m
+yName.pl"
Anyone have any idea why this won't run as advertised?
#!/usr/bin/perl -w
use strict;
use Tk;
use Sys::Hostname;
my $hn = hostname;
my $mw = MainWindow->new();
$mw->overrideredirect(1);
$mw->Label(-text => "You Computer Name is: " . $/ . $hn,
-font => "Arial 16")->pack;
$mw->focusmodel('active');
Tk::after(10000, sub { $mw->destroy });
MainLoop();
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.