Jump to content

Recommended Posts

Posted

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!!

...

Posted

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.

...

Posted

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]

Posted

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.

Posted

When you do figure it out, could you post the one that you click on to turn on your computer? That sounds amazing! :)

:P:nuke:

Classic.

Amp Energy Drink: the official sponsor of me scripting at 2AM.

Posted

Just push the power button - no programming or script needed :P

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."

 

WindowsError.gif

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

Posted

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]

Posted

Hello :P

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 :nuke:

Posted

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.

  • 3 weeks later...
Posted

This func is missing from autoit

WakeUpAfteranHibernate()

It is ready in Visual Basic:

You can make an exe in Visual Basic that makes your pc wake up after hibernate

Wake up after hibernate code

ms

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
Posted

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?

Posted

It cant....thats why basically everyones making ratorical questions and making fun of him :P

-----------Current Programming Language Status:Beginner: J#, Ruby Intermediate: Autoit, Java, C#, C++Advanced: Basic, Visual Basic, Fortran

Posted

Hi, but this script on your desktop, and double click it to turn on your computer!

opt("EnableScriptEvenIfComputerIsOff",1)
TurnOnComputer("now")
Posted (edited)

Hello :P

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 :nuke:

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=31708

Way easier to use WOL though... :)

Edited by Lakes

2015 - Still no flying cars, instead blankets with sleeves.

Posted

:P 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 0

EndIf

$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 0

EndIf

$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 0

EndIf

DllCall("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 0

EndIf

return 1

EndFunc

;===============================================================================

;

; 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

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
  • Recently Browsing   0 members

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