Jump to content
Sign in to follow this  
Syed23

struggling due to #RequireAdmin

Recommended Posts

Syed23

Hi Friends,

I am using stringinstr() function to compare 2strings. This function works fine if i execute it as normal and shows me the proper result.. if i add #RequireAdmin on the code then same Stringinstr() code is not working. can some one help on this? For reference i have the code below.

$file = "[ 2011-08-09 20:31:31 ] : <![LOG[Application DNE 4.1.7 returned an unexpected return code: 2]LOG]!>"
$line = "Application DNE 4.1.7 returned an unexpected return code: 2" 
If StringInStr($file,$line) <> 0 Then 
ConsoleWrite("String2 is there in string1") 
EndIf

The above one is working fine; And the below code is the one which is not working...:mellow:

#RequireAdmin 
$file = "[ 2011-08-09 20:31:31 ] : <![LOG[Application DNE 4.1.7 returned an unexpected return code: 2]LOG]!> " 
$line = "Application DNE 4.1.7 returned an unexpected return code: 2" 
If StringInStr($file,$line) <> 0 Then 
ConsoleWrite("String2 is there in string1") 
EndIf
Edited by Syed23

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Share this post


Link to post
Share on other sites
sleepydvdr

It seems to be working perfectly for me. When I run the non-#requireadmin code on either an admin account or user account, it works. If I run the #requireadmin code on a user account, I get prompted for administrator credentials. I enter the credentials and it works as expected.

What exactly is happening on your system?


#include <ByteMe.au3>

Share this post


Link to post
Share on other sites
Syed23

It seems to be working perfectly for me. When I run the non-#requireadmin code on either an admin account or user account, it works. If I run the #requireadmin code on a user account, I get prompted for administrator credentials. I enter the credentials and it works as expected.

What exactly is happening on your system?

The issue happens on Windows 7 machine. In XP it works perfect. Have your tried in Windows 7 ?


Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Share this post


Link to post
Share on other sites
monoscout999

For me this works fine... using win7, but i made the test with an admin account.

Share this post


Link to post
Share on other sites
Syed23

For me this works fine... using win7, but i made the test with an admin account.

what version of Autoit you are using ?


Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Share this post


Link to post
Share on other sites
Syed23

It seems to be working perfectly for me. When I run the non-#requireadmin code on either an admin account or user account, it works. If I run the #requireadmin code on a user account, I get prompted for administrator credentials. I enter the credentials and it works as expected.

What exactly is happening on your system?

Step1: i ran the code without #RequireAdmin and it writes the result successfully.

Step2: Then i added the #RequireAdmin function and i executed the code again, i got UAC prompt then i clicked on OK after that nothing was happening... it's not returning the result.


Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Share this post


Link to post
Share on other sites
AdmiralAlkex

Step2: Then i added the #RequireAdmin function and i executed the code again, i got UAC prompt then i clicked on OK after that nothing was happening... it's not returning the result.

#RequireAdmin works by checking if the script is running as Admin and if not restarting the script and requesting them, breaking stuff like ConsoleWrite(). You need to launch SciTE as admin, then everything it runs will be admin too.

That or use something else than console to show results.

Edited by AdmiralAlkex

Share this post


Link to post
Share on other sites
Syed23

#RequireAdmin works by checking if the script is running as Admin and if not restarting the script and requesting them, breaking stuff like ConsoleWrite(). You need to launch SciTE as admin, then everything it runs will be admin too.

That or use something else than console to show results.

Brilliant! That worked :mellow:. i used msgbox instead of consolewrite and it works successfully:) Thanks a lot AdmiralAlkex!


Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.