Jump to content
meety

#RequireAdmin---something is wrong with use

Recommended Posts

Posted (edited)

My au3 script program needs administrator privileges on win10 to be executed correctly, because it needs to be added to the boot---Script code:RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", @ScriptName, "REG_SZ", @ScriptFullPath)

I need to let the program automatically get administrator privileges, so I use a function of #RequireAdmin. Although the program can be added to the boot, but does not execute after system boot up? why is that?

What should I do?

--------------------------------------------------------------------

Update:

I found that after using the #RequireAdmin function, the program cannot be executed after system boot up.

An example is given below. after it is compiled, it will not be executed after system boot up in the following two ways.

1. C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp\

2. RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", @ScriptName, "REG_SZ", @ScriptFullPath)

why is that?

example

#include <MsgBoxConstants.au3>
#RequireAdmin

Func test()

    MsgBox(0, "", "this is test message")

EndFunc   ;==>test

test()

 

 

Edited by meety

Share this post


Link to post
Share on other sites
7 minutes ago, JockoDundee said:

is the script compiled to an .exe?

yes,does it matter after compilation?

Share this post


Link to post
Share on other sites

You may want to disable Windows defender temporarily or make an exclusion folder where your .exe lives in case AV is stopping it.


Code hard, but don’t hard code...

Share this post


Link to post
Share on other sites
Posted (edited)
4 hours ago, JockoDundee said:

You may want to disable Windows defender temporarily or make an exclusion folder where your .exe lives in case AV is stopping it.

my windows defender has already closed.

I mean is that the script program can run normally by double-clicking it, but it cannot run after the system is started.

Edited by meety

Share this post


Link to post
Share on other sites

But will it run under task scheduler?  Task scheduler will write to the event log so you can see exactly what happens when it fails.

also task scheduler let’s you run with elevated privilege.

what do you mean defender has closed?


Code hard, but don’t hard code...

Share this post


Link to post
Share on other sites
6 minutes ago, JockoDundee said:

But will it run under task scheduler?  Task scheduler will write to the event log so you can see exactly what happens when it fails.

also task scheduler let’s you run with elevated privilege.

what do you mean defender has closed?

Hi,I see my defender is closed by me, has nothing to do with it. I believe this problem is not the problem of the program itself,  and I don't want to use the Task scheduler.

Share this post


Link to post
Share on other sites

You can use multiple ways to run a program at startup. 

Please check that your script is running correctly without rebooting first. 

When you will be sure about this: 

 

Then you will be able to test the execution at boot. 

If you don't want to use the task scheduler, you could use the registry, and you could use the startup folder as well. 

 

Step by Step. 


My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
52 minutes ago, meety said:

and I don't want to use the Task scheduler.

You don’t have to, I suggested it because there seemed to be an urgency in making it work right away:

4 hours ago, meety said:

Hope this problem can be resolved soon, please

So back to basics, can you show us the actual registry entry that your program makes?


Code hard, but don’t hard code...

Share this post


Link to post
Share on other sites
Posted (edited)
3 hours ago, caramen said:

You can use multiple ways to run a program at startup. 

Please check that your script is running correctly without rebooting first. 

When you will be sure about this: 

 

Then you will be able to test the execution at boot. 

If you don't want to use the task scheduler, you could use the registry, and you could use the startup folder as well. 

 

Step by Step. 

Hi,you can compile the following examples and test what I said on your computer, you will understand.

#include <MsgBoxConstants.au3>
#RequireAdmin

Func test()

    MsgBox(0, "", "this is test message")

EndFunc   ;==>test

test()

 

Edited by meety

Share this post


Link to post
Share on other sites
Posted (edited)
5 minutes ago, meety said:

Hi,you can compile the following examples and test what I said on your computer and add it to boot, you will understand.

#include <MsgBoxConstants.au3>
#RequireAdmin

Func test()

    MsgBox(0, "", "this is test message")

EndFunc   ;==>test

test()

 

 

Edited by meety

Share this post


Link to post
Share on other sites

Have you tried using either HKLM\ or HKLM64\ in place of HKEY_LOCAL_MACHINE?  You also realise that #RequireAdmin would prompt for UAC, each time you logged on.

Share this post


Link to post
Share on other sites
32 minutes ago, JockoDundee said:

You don’t have to, I suggested it because there seemed to be an urgency in making it work right away:

So back to basics, can you show us the actual registry entry that your program makes?

Please see my reply above.

Share this post


Link to post
Share on other sites
Posted (edited)

If you mean that your issue isn't to run the program at startup but run the program at startup with admin right. 

 

Here also you got multiples ways. The best way for this is task scheduler yeah. 

But you could also use one of my precedent suggestion with one additional step. 

image.png.e83423a7d8dfe38d3dec78a98ebcbab8.png

Right click > Property > compatibility > change parameter > Execute as admin. 

Also, it can prompt you with UAC. If you want to disable UAC prompt.

You can do it with registry or windows interface.  

 

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites

Be aware of one thing. We don't have to use our magic ball to understand what you want.If that does not answer to your issue please try to describe better what issue you are experiencing. 


My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
16 minutes ago, meety said:

Please see my reply above.

I looked, but I didn’t find your actual regedit there.

All I saw was a msgbox program that you said to add to my boot up.

Can I use task scheduler with elevated admin?

If not, shouldn’t I use your regedit string?


Code hard, but don’t hard code...

Share this post


Link to post
Share on other sites
13 minutes ago, Subz said:

Have you tried using either HKLM\ or HKLM64\ in place of HKEY_LOCAL_MACHINE?  You also realise that #RequireAdmin would prompt for UAC, each time you logged on.

What is the difference? UAC is closed.

Share this post


Link to post
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

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By adityaparakh
      Hello ,
      I am trying to use Websockets in AutoIt.
      It is to fetch live stock market prices , API is provided and documentation available for python language.
      The link for the code snippet is :
      https://symphonyfintech.com/xts-market-data-front-end-api-v2/#tag/Introduction
      https://symphonyfintech.com/xts-market-data-front-end-api-v2/#tag/Instruments/paths/~1instruments~1subscription/post
       
      https://github.com/symphonyfintech/xts-pythonclient-api-sdk
       
      Second Link is to subscribe to a list of ExchangeInstruments.
      Now I would like to get live stock ltp (LastTradedPrice) for a few stocks whose "ExchangeInstrumentID" I know.
      I am able to use the WinHttp object to perform actions using simple codes like below :
      I have the secretKey and appkey and can generate the needed token. And get the unique ExchangeInstrumentID.

      Below code is just for example of how I am using WinHttp. Unrelated to socket part.
      Global $InteractiveAPItoken = IniRead(@ScriptDir & "\Config.ini", "token", "InteractiveAPItoken", "NA") $baseurl = "https://brokerlink.com/interactive/" $functionurl = "orders" $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("POST", $baseurl & $functionurl, False) $oHTTP.SetRequestHeader("Content-Type", "application/json;charset=UTF-8") $oHTTP.SetRequestHeader("authorization", $InteractiveAPItoken) $pD = '{ "exchangeSegment": "NSEFO", "exchangeInstrumentID": ' & $exchangeInstrumentID & ', "productType": "' & $producttype & '", "orderType": "MARKET", "orderSide": "' & $orderside & '", "timeInForce": "DAY", "disclosedQuantity": 0, "orderQuantity": ' & $qty & ', "limitPrice": 0, "stopPrice": 0, "orderUniqueIdentifier": "' & $orderidentifier & '"}' $oHTTP.Send($pD) $oReceived = $oHTTP.ResponseText $oStatusCode = $oHTTP.Status
          
          
      But am struggling to understand and use socket.
      Would be of great help if you can have a look at the link mentioned above and help with the code sample for AutoIt.
      To connect and listen to a socket.
      Thanks a lot
       
    • By Hermes
      Hi, I have a site that has the following elements below: 
      <div>More element here</div> <div>More element here</div> <div>More element here</div> When I do this in Auto It:
      Local $oSelectDiv = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, "div") _WD_HighlightElement($sSession, $oSelectDiv, 1) I also tried to add [3], but it doesnt seems to work:
      Local $oSelectDiv = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, "div[3]") _WD_HighlightElement($sSession, $oSelectDiv, 1) It always highlight the first one, but I am trying to highlight the 3rd in the list. Is there anyway to select the 3rd div without having to add any class/id in the divs, and without using XPATH? The structure of the elements in that site were built that way.
    • By DJ143
      I have a autoit exe file which is used in upload/browse file functionality.  This has been integrated with selenium framework and I am invoking the autoit exe using Java process and runtime. 
      Now the issue is when I run the scripts and invoke the autoit exe in local it works perfectly.  But when I use selenium grid or jenkins to run the scripts in another windows server it is not working.
      Can anyone please suggest any solution for this?
    • By meety
      Hello everyone
      I found some problems when using au3info to get the visible text: as shown in the attachment.
      Why is that? What do I need to do to get the visible text content?
       
       
    • By PeterVerbeek
      This topic give you access to an AutoIt functions library I maintain which is called PAL, Peter's AutoIt Library. The latest version 1.25 contains 212 functions divided into these topics:
      window, desktop and monitor GUI, mouse and color GUI controls including graphical buttons (jpg, png) logics and mathematics include constants string, xml string and file string dialogues and progress bars data lists: lists, stacks, shift registers and key maps (a.ka. dictionaries) miscellaneous: logging/debugging, process and system info Change log and files section  on the PAL website (SourceForge).
      A lot of these functions were created in the development of Peace, Peter's Equalizer APO Configuration Extension, which is a user interface for the system-wide audio driver called Equalizer APO.
×
×
  • Create New...