AutoHotkey Community

It is currently May 27th, 2012, 5:12 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 11 posts ] 
Author Message
PostPosted: December 14th, 2010, 1:21 pm 
Offline

Joined: November 24th, 2005, 8:16 am
Posts: 851
Hey guys.

Trying to do a simple RegWrite. On Windows 7 machines this does not work unless I compile the script and run it as administrator.

Is there any way to invoke the UAC dialog when calling this command, or is there any other way around it?

I was trying to find something along the lines of using the built in Windows "reg" command, and running it as administrator (instead of using AHK's RegWrite) but did not have much luck there yet.

Any help is appreciated.

_________________
Sector-Seven - Freeware tools built with AutoHotkey


Report this post
Top
 Profile  
Reply with quote  
PostPosted: December 14th, 2010, 2:42 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
Icarus wrote:
I was trying to find something along the lines of using the built in Windows "reg" command, and running it as administrator (instead of using AHK's RegWrite) but did not have much luck there yet.


RegEdit.exe supports command line switches


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 14th, 2010, 3:00 pm 
Offline

Joined: November 24th, 2005, 8:16 am
Posts: 851
Thanks Skan, nice to know.

I wish this would be more fluid through AHK.
Like, to let RegWrite / Del etc have a switch if I want it to invoke UAC or not.

Also, one thing I think AHK should definitely have, is some easy "add context menu action" commands (add and remove), as I suspect this is something that many users need for their AHKs.

Right now, each user has to do their own registry messing.

_________________
Sector-Seven - Freeware tools built with AutoHotkey


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 14th, 2010, 3:25 pm 
Offline

Joined: July 10th, 2008, 8:49 am
Posts: 1865
Location: Brussels, Belgium
Icarus wrote:
Right now, each user has to do their own registry messing.


You know that most users don't use registry anyway ? :P

Use INI file for example...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 14th, 2010, 3:27 pm 
Offline

Joined: November 24th, 2005, 8:16 am
Posts: 851
CodeKiller wrote:
You know that most users don't use registry anyway ? :P
Use INI file for example...


Dude... I am with you but some things - like adding a context menu item to Windows Explorer - requires registry manipulation.

_________________
Sector-Seven - Freeware tools built with AutoHotkey


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 14th, 2010, 3:43 pm 
Offline

Joined: July 10th, 2008, 8:49 am
Posts: 1865
Location: Brussels, Belgium
Sorry, I didn't understand it's what you are looking to do... :-p

For the admin rights, why don't you just use the "right click run as adminsitrator" ???


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 14th, 2010, 4:06 pm 
Offline

Joined: November 24th, 2005, 8:16 am
Posts: 851
CodeKiller wrote:
Sorry, I didn't understand it's what you are looking to do... :-p

For the admin rights, why don't you just use the "right click run as adminsitrator" ???


heh :)

Yeah, right click does the trick of course, but I wanted to be more user friendly by letting the application run normally, and only when admin rights are needed (when the user selects an option) then the UAC dialog pops in.

Without this, the only way I have now, is to intercept the fact that the operation failed (no admin rights) and pop my own dialog, telling the user "Please run as administrator" - which is quite lame... :)

Also - I was speaking more in general terms - AutoHotkey does not provide any way for me to deal with UAC - I was hoping that some actions may be told to go through the "elevation request" process.

_________________
Sector-Seven - Freeware tools built with AutoHotkey


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 14th, 2010, 4:26 pm 
Offline

Joined: July 10th, 2008, 8:49 am
Posts: 1865
Location: Brussels, Belgium
It's not AHK that doesn't let you use use UAC, it's just Windows that don't let you choose because it doesn't detect AHK need Admin right to be run. :wink:

Have you tried the admin stuff :

Code:
if not A_IsAdmin
{
   DllCall("shell32\ShellExecuteA", uint, 0, str, "RunAs", str, A_AhkPath
      , str, """" . A_ScriptFullPath . """", str, A_WorkingDir, int, 1)
   ExitApp
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 14th, 2010, 4:38 pm 
Offline

Joined: November 24th, 2005, 8:16 am
Posts: 851
CodeKiller wrote:
Have you tried the admin stuff :


Man! This is great!
Very useful, thanks.

Is this taken from a thread on the forums? If so, link please? Wanna see if there is more good stuff there.

_________________
Sector-Seven - Freeware tools built with AutoHotkey


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 14th, 2010, 4:48 pm 
Icarus wrote:
CodeKiller wrote:
Have you tried the admin stuff :


Man! This is great!
Very useful, thanks.

Is this taken from a thread on the forums? If so, link please? Wanna see if there is more good stuff there.
Shame on you, always FIRST look in and search the help file (it has a good text search feature). Here is the online link http://www.autohotkey.com/docs/Variables.htm#BuiltIn


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 14th, 2010, 5:02 pm 
Offline

Joined: November 24th, 2005, 8:16 am
Posts: 851
Anonymous wrote:
Shame on you, always FIRST look in and search the help file (it has a good text search feature). Here is the online link http://www.autohotkey.com/docs/Variables.htm#BuiltIn


So I got RTFMed... very well... :)
Actually, I did look but for the wrong things...

_________________
Sector-Seven - Freeware tools built with AutoHotkey


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], XstatyK and 68 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group