Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re^3: Activating a screen saver problems

by golux (Friar)
on May 28, 2012 at 04:07 UTC ( #972776=note: print w/replies, xml ) Need Help??

in reply to Re^2: Activating a screen saver problems
in thread Activating a screen saver problems

Hi palkia,

By "be in the screensaver directory", I only meant that you have to run my script from wherever the screensavers are located. In my case it's C:\WINNT\system32, in your case it's apparently C:\WINDOWS\system32. But since you're giving the whole path, that's fine too.

The #!/usr/bin/perl -w line is not as important in Windows as in Linux, although the -w is quite useful (it enables "warnings"). You can read about "warnings" and "strict" in the perllexwarn documentation.

I wrote a screensaver in Perl several years ago (haven't finished it though), and remembered there was a way to invoke a screensaver from the command line. A search quickly led me to the /s switch.

Good luck and much enjoyment with your continued path in Perl!

say  substr+lc crypt(qw $i3 SI$),4,5

Replies are listed 'Best First'.
Re^4: Activating a screen saver problems
by palkia (Scribe) on May 28, 2012 at 19:13 UTC
    I understood what you meant by "screensaver directory",
    I just don't understand why simply giving the entire path isn't good enough (why must be "in" the directory).
    But experimenting did show it's necessary to do it your way.
    Probably the '/s' part is wrongly interpreted as a directory deepening, do to the other / or \ in the path string.

    I'm guessing #!/usr/bin/perl -w is like "use warnings", I'll read about it later ^^.

    Thx again
      Hi palkia,

      Sorry if I was confusing; I didn't mean you had to be in the directory. I just did it that way myself because I was lazy, and wanted to experiment with running the screensaver in a command ("cmd") window (so I only had to type the screensaver name, not the full path). But giving the full path is fine, and doesn't seem to conflict with the /s switch when I do it this way (note the space before the /s switch):

      use strict; use warnings; system('C:/winnt/system32/sspipes.scr /s');

      And yes, the "-w" part of the "shebang" line, as it's called, is for warnings (again, look at perllexwarn). The rest of the first line is more germane to Linux systems, where it specifies the path (ie. directory) where Perl is located (ie. "/usr/bin/perl"). But on Windows you can safely remove the entire first line, and the script should still run.

      say  substr+lc crypt(qw $i3 SI$),4,5
        Got it.
        You are absolutely right, by adding the space before the /s,
        I'm no longer forced be in the directory itself, and can use the entire path instead.

        Thank you very much for taking the time to detail about such small things with large impact.
        Most appreciated.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://972776]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2017-04-25 00:20 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (447 votes). Check out past polls.