Jump to content

Run .au3 script as Admin: no option in menu


remin
 Share

Go to solution Solved by JohnOne,

Recommended Posts

I created a script and I'm ready to launch it at windows start-up and want to do it as Admin in order to use the script also when a window has UAC enabled.

But...

- When I right click on the file there is No option "Run as Administrator" 

- I tried to add the file to task scheduler with elevated rights, but when I run the task it edits the file (in SciTE4)

- When I push down the CTRL & SHIFT key and click the script file, the same thing happens as running the task in task scheduler.

I'm the admin of the pc and I can run non autoit programs/scripts on above ways.

I tried to reinstall the autoit setup exe file running as administrator but it didn't resolve the problem.

What did I wrong?

How can I run the script with elevated rights in task scheduler?

ps: I'm running win8 64 bits, but installed autoit in 32bits mode.

Edited by remin
Link to comment
Share on other sites

I might be wrong here, but I don't believe you can run a scheduled task with higher rights than those with which it was created.

 

There is an option in the task scheduler, "Run with the highest privilege" or something like that

Nothing is so strong as gentleness. Nothing is so gentle as real strength

 

Link to comment
Share on other sites

It may be that the highest available is that with which it was created.

 

Thank you for your reply.

Do you know how to change this?

I tried to copy the text of the script to an editor with elevated rights and saved it but that doesn't seems to work.

Link to comment
Share on other sites

There is a reason why you don't compile it as .exe?

 

I often change things in the script.

I would have to compile it every time.

btw.. 

my autoit = 32 bits.

my windows env = 64 bits.

Do I have to compile to 64 bits?

Link to comment
Share on other sites

Can you explain exactly what you mean when you say " the file still is still edited  (in SciTE4) when I run the task in task scheduler."

 

Sorry,

I was a ahk user before and added my ahk script to the task scheduler in order to start the software under admin rights and without the UAC prompt:

http://www.techrepublic.com/blog/windows-and-office/run-uac-restricted-programs-without-the-uac-prompt/

That works well with ahk but not with au3 scripts.

At windows start-up it doesn't activate the script (as my old .ahk script) but it edits the file in SciTe4.

Link to comment
Share on other sites

  • Moderators

remin,

You can change the default action for .au3 files from "Edit" to "Run" by using SciTEConfig. Look under the <Tools> menu (when you have a .au3 file open and select "SciTE Config" - the top option in the dialog which appears allows you to select the default action. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

remin,

You can change the default action for .au3 files from "Edit" to "Run" by using SciTEConfig. Look under the <Tools> menu (when you have a .au3 file open and select "SciTE Config" - the top option in the dialog which appears allows you to select the default action. :)

M23

 

Hi Melba :)

I checked it.

The default action for .au3 files was already set to "Edit" to "Run.

Remin

ps: when I double click on an .au3 file it runs the file.

      When I run the task (open the same file with elevated rights) in task scheduler it edits the file. 

Edited by remin
Link to comment
Share on other sites

You have to run AutoIt3 as admin and pass script as parameter I think.

 

Yes that did it. :)

I added 

"C:Program Files (x86)AutoIt3AutoIt3.exe"

to the task scheduler (Start a program --> Program/Script:)

and

d:scriptname.au3

in

Add arguments (optional)

And that opened the script with highest privileges.

Link to comment
Share on other sites

  • 1 year later...

Clarifying: you don't need to run the script as admin from scheduled tasks. The script asks those rights by itself if it has #RequireAdmin.

When you run it from scheduled tasks one or two things happen: the admin account has Scite editor as the default action (you said you installed as admin and set that to "run"). Second: registry settings for the Admin account are not (fully) loaded, and the script runs on default standard settings no matter what you have set up...

Again, run it with any account and the #RequireAdmin will ask you for appropriate credentials. Or make a launcher, write RunAs (admin, pw, domain, script) to avoid writing the password.

Mind you that if you don't compile it, anyone will be able to read that password.

AutoIt is a blessing, I don't know how I was able to use my computer before [Auto]It :-S

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

×
×
  • Create New...