Intro Download and install Frequently Asked Questions Tips and tricks

Homepage







© J.C. Kessels 2009
MyDefrag Forum
May 24, 2013, 12:46:14 am *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Waking To Run Scheduled Task  (Read 1194 times)
julio99
JkDefrag Supporter
***
Posts: 10


View Profile
« on: May 25, 2010, 10:37:41 am »

When I installed My Defrag 4.3 I checked the box to let it allow the daily and monthly task. However I wanted the Task daily to be woke from sleep so that when I got up the task was already completed and I didn't have to wait for the disk to be optimized before I could start using it. I went in to task scheduler in Windows 7 HP and checked the box to wake computer from sleep to run task and it didn't do that. The task still ran when I got up and woke my computer from sleep. Did I miss something? Please give me some help if some is available. I'd like the computer to be woke up so the daily task can be run w/o me having to wake it up by myself.
 I re-installed the whole app without the auto task. I created a daily task myself and it still won't wake the computer up, even though the box is still checked " wake computer from sleep to run the task". I'm at a loss as to how to get my machine to wake up so the task can be run.
« Last Edit: May 25, 2010, 04:30:37 pm by julio99 » Logged
jeroen
Administrator
JkDefrag Hero
*****
Posts: 7155



View Profile WWW
« Reply #1 on: May 25, 2010, 09:14:14 pm »

I have never used the "wake computer from sleep" setting in the task scheduler myself, so I cannot help you there. All I can say is that there is nothing inside MyDefrag to keep the computer asleep, so I think it is a problem in the Windows task scheduler.
Logged
julio99
JkDefrag Supporter
***
Posts: 10


View Profile
« Reply #2 on: May 25, 2010, 10:59:04 pm »

I figured out how to wake the computer from sleep in Win 7, so that part of he equation is solved. By he way, it's done through the Control Pane/Power Options/Change Advanced Settings/Sleep.
   Now what I'd like to know is how to put the computer back to sleep after the scheduled task has run? Is there a script to    place in the same task that makes it run? Say my task runs at 5:00 am and runs for 55 mins. Is there a way to make the computer go back to sleep after it has run? If there's a simple script, could you put it in the reply for me and show me where to place it? I like to be very sure about the way I do things. Thanks.

If I want it to go back to sleep would I add when finished/Standby? Would that put it back to sleep?
« Last Edit: May 25, 2010, 11:11:37 pm by julio99 » Logged
jeroen
Administrator
JkDefrag Hero
*****
Posts: 7155



View Profile WWW
« Reply #3 on: May 26, 2010, 06:12:22 am »

If I want it to go back to sleep would I add when finished/Standby? Would that put it back to sleep?
Yes, that should do the trick. Just add a line with "WhenFinished(Standby)" anywhere in your script.

p.s. MyDefrag checks every script before running it, there is absolutely no way that you can damage your disks by making a mistake in a script.
Logged
julio99
JkDefrag Supporter
***
Posts: 10


View Profile
« Reply #4 on: May 26, 2010, 06:53:28 am »

Wit or w/o the quotes???
Logged
Darlis
JkDefrag Hero
*****
Posts: 1707


View Profile WWW
« Reply #5 on: May 26, 2010, 07:39:11 am »

Without.

It could look like this:
Code:
Title('System Disk Weekly')
Description("System Disk Weekly description")        // See the "Settings.MyD" file.

WhenFinished(Standby)

/* Write the header to the logfile. See the "Settings.MyD" file for the
   definition of the "LogHeader" string. */
WriteLogfile("MyDefrag.log","LogHeader")
Logged

Need help creating a script? Try MyDefrag Script Creator.
julio99
JkDefrag Supporter
***
Posts: 10


View Profile
« Reply #6 on: May 26, 2010, 05:20:31 pm »

I put in the "Whenfinished(Standby)" In the Arguments under the task, so when I closed the Task Scheduler the path was:"C:\Program Files\MyDefrag v4.3.1\Scripts\AutomaticDaily.MyD"Whenfinished(Standby). That's what it looked like in "Actions" in the Task Scheduler.
   Here is what happened. The Computer woke up at the designated time, the program"MyDefrag" flashed on the screen for approx. 2 seconds and then it was gone followed by just a normal desktop screen picture as if the computer woke up for no particular reason.
   I see in the previous post the code in that box was for a weekly task. Was I supposed to use that as a daily task or was the line, "WhenFinished(Standby)" just an example?
   If there's a simple way of doing what I want please clue me in. I thought it would work w/o a hitch, but obviously I'm wrong. Maybe it has something to do with the fact that the script for Daily Optimization already has an auto exit built into it?
Logged
Darlis
JkDefrag Hero
*****
Posts: 1707


View Profile WWW
« Reply #7 on: May 26, 2010, 05:44:10 pm »

WhenFinshed is a script settings, you cannot use it as a parameter. MyDefrag didn't know what to do with this parameter, so it exited.

I just took the weekly script for example. You can use every script you like. Just right click on a script and select "edit". The script then should open in your Editor and you'll see the script as in my previous post. Just add WhenFinished(Standby) as you see it in my example, save the file and you're done.
Logged

Need help creating a script? Try MyDefrag Script Creator.
julio99
JkDefrag Supporter
***
Posts: 10


View Profile
« Reply #8 on: May 26, 2010, 09:52:03 pm »

   Perfect! I think, anyway. Here's what I did: I opened the Daily task in MyDefrag and replaced the "whenfinished(exit)" with whenfinished(Standby). I gave it a test run and it seemed to go alright. When it finished the computer went back to sleep and when I reopened it the MyDefrag was still there, but it said finished. So, I reckon the app ran and did it's job before it went back to sleep. Am I right?
   I was hoping I'd be able to make MyDefrag finish and exit first then go back to sleep, but I suppose beggars can't be choosers, right?
   I hope you can give me a confirmation if I did this right by replacing the "WhenFinished(exit)" with "WhenFinished(Standby), or should I have had both scripts? When I tried running MyDefrag with both of the when finished scripts it only ran and then MyDefrag exited. So if there's a way to run it with both scripts, youd have to explain it to me, Otherwise this will have to do if it's right by you. Please let me know,OK? 
Logged
Darlis
JkDefrag Hero
*****
Posts: 1707


View Profile WWW
« Reply #9 on: May 26, 2010, 10:12:00 pm »

I hope you can give me a confirmation if I did this right by replacing the "WhenFinished(exit)" with "WhenFinished(Standby)
Yes that is right. But Jeroen has to confirm that MyDefrag stays open after going to standby mode.

When I tried running MyDefrag with both of the when finished scripts it only ran and then MyDefrag exited. So if there's a way to run it with both scripts, youd have to explain it to me, Otherwise this will have to do if it's right by you. Please let me know,OK? 
If you have multiple WhenFinished settings in one script, only the last one is effective. So I guess that in you case WhenFinished(exit) was the last statement.
Logged

Need help creating a script? Try MyDefrag Script Creator.
julio99
JkDefrag Supporter
***
Posts: 10


View Profile
« Reply #10 on: May 26, 2010, 10:52:16 pm »

I don't get whhat you're telling me. Is it right the way I have it now? When I had both of them the only one that worked was the first one/whenfinished(exit. The app ran and then it closed, just like the standby code wasn't there. When I replaced the WhenFinished(Exit) with the when finished(Standby) the app ran and then it went back to sleep, but when I reopened MyDefrag was still on the page but it said Finished, so I assume it ran before it went back to sleep. Is it right the way I have it or do I need to do something else?
Logged
jeroen
Administrator
JkDefrag Hero
*****
Posts: 7155



View Profile WWW
« Reply #11 on: May 27, 2010, 01:29:00 am »

I opened the Daily task in MyDefrag and replaced the "whenfinished(exit)" with whenfinished(Standby).
Yes, that is the correct way to do it.

Quote
when I reopened it the MyDefrag was still there, but it said finished.
Yes, that's exactly what is supposed to happen. The meaning of "Finished" is totally obvious, I think, and MyDefrag does not close so you can see it did actually run.
Logged
julio99
JkDefrag Supporter
***
Posts: 10


View Profile
« Reply #12 on: May 27, 2010, 01:49:21 am »

Perfect! I want to thank you and Darlis For the Help and patience you have given me. Alot of Mods would've just said this guy is too slow for me and they would've just forgotten me. You 2 stayed and answered until I finally got it right. Once again thanks for this fine software and the help.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.5 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!