Syed23 Posted August 10, 2011 Share Posted August 10, 2011 (edited) 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... #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 August 10, 2011 by Syed23 Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font] Link to comment Share on other sites More sharing options...
sleepydvdr Posted August 11, 2011 Share Posted August 11, 2011 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> Link to comment Share on other sites More sharing options...
Syed23 Posted August 11, 2011 Author Share Posted August 11, 2011 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] Link to comment Share on other sites More sharing options...
monoscout999 Posted August 11, 2011 Share Posted August 11, 2011 For me this works fine... using win7, but i made the test with an admin account. Link to comment Share on other sites More sharing options...
Syed23 Posted August 11, 2011 Author Share Posted August 11, 2011 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] Link to comment Share on other sites More sharing options...
monoscout999 Posted August 11, 2011 Share Posted August 11, 2011 3.3.6.1 Link to comment Share on other sites More sharing options...
Syed23 Posted August 11, 2011 Author Share Posted August 11, 2011 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] Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted August 11, 2011 Share Posted August 11, 2011 (edited) 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 August 11, 2011 by AdmiralAlkex .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
Syed23 Posted August 11, 2011 Author Share Posted August 11, 2011 #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 . 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] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now