I have created a gui with two buttons say button_1 and button_2
Now say i want to lanuch a cmd window with button_1 as non-admin, but when i click button_2 it should launch a cmd window as admin
THE CONDITION IS I DO NOT WANT TO ENTER THE PASSWORD EVERY TIME I CLICK ONE OF THE BUTTON. ALSO I DO NOT WANT TO SAVE MY PASSWORD IN ANY SCRIPT FILE.
What I have tried: -
: I only way i could think to handle this situation, is having two scripts running, one as non-admin with gui, the other as admin in background without gui. so the idea is the non-admin script asks admin script to do something
1. SendMessage, PostMessage, OnMessage := This gives access denied error, may be a non-admin script cannot pass message to admin script
2. ControlClick := same, cannot send click from non-admin gui to a gui created by admin-script
3. hotkeys := i send a hotkey from non-admin script and the same is detected by admin script.
{
Code: Select all
SendInput "!{VK01}" ; this sends hotkey from non-admin script
Code: Select all
!VK01::
{
function_do_something()
}; this is read by admin-script and it perform some action
also VK101 triggers VK01 also, this means i cannot go beyond VKFF (or VK99 may be, I have not tried)
1. New methods are welcome, i.e. something crazy like one gui sending clicks to two scripts
2. new ways for communication between two scripts are also welcome
3. new sets of hotkeys at last will also work, the condition is they should be be numerous i.e. 10000, and should not be general hotkeys like ^F1 or !p