Jump to content

#include Process.au3


Recommended Posts

Hi,

I have the following code that I wish to run "quietly" without any command windows appearing.

The code uses the _RunDos commands & requires the use of an #include <Process.au3> statement.

I can run this code on a PC that has autoit installed. Can this code be used or modified somehow to

run on PCs without AutoIT?

i.e modify the path to call process.au3 from a network drive, or compile the au3 to an exe?

Thanks

Cam

HERE IS THE CODE I WISH TO RUN......

#include <Process.au3>

; Prompt the user to run the script - use a Yes/No prompt (4 - see help file)

$answer = MsgBox(4, "Presentation Mode", "This script will switch off (a) Screen Saver, (<_< Groupwise Notifier and set power options to © Presentation Mode - Always On. Run?")

; Check the user's answer to the prompt (see the help file for MsgBox return values)

; If "No" was clicked (7) then exit the script

If $answer = 7 Then

MsgBox(0, "Presentation Mode", "OK. Bye!")

Exit

EndIf

; Force Quit of Notifier - this method hides the command window that displays taskkill

$rc = _RunDos("c:\windows\system32\taskkill.exe /IM notify.exe /f")

; Change Power Scheme to Presentation Mode

$setpowerscheme = _RunDos("c:\windows\system32\powercfg.exe /setactive Presentation")

; Change Presentation Power Scheme Turn off monitor setting to Never

$turnoffmonitor = _RunDos("c:\windows\system32\powercfg.exe /change Presentation /monitor-timeout-ac 0")

; Change Presentation Power Scheme Turn off HardDisk setting to Never

$turnoffharddisk = _RunDos("c:\windows\system32\powercfg.exe /change Presentation /disk-timeout-ac 0")

; Turn on the BatteryIcon on the Systray as a visible indicator that this had been set

$turnonBatteryIcon = _RunDos("c:\windows\system32\powercfg.exe /GLOBALPOWERFLAG on /OPTION BATTERYICON")

MsgBox(0, "Presentation Mode", "Presentation Mode successfully set!")

; Finished!

Exit

Link to comment
Share on other sites

Compile it.

Start-->All programs-->Autoit v3--> Compile script to .exe

Do I compile the process.au3 file & put this file somewhere accessible like a network drive & then reference it in the #INCLUDE statement like #include <G:\Process.exe>

I'm curious as to how these work for possible future linking of these "libraries / modules" in other code I need to write....

I've found another way around running these "hidden" either by running the commands like:

RunWait(@ComSpec & " /C " & "c:\windows\system32\taskkill.exe /IM notify.exe /f", "", @SW_HIDE)

or even...

Run("c:\windows\system32\taskkill.exe /IM notify.exe /f","", @SW_HIDE)

Thanks for any information in regards how to compile & correctly reference the process.au3 file

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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