Markir Posted February 15, 2005 Share Posted February 15, 2005 Hello everybody, I have a problem with the following code: Func Export() If GUICtrlRead($checkCN_MRS) = $GUI_CHECKED Then If FileExists("c:\Marc.reg") Then FileMove("c:\Marc.reg", "c:\Marc.bak") Else RUN('regedit /e c:\Marc.reg "HKEY_LOCAL_MACHINE\SOFTWARE\PrintKey\PrintKey2000\5.0.3"') MsgBox(0,'Export','Daten Exportiert') Endif Endif EndFunc I want to realise the following project: checkbox enabled --> save registrykey file marc.reg exist --> rename marc.reg in marc.bak and save the registrykey in marc.reg Can somebody help me? Link to comment Share on other sites More sharing options...
zcoacoaz Posted February 15, 2005 Share Posted February 15, 2005 (edited) Func Export() If GUICtrlGetState($checkCN_MRS) = $GUI_CHECKED Then If FileExists("c:\Marc.reg") Then FileMove("c:\Marc.reg", "c:\Marc.bak") Else RUN('regedit /e c:\Marc.reg "HKEY_LOCAL_MACHINE\SOFTWARE\PrintKey\PrintKey2000\5.0.3"') MsgBox(0,'Export','Daten Exportiert') Endif Endif EndFunc that should do it edit: instead of running regedit why not use the reg functions that are already in autoit? Edited February 15, 2005 by Xenogis [font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font] Link to comment Share on other sites More sharing options...
Markir Posted February 15, 2005 Author Share Posted February 15, 2005 You've been right, but then I have both files ( marc.reg, marc.bak ) then it should be the following rename marc.reg marc.bak then regexport into the file marc.reg and that doens't go Link to comment Share on other sites More sharing options...
zcoacoaz Posted February 15, 2005 Share Posted February 15, 2005 oh, i understand what your doing. i guess in this case it is better not to use the built-in functions. [font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font] Link to comment Share on other sites More sharing options...
MHz Posted February 15, 2005 Share Posted February 15, 2005 Func Export() If GUICtrlRead($checkCN_MRS) = $GUI_CHECKED Then If FileExists("c:\Marc.reg") Then FileMove("c:\Marc.reg", "c:\Marc.bak") RUN(@ComSpec & ' /c reg export "HKEY_LOCAL_MACHINE\SOFTWARE\PrintKey\PrintKey2000\5.0.3" "c:\Marc.reg"') MsgBox(0,'Export','Daten Exportiert') Endif Endif EndFunc Maybe something like this? Use reg.exe instead. Link to comment Share on other sites More sharing options...
Markir Posted February 15, 2005 Author Share Posted February 15, 2005 I think that was the result, but i want to use the regedit function Link to comment Share on other sites More sharing options...
Markir Posted February 16, 2005 Author Share Posted February 16, 2005 Has somebody another idea to solve the problem without an external program? Link to comment Share on other sites More sharing options...
Markir Posted February 18, 2005 Author Share Posted February 18, 2005 Can somebody help me with this problem? Link to comment Share on other sites More sharing options...
Developers Jos Posted February 18, 2005 Developers Share Posted February 18, 2005 Hello everybody,I have a problem with the following code:Func Export() If GUICtrlRead($checkCN_MRS) = $GUI_CHECKED Then If FileExists("c:\Marc.reg") Then FileMove("c:\Marc.reg", "c:\Marc.bak") Else RUN('regedit /e c:\Marc.reg "HKEY_LOCAL_MACHINE\SOFTWARE\PrintKey\PrintKey2000\5.0.3"') MsgBox(0,'Export','Daten Exportiert') Endif Endif EndFuncI want to realise the following project:checkbox enabled --> save registrykeyfile marc.reg exist --> rename marc.reg in marc.bak and save the registrykey in marc.regCan somebody help me?<{POST_SNAPBACK}>Maybe you are looking for this??? (its not really clear what you are looking for):Func Export() If GUICtrlRead($checkCN_MRS) = $GUI_CHECKED Then If FileExists("c:\Marc.reg") Then FileMove("c:\Marc.reg", "c:\Marc.bak") EndIf Run('regedit /e c:\Marc.reg "HKEY_LOCAL_MACHINE\SOFTWARE\PrintKey\PrintKey2000\5.0.3"') EndIf EndFunc ;==>Export SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Markir Posted February 18, 2005 Author Share Posted February 18, 2005 I have used the following code: If GUICtrlRead($checkCN_MRS) = $GUI_CHECKED Then If FileExists("c:\Marc.reg") Then FileMove("c:\Marc.reg", "c:\Marc.bak") EndIf Run('regedit /e c:\Marc.reg "HKEY_LOCAL_MACHINE\SOFTWARE\PrintKey\PrintKey2000\5.0.3"') EndIf So I want to get the following function: 1.) Somebody has the checkbox enabled, the registry key will be exporting. In that moment the program should look, if the file marc.reg exist, then rename marc.reg in marc.bak. 2.) When I use the code at a third time, it shoulb be do this: Rename marc.reg --> marc.bak, and then export the regkey. Now the following function is: marc.reg will be the newest file, that is okay, but then i used the program at a third time, the marc.bak already has the value of the first export. I hope that would help yaou to help me. Thank you! Link to comment Share on other sites More sharing options...
Developers Jos Posted February 18, 2005 Developers Share Posted February 18, 2005 marc.reg will be the newest file, that is okay, but then i used the program at a third time, the marc.bak already has the value of the first export.<{POST_SNAPBACK}>ok so filemove doesn't replace the old file...try it with : FileMove("c:\Marc.reg", "c:\Marc.bak",1)FileMove ( "source", "dest" [, flag] )Parameterssource The source path and filename of the file to move. (* wildcards are supported) dest The destination path and filename of the moved file. (* wildcards are supported) flag [optional] this flag determines whether to overwrite files if they already exist: 0 = (default) do not overwrite existing files 1 = overwrite existing files SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Markir Posted February 18, 2005 Author Share Posted February 18, 2005 Okay thanks you, have a nice evening 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