Sign in to follow this  
Followers 0
merde

RegWrite ?

10 posts in this topic

#1 ·  Posted (edited)

Hello,

I am trying to write the following code through autoit with RegWrite Function and i don't know how we do ! :(

REGEDIT4

[HKEY_CLASSES_ROOT\Drive\shell\TOTO]

@="Trouver ici"

[HKEY_CLASSES_ROOT\Drive\shell\TOTO\command]

@="\"Q:\\TOTO\\cute.exe\" /PAUSE /SUB \"%1\""

[HKEY_CLASSES_ROOT\Directory\shell\TOTO]

@="Trouver ici"

[HKEY_CLASSES_ROOT\Directory\shell\TOTO\command]

@="\"Q:\\TOTO\\cute.exe\" /UNZIP /MIME /SUB \"%1\""

[HKEY_CLASSES_ROOT\*\shell\TOTO]

@="Trouver ici"

[HKEY_CLASSES_ROOT\*\shell\TOTO\command]

@="\"Q:\\TOTO\\cute.exe\" /UNZIP /MIME /ALL \"%1\""

As well, i would like to use a variable like this "%SystemDrive%\\TOTO\\cute.exe\" /UNZIP /MIME /ALL \"%1"

Can you help me ?

THANKS

PS : sorry for my language but i am french :)

Edit : "$" at the end of the code was a mistake :D

Edited by merde

Share this post


Link to post
Share on other sites



HI,

have you looked at the helpfile?

; Write a single REG_SZ value
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Test", "TestKey", "REG_SZ", "Hello this is a test")

The example is very good.

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

Hello th.meger,

Off course i read the help but the instructions don't work if i include all the command.

Look at the code :)

Share this post


Link to post
Share on other sites

You just put more RegWrite statements until you cover each bit of information.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I would guess that you are having issues with "

test that you are sending the correct values with the MSGBOX function, like so:

$var1 = "\"Q:\\TOTO\\cute.exe\" /PAUSE /SUB \"%1\""
MsgBox(0,"var1",$var1)

$var2 = "\Q:\TOTO\cute.exe /PAUSE /SUB"
MsgBox(0,"var2",$var2)

then once you are certain you are using the values you want, try using the RegWrite function stick the variables into the registry where you want them, like so:

RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE", "TestKey", "REG_SZ", $var2)
Edited by SpookMeister

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Thanks for your answer :)

I am trying your code SpookMeister but there's error :

ERROR: syntax error

$var1 = "\"Q

You haven't got this error when you do a beta run ?

Edited by merde

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

basic idea..

Regwrite('HKEY_CLASSES_ROOT\Drive\shell\','TOTO','REG_SZ',"Trouver ici")
Regwrite('HKEY_CLASSES_ROOT\Drive\shell\','TOTO\command','REG_SZ','"\"Q:\TOTO\cute.exe\" /PAUSE /SUB \"%1\""')
Regwrite('HKEY_CLASSES_ROOT\Directory\shell\','TOTO','REG_SZ',"Trouver ici")
Regwrite('HKEY_CLASSES_ROOT\Directory\shell\','TOTO\command','REG_SZ','"\"Q:\TOTO\cute.exe\" /UNZIP /MIME /SUB \"%1\""')
Regwrite('HKEY_CLASSES_ROOT\*\shell\','TOTO','REG_SZ','Trouver ici')
Regwrite('HKEY_CLASSES_ROOT\*\shell\','TOTO\command','REG_SZ','"\"Q:\TOTO\cute.exe\" /UNZIP /MIME /ALL \"%1\""$')

you need ' infront and back to use quotes

$var1 = '"\"Q:\\TOTO\\cute.exe\" /PAUSE /SUB \"%1\""'
MsgBox(0,"var1",$var1)

$var2 = "\Q:\TOTO\cute.exe /PAUSE /SUB"
MsgBox(0,"var2",$var2)
Edited by slightly_abnormal

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

@merde

No need for / escape chars to be used with AutoIt's Registry functions. Reg_Expand_sz will add your environmental variable into the Registry. And your last write has a trailing $ char which I cannot consider why that is there.

RegWrite('HKCR\Drive\shell\TOTO', '', 'Reg_sz', 'Trouver ici')
RegWrite('HKCR\Drive\shell\TOTO\command', '', 'Reg_Expand_sz', '"%SystemDrive%\TOTO\cute.exe" /PAUSE /SUB "%1"')
RegWrite('HKCR\Directory\shell\TOTO', '', 'Reg_sz', 'Trouver ici')
RegWrite('HKCR\Directory\shell\TOTO\command', '', 'Reg_Expand_sz', '"%SystemDrive%\TOTO\cute.exe" /UNZIP /MIME /SUB "%1"')
RegWrite('HKCR\*\shell\TOTO', '', 'Reg_sz', 'Trouver ici')
RegWrite('HKCR\*\shell\TOTO\command', '', 'Reg_Expand_sz', '"%SystemDrive%\TOTO\cute.exe" /UNZIP /MIME /ALL "%1""$')

:)

Edited by MHz

Share this post


Link to post
Share on other sites

There are a few script kicking around the forum that will convert the raw reg entries into AutoIt commands. Worth a quick search.

-mu

Share this post


Link to post
Share on other sites

Thank you very much !

That's work ! :)

Every body Thank you for your help.

A bientôt.

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  
Followers 0