Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

/\/\o\/\/ script to watch directory with popup

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 10-16-2006   #1 (permalink)
Marco Shaw
Guest


 

/\/\o\/\/ script to watch directory with popup

Should this work with PSH RC2?

http://mow001.blogspot.com/2005/10/m...ith-popup.html

I just get a dump no matter what args I try:
PS C:\[removed]\Desktop> .\watchdir

GAC Version Location
--- ------- --------
True v2.0.50727
C:\WINDOWS\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll
True v2.0.50727
C:\WINDOWS\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.For...


PS C:\[removed]\Desktop>

Nothing else seems to happen... No errors returned...

Marco



My System SpecsSystem Spec
Old 10-16-2006   #2 (permalink)
dreeschkind
Guest


 

RE: /\/\o\/\/ script to watch directory with popup

This script defines a function. After the script scope ends, the function
won't be defined anymore.
You need to invoke it using the "." (dot-source it) from the PoSh prompt
like so:

PS> . C:\scripts\WatchDir.ps1

Once you did that, the function will stay defined at the interactive prompt.
You can then invoke the function:

PS> watch C:\scripts

Hope that helps.

--
greetings
dreeschkind

"Marco Shaw" wrote:

> Should this work with PSH RC2?
>
> http://mow001.blogspot.com/2005/10/m...ith-popup.html
>
> I just get a dump no matter what args I try:
> PS C:\[removed]\Desktop> .\watchdir
>
> GAC Version Location
> --- ------- --------
> True v2.0.50727
> C:\WINDOWS\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll
> True v2.0.50727
> C:\WINDOWS\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.For...
>
>
> PS C:\[removed]\Desktop>
>
> Nothing else seems to happen... No errors returned...
>
> Marco
>
>
>

My System SpecsSystem Spec
Old 10-16-2006   #3 (permalink)
Marco Shaw
Guest


 

Re: /\/\o\/\/ script to watch directory with popup


"dreeschkind" <dreeschkind@discussions.microsoft.com> wrote in message
news:97BD9B88-0852-4367-A560-E96E00394084@microsoft.com...
> This script defines a function. After the script scope ends, the function
> won't be defined anymore.
> You need to invoke it using the "." (dot-source it) from the PoSh prompt
> like so:


That did it.

Now, I assume "popup" isn't something used from within Windows, and I need
something to replace this "g:\monad\mow.ico" from the script so I get
something in my systray, and can exit?


My System SpecsSystem Spec
Old 10-16-2006   #4 (permalink)
dreeschkind
Guest


 

Re: /\/\o\/\/ script to watch directory with popup

"Marco Shaw" wrote:

> Now, I assume "popup" isn't something used from within Windows


Sorry, I don't understand what you mean.
The "popup" is called "BalloonTip" will appear in the Taskbar next to the
NotifyIcon.
See the line $NI.ShowBalloonTip(...) in mow's script.
This is done by using .NET classes: System.Windows.Forms.*

> and I need something to replace this "g:\monad\mow.ico" from the script so I get
> something in my systray, and can exit?


Yep, any Windows icon file should work.
I suppose by saying you can't exit means that the console stops responding
after calling the function. This is by design. ;-) You need to start a second
powershell console (or any other app) to modify the content of the directory
that is being watched. Once the watch function detected a change in that
directory (e.g. a new file) it will show the popup and write something to the
original console window. You can quit the directory watcher by using the
context menu of the NotifyIcon.
All this can of course be changed so you can trigger the popup when ever you
like.

--
greetings
dreeschkind
My System SpecsSystem Spec
Old 10-16-2006   #5 (permalink)
Marco Shaw
Guest


 

Re: /\/\o\/\/ script to watch directory with popup

Got it all working!

I want to extend this to notifying me when a web page changes. I'll need to
get a remote web page, then parse a section to determine if it has changed
since the last run. If there's a change, send a popup.

If the site had RSS, all of this wouldn't be required, but then again, I
wouldn't have a challenge...

Marco


My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
active directory / office username script Graham Turner VB Script 2 07-12-2008 09:04 PM
Help with Script to Create and Share User Directory Scott Townsend PowerShell 5 12-12-2007 01:08 PM
MIIS provisioning Active Directory with powershell script MA Alex PowerShell 0 05-25-2007 07:16 PM
Critique my Active Directory script phappyman@gmail.com PowerShell 0 12-01-2006 04:22 PM
Script Watch-Command.ps1 and a related puzzle. =?Utf-8?B?Um9tYW4gS3V6bWlu?= PowerShell 0 09-26-2006 08:29 AM


Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51