Jump to content
Sign in to follow this  
Konzine

Closing a process remotely - Inetread?

Recommended Posts

Konzine

Hello,

I am attempting to write a script that looks at a webpage for a value (in example "shutdown" would display as simple text), and then uses that to shutdown a process.

I had one before years ago, unfortunately I have completely forgotten how I came about it.

Something very basic I've been trying..

If InetRead("http://konzine.com/lol" ="shutdown") Then
  ProcessClose("notepad.exe")
EndIf

Any ideas?

Share this post


Link to post
Share on other sites
Konzine

Brain fart.

If InetRead("http://konzine.com/lol")="shutdown" Then
  ProcessClose("notepad.exe")
EndIf

Works fine. Another question, though; Is there a way I can set the script to be running constantly, and check the webpage every say 60 seconds?

Share this post


Link to post
Share on other sites
Konzine

Seems this is coming back to me faster than I expected, so I'll just keep documenting it until I run into another problem;

For keeping the script looping I am using While 1 WEnd, and using sleep to rerun the script every 60 seconds or so. Right now I have it set to 3 seconds for testing purposes;

While 1
If InetRead("http://konzine.com/")="shutdown" Then
  ProcessClose("notepad.exe")
Else
  MsgBox( 4096, "Test", "This box will time out in 3 seconds", 3)
EndIf
Sleep(3000)
WEnd

Share this post


Link to post
Share on other sites
Konzine

Seems to be working ok. Since I have basically completed the fundamentals of the script I am now working on features here. This little update checks to see if notepad is running and if not Produces a MessageBox (this could easily be substituted with a sleep.)

While 1
If ProcessExists ("notepad.exe") Then
If InetRead("http://konzine.com/lol")="shutdown" Then
ProcessClose("notepad.exe")

EndIf
 
Else
  MsgBox( 4096, "Test", "This box will time out in 3 seconds", 3)
 
EndIf
 
Sleep(3000)
WEnd

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×