Jump to content

Simple questions


Recommended Posts

I have a couple of un answered questions and I hope you guys are going to be able to help me out with that!!

1- I have a little program that open up a web page and make a couple of mouseclick and mousemove stuff, so obviously I have a problem. Someone could easily close the webpage while my script is running and then it would start doing some weird stuff, maybe even deleting stuff. So I want to know is there any way, while my script is running to disable the keyboard and the mouse so no one touches it and/or have a validation that the webpage is still active if not then stop the execution of the script.

2- The same script I'm talking about is in a loop and I need it to run every 30 minute but the thing is it's suxing up alot of CPU juice, 50% almost, is there a way to optimize the way I'm doing my thing ??

While 1
   If _TicksToTime() > $NextStart Then
      $NextStart = _TicksToTime() + 30 * 60 * 1000 
      Run Function
   EndIf
WEnd

Cheers and hope you can help!!!

Edited by AllSystemGo
Link to comment
Share on other sites

We have a handy function called BlockInput(). Call it and use 1 as the parameter. It is a direct use of the WINAPI BlockInput.

As for keeping processor use down, use Sleep() with about a 1 second sleep. Something like Sleep(1000) after your EndIf in the code provided.

Edit: curses, same info, same post time!

Edited by Icekirby1
Link to comment
Share on other sites

As for the disabling check the helpfile for BlockInput(). Try using Adlibenable() to save memory usage while the script is running. Set the Adlibenable function to run every 30 minutes like so:

Adlibenable("Function", 1800000).

EDIT: I'm guessing you know about the BlockInput function by now :whistle:. Three posts at the same time... lol.

Edited by dandymcgee

- Dan [Website]

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...