jimmyubung Posted January 3, 2008 Share Posted January 3, 2008 Hi People, This is my very first script, i read about this in APC and it seemed pretty cool. I am making a script that u open it and it launches defragmenter and then opens notepad and writes the time and date u started, then it waits for it to finish then it says the time it finish, then loops. But writes in the same document i dunno why it wont work. While 1 = 1 Send("#r") WinWaitActive("Run") Send("dfrg.msc{Enter}") WinWaitActive("Disk Defragmenter") MouseClick("primary", 160, 370, 1) Run("notepad.exe") WinWaitActive("Untitled - Notepad") Send("Defragmentation started at {F5}.") sleep(500) WinSetState ( "Untitled - Notepad", "Progress", @SW_MINIMIZE ) WinWaitActive("Disk Defragmeter") send("{RIGHT}") send("{ENTER}") WinSetState ( "Untitled - Notepad", "Progress", @SW_MAXIMIZE ) Send("{ENTER}") Send("Defragmentation Completed at {F5}") Send("{ENTER 2}") WEnd Just tell me where i went wrong please, also if someone could tell me another way of clicking on the defragment button apart from "Mouseclick" Link to comment Share on other sites More sharing options...
ashley Posted January 3, 2008 Share Posted January 3, 2008 how about run(dfrgui.exe) to open it... and then go into your editor click on tools then on the one with macro in it someweare... run it... start recording.. then click on the buitton and stop recording.... then save script and run script and it should work. Free icons for your programs Link to comment Share on other sites More sharing options...
BrettF Posted January 3, 2008 Share Posted January 3, 2008 how about run(dfrgui.exe)to open it... and then go into your editor click on tools then on the one with macro in it someweare... run it... start recording.. then click on the buitton and stop recording.... then save script and run script and it should work.You could also use defrag.exe Should work better than simulated mouse clicks. Google the usage of it thought. I'm not too sure. I think if you go run and type "defrag.exe C:" it will defrag C:... Think... Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
schilbiz Posted January 3, 2008 Share Posted January 3, 2008 (edited) Hi People, This is my very first script, i read about this in APC and it seemed pretty cool. I am making a script that u open it and it launches defragmenter and then opens notepad and writes the time and date u started, then it waits for it to finish then it says the time it finish, then loops. But writes in the same document i dunno why it wont work. While 1 = 1 Send("#r") WinWaitActive("Run") Send("dfrg.msc{Enter}") WinWaitActive("Disk Defragmenter") MouseClick("primary", 160, 370, 1) Run("notepad.exe") WinWaitActive("Untitled - Notepad") Send("Defragmentation started at {F5}.") sleep(500) WinSetState ( "Untitled - Notepad", "Progress", @SW_MINIMIZE ) WinWaitActive("Disk Defragmeter") send("{RIGHT}") send("{ENTER}") WinSetState ( "Untitled - Notepad", "Progress", @SW_MAXIMIZE ) Send("{ENTER}") Send("Defragmentation Completed at {F5}") Send("{ENTER 2}") WEnd Just tell me where i went wrong please, also if someone could tell me another way of clicking on the defragment button apart from "Mouseclick" Do you want it to loop? Do you want it to write in the same document the start and finish times? What exactly are you trying to do? My understanding of what you want to do is open and run defrag, document start and stop times, end script. Why not just use task scheduler it does all this already. Edited January 3, 2008 by schilbiz Link to comment Share on other sites More sharing options...
jimmyubung Posted January 4, 2008 Author Share Posted January 4, 2008 Do you want it to loop? Do you want it to write in the same document the start and finish times? What exactly are you trying to do? My understanding of what you want to do is open and run defrag, document start and stop times, end script. Why not just use task scheduler it does all this already.This is my first script so i wanted to learn some of the basic functions, and it woudlnt really work so i asked for some input and thanks for the help people i will try again using ur ideas. 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