soma01 Posted April 28, 2009 Share Posted April 28, 2009 I am a newbie and need some help on writing a script. I would like to do some processing just after a file has been updated (by another application); some kind of trigger on event. I would like to do this without looping. Is this possible ? If not, then as the file will be updated once per minute at 00 seconds, I could wait in my script until @Sec = 5, do what I have to do, then sleep (55000) and loop; but I am a bit afraid of the load the loop will put on my CPU. Could someone just put me in the right direction ? Thanks Link to comment Share on other sites More sharing options...
Richard Robertson Posted April 28, 2009 Share Posted April 28, 2009 If your script is sleeping, it will use 0% CPU. Link to comment Share on other sites More sharing options...
Yashied Posted April 28, 2009 Share Posted April 28, 2009 (edited) I am a newbie and need some help on writing a script. I would like to do some processing just after a file has been updated (by another application); some kind of trigger on event. I would like to do this without looping. Is this possible ? If not, then as the file will be updated once per minute at 00 seconds, I could wait in my script until @Sec = 5, do what I have to do, then sleep (55000) and loop; but I am a bit afraid of the load the loop will put on my CPU. Could someone just put me in the right direction ? ThanksMaybe this. Local $TimeOut = 5 * 1000 ; 5 Sec Local $TD = TimerInit() While 1 If TimerDiff($TD) > $TimeOut Then ... $TD = TimerInit() EndIf ... Sleep(10) WEnd Edited April 28, 2009 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
muncherw Posted April 28, 2009 Share Posted April 28, 2009 I am a newbie and need some help on writing a script.I would like to do some processing just after a file has been updated (by another application); some kind of trigger on event. I would like to do this without looping.Is this possible ?If not, then as the file will be updated once per minute at 00 seconds, I could wait in my script until @Sec = 5, do what I have to do, then sleep (55000) and loop; but I am a bit afraid of the load the loop will put on my CPU.Could someone just put me in the right direction ?ThanksI don't see how you can do it without a loop. A sleep for a few seconds wouldn't really cause a load problem (heck even if it was 100 milliseconds). You could use something like FileGetTime to see if the file has changed. Other People's Stuff:Andy Flesner's AutoIt v3: Your Quick Guide[topic="34302"]Locodarwin's ExcelCom_UDF[/topic][topic="61090"]MrCreatorR's Opera Library[/topic] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now