bistrader Posted August 16, 2006 Share Posted August 16, 2006 I have been searching. I have a string of au3 files that run one after the other via a bat file. I would like to add an au3 file that turns on my computer as the first step in the bat file. And, I would like to add an au3 file to the end of this bat file that turns off my computer. Does anyone have an au3 file that does either of these? Can either of these (turn on PC or turn off PC) be done with AutoIt? Thanks for the help!! ... Link to comment Share on other sites More sharing options...
lod3n Posted August 16, 2006 Share Posted August 16, 2006 (edited) When you do figure it out, could you post the one that you click on to turn on your computer? That sounds amazing! Edited August 16, 2006 by lod3n [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] Link to comment Share on other sites More sharing options...
bistrader Posted August 16, 2006 Author Share Posted August 16, 2006 Guess I was not clear. I do not have and am looking for an au3 file that turns on my PC. I am also looking for an au3 file or code example for turning off my PC. I want to add these 2 au3 files to the front and end of my batch file. ... Link to comment Share on other sites More sharing options...
lod3n Posted August 16, 2006 Share Posted August 16, 2006 I don't think I was clear either. If your computer is off, you can't run any batch scripts on it - because it's off. Now, are you saying that you want to turn it on from another computer? That's only possible IF the other computer is on the same network subnet, AND your computer's network card supports Wake On Lan. [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] Link to comment Share on other sites More sharing options...
BPBNA Posted August 16, 2006 Share Posted August 16, 2006 To turn off the computer try: Run(@ComSpec & " /c shutdown -t now", "", @SW_HIDE) Like lod3n said, kinda hard to write a script to turn your computer on when the computer isn't already on to run the script. I beleive theres a program called Magic Packet or something like that I used back in my second semester of college to do Wake-on-LAN. You should look that up. Link to comment Share on other sites More sharing options...
lod3n Posted August 16, 2006 Share Posted August 16, 2006 Or the Autoit command Shutdown. [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] Link to comment Share on other sites More sharing options...
mike1305 Posted August 16, 2006 Share Posted August 16, 2006 When you do figure it out, could you post the one that you click on to turn on your computer? That sounds amazing! Classic. Amp Energy Drink: the official sponsor of me scripting at 2AM. Link to comment Share on other sites More sharing options...
kjmarket Posted August 16, 2006 Share Posted August 16, 2006 It sure has me laughing. Pink Floyd - The Wall Link to comment Share on other sites More sharing options...
nitekram Posted August 16, 2006 Share Posted August 16, 2006 Just push the power button - no programming or script needed 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow."  WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI  CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator Link to comment Share on other sites More sharing options...
lod3n Posted August 16, 2006 Share Posted August 16, 2006 Joking aside, some computers do allow you to schedule a power on. Check your computer's BIOS to see if you can. When it's turning on, look for instructions - probably a key press - to get into the config/setup. (Be REALLY careful in there.) If so, you can then run your scripts from your Startup folder. [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] Link to comment Share on other sites More sharing options...
ShonGail Posted August 16, 2006 Share Posted August 16, 2006 Hello To turn on your computer, you have two ways :- fisrt one : the BIOS of your motherboard (press F2 or DEL during boot sequence to access) to program a wake up according to date & time (example : wake up my computer each day at 3 PM) or according to an event on your network card :-second one : the WOL (Wake On LAN). You must have a network card supporting WOL and your BIOS configured to wake up if the card receive an event (a WOL message is named a "magic packet")Then you need a program to send this magic packet from an other computer. I recommend WOL command line software from DEPICUS : http://www.depicus.com/wake-on-lan/it works Link to comment Share on other sites More sharing options...
mike1305 Posted August 16, 2006 Share Posted August 16, 2006 I used to set up a BIOS wake-up every day so it would be up and ready when I came home from school. worked like a charm. Amp Energy Drink: the official sponsor of me scripting at 2AM. Link to comment Share on other sites More sharing options...
lod3n Posted August 16, 2006 Share Posted August 16, 2006 Olish also has a nifty script to create a magic packet in AutoIt:http://www.autoitscript.com/forum/index.php?showtopic=29772 [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] Link to comment Share on other sites More sharing options...
ShonGail Posted August 16, 2006 Share Posted August 16, 2006 Olish also has a nifty script to create a magic packet in AutoIt:http://www.autoitscript.com/forum/index.php?showtopic=29772Yes ! Thank you for the information Link to comment Share on other sites More sharing options...
BasicOs Posted September 2, 2006 Share Posted September 2, 2006 This func is missing from autoitWakeUpAfteranHibernate()It is ready in Visual Basic:You can make an exe in Visual Basic that makes your pc wake up after hibernateWake up after hibernate codems Autoit.es - Foro Autoit en Español Word visitors Image Clustrmap image: - Football Spanish team - Spanish team: Casillas, Iniesta, Villa, Xavi, Puyol, Campdevilla, etc..Programando en Autoit+Html - Coding Autoit-Html - Arranca programas desde Internet - Preprocesador de Autoit a http Link to comment Share on other sites More sharing options...
Chobyhy Posted September 2, 2006 Share Posted September 2, 2006 I dont get this concept. Window comes with the turn off switch in start menu and there is a button on motherboard that turns on the comp. How can comp be turned on when the script is not even running? Link to comment Share on other sites More sharing options...
Gondus Posted September 2, 2006 Share Posted September 2, 2006 It cant....thats why basically everyones making ratorical questions and making fun of him -----------Current Programming Language Status:Beginner: J#, Ruby Intermediate: Autoit, Java, C#, C++Advanced: Basic, Visual Basic, Fortran Link to comment Share on other sites More sharing options...
Azu Posted September 2, 2006 Share Posted September 2, 2006 Hi, but this script on your desktop, and double click it to turn on your computer! opt("EnableScriptEvenIfComputerIsOff",1) TurnOnComputer("now") Link to comment Share on other sites More sharing options...
Lakes Posted September 2, 2006 Share Posted September 2, 2006 (edited) Hello To turn on your computer, you have two ways :- fisrt one : the BIOS of your motherboard (press F2 or DEL during boot sequence to access) to program a wake up according to date & time (example : wake up my computer each day at 3 PM) or according to an event on your network card :-second one : the WOL (Wake On LAN). You must have a network card supporting WOL and your BIOS configured to wake up if the card receive an event (a WOL message is named a "magic packet")Then you need a program to send this magic packet from an other computer. I recommend WOL command line software from DEPICUS : http://www.depicus.com/wake-on-lan/it works A third way would be for some basic electronics to drive a relay connected to the motherboard where the power on switch connects to, (its only a momentry contact) from another computer, you can use the printer port for this.See this thread http://www.autoitscript.com/forum/index.php?showtopic=31708Way easier to use WOL though... Edited September 2, 2006 by Lakes 2015 - Still no flying cars, instead blankets with sleeves. Link to comment Share on other sites More sharing options...
Micha1405 Posted September 2, 2006 Share Posted September 2, 2006 Hello I found this in this forum:[autoit];===============================================================================;; Description: Sets a wakeup time to wake it up if the system / computer is hibernating or standby; Parameter(s): $Hour - Hour Values : 0-23; $Minute - Minutes Values: 0-59; $Day - Days Values : 1-31 (optional); $Month - Month Values : 1-12 (optional); $Year - Year Values : > 0 (optional);; Requirement(s): DllCall; Return Value(s): On Success - 1; On Failure - 0 sets @ERROR = 1 and @EXTENDED (Windows API error code);; Error code(s): http://msdn.microsoft.com/library/default....error_codes.asp;; Author(s): Bastel123 aka Sebastian; Note(s): -;;===============================================================================func SetWakeUpTime($Hour,$Minute,$Day=@mday,$Month=@mon,$Year=@YEAR)$SYSTEMTIME = DllStructCreate("ushort;ushort;ushort;ushort;ushort;ushort;ushort;ushort")$lpSYSTEMTIME = DllStructGetPtr($SYSTEMTIME)$LOCALFILETIME=DllStructCreate("dword;dword")$lpLOCALFILETIME = DllStructGetPtr($LOCALFILETIME)$DueTime=DllStructCreate("dword;dword")$lpDueTime=DllStructGetPtr($DueTime)DllStructSetData($SYSTEMTIME, 1, $Year)DllStructSetData($SYSTEMTIME, 2, $Month)DllStructSetData($SYSTEMTIME, 3, _DateToDayOfWeek($Year,$Month,$Day)-1)DllStructSetData($SYSTEMTIME, 4, $Day)DllStructSetData($SYSTEMTIME, 5, $Hour)DllStructSetData($SYSTEMTIME, 6, $Minute)DllStructSetData($SYSTEMTIME, 7, 0)DllStructSetData($SYSTEMTIME, 8, 0)$result = DllCall("kernel32.dll", "long", "SystemTimeToFileTime", "ptr", $lpSystemTime, "ptr", $lpLocalFileTime)If $result[0] = 0 Then Local $lastError = DllCall("kernel32.dll", "int", "GetLastError") SetExtended($lastError[0]) SetError(1) Return 0EndIf$result = DllCall("kernel32.dll", "long", "LocalFileTimeToFileTime", "ptr", $lpLocalFileTime, "ptr", $lpLocalFileTime)If $result[0] = 0 Then Local $lastError = DllCall("kernel32.dll", "int", "GetLastError") SetExtended($lastError[0]) SetError(1) Return 0EndIf$result = DllCall("kernel32.dll", "long", "CreateWaitableTimer", "long", 0, "long", True, "str", "")If $result[0] = 0 Then Local $lastError = DllCall("kernel32.dll", "int", "GetLastError") SetExtended($lastError[0]) SetError(1) Return 0EndIfDllCall("kernel32.dll", "none", "CancelWaitableTimer", "long",$result[0])DllStructSetData($DueTime, 1, DllStructGetData($LocalFILETIME, 1))DllStructSetData($DueTime, 2, DllStructGetData($LocalFILETIME, 2))$result = DllCall("kernel32.dll", "long", "SetWaitableTimer", "long",$result[0], "ptr", $lpDueTime, "long", 1000, "long", 0, "long", 0, "long", true)If $result[0] = 0 Then Local $lastError = DllCall("kernel32.dll", "int", "GetLastError") SetExtended($lastError[0]) SetError(1) Return 0EndIfreturn 1EndFunc;===============================================================================;; Description: Set the computer in Hibernate or Standby Status; Parameter(s): $Mode - Suspend mode : True=Hibernate, False=Suspend; $Force - Force-Mode : True=the system suspends operation immediately; False=FALSE, the system broadcasts a PBT_APMQUERYSUSPEND event to each application to request permission to suspend operation ;; Requirement(s): DllCall;; Author(s): Bastel123 aka Sebastian; Note(s): If the system does not support hibernate use the standby mode -;;===============================================================================Func SetSuspend($mode=False,$force=true) $result = DllCall("PowrProf.dll", "long", "SetSuspendState", "long",$mode, "long",$force, "long", false)EndFunc My TrayToolBar 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