View previous topic :: View next topic |
Author |
Message |
Dr. Dread Professional Member
Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Tue Jun 14, 2005 7:52 pm Post subject: Hotkey & Regread |
|
|
I wannna set a hotkey for a program. Works, but if I use REGREAD to poll for a registry key that does not exist yet,
HOTKEY fails. Try this:
Code: | DIALOG CREATE,New Dialog,-1,0,240,160
DIALOG SHOW
REM Hotkey fails íf the next line is run
%%regkey = @equal(@REGREAD(CURUSER,SOFTWARE\somecompany\key,value,1),1)
HOTKEY ADD,Ctrl+F9
if @not(@ok())
warn Hotkey not activated!
end |
If the registry key is there, no problem.
Greetz
Dr. Dread _________________ ~~ Alcohol and calculus don't mix... Don't drink and derive! ~~
String.DLL * advanced string processing |
|
Back to top |
|
|
Aslan Valued Contributor
Joined: 31 May 2001 Posts: 589 Location: Memphis, TN USA
|
Posted: Wed Jun 15, 2005 3:43 am Post subject: |
|
|
%%regkey = @equal(@REGREAD(CURUSER,SOFTWARE\somecompany\key,value,1),1)
The above statement is false
Try
Code: |
DIALOG CREATE,New Dialog,-1,0,240,160
DIALOG SHOW
If @regexists(CURUSER,SOFTWARE\somecompany\key,value)
if @not(@equal(@REGREAD(CURUSER,SOFTWARE\somecompany\key,value,1),1))
warn Key value not 1
end
else
warn Key doesn't exist
end
HOTKEY ADD,Ctrl+F9
if @not(@ok())
warn Hotkey not activated!
end
exit
|
|
|
Back to top |
|
|
Dr. Dread Professional Member
Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Wed Jun 15, 2005 6:07 am Post subject: |
|
|
Aslan wrote: | %%regkey = @equal(@REGREAD(CURUSER,SOFTWARE\somecompany\key,value,1),1)
The above statement is false |
Aaah, yeah. Forgot to remove the @equal() part when simplifying things for the example.
So it should be something like this.
Code: | DIALOG CREATE,New Dialog,-1,0,240,160
DIALOG SHOW
rem Hotkey fails íf the next line is run
%%regkey = @REGREAD(CURUSER,SOFTWARE\somecompany\key,value,1)
HOTKEY ADD,Ctrl+F9
if @not(@ok())
warn Hotkey not activated!
else
info Hotkey OK!
end |
It is probably a good idea to use REGEXISTS to check the key in advance. But I still think that it
is a bug when you cannot use REGREAD directly coz it actually is supplied with the default value 1 to be
returned if the specified key does not exist.
Greetz
Dread _________________ ~~ Alcohol and calculus don't mix... Don't drink and derive! ~~
String.DLL * advanced string processing |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|