coucou Posted April 24, 2009 Posted April 24, 2009 Hello,I'm looking for how modifying a value in the here bellow .xml file %ProgramFiles%\muvee Technologies\muvee Reveal\hklm2.xml<AppLanguage valuetype="2" value="fr"expandcollapse popup<?xml version="1.0" encoding="utf-8" ?> - <My_Computer> - <HKEY_LOCAL_MACHINE> <BID valuetype="2" value="00000026" /> - <Default> <BitField valuetype="2" value="z7fzfdc002" /> - <Desc> <a1033 name="1033" valuetype="2" value="Default" /> <a2052 name="2052" valuetype="2" value="预设值" /> <a1028 name="1028" valuetype="2" value="預設" /> <a1030 name="1030" valuetype="2" value="Standard" /> <a1031 name="1031" valuetype="2" value="Vorgabe" /> <a3082 name="3082" valuetype="2" value="Predeterminado" /> <a1035 name="1035" valuetype="2" value="Oletus" /> <a1036 name="1036" valuetype="2" value="Par défaut" /> <a1040 name="1040" valuetype="2" value="Predefinito" /> <a1041 name="1041" valuetype="2" value="デフォルト" /> <a1042 name="1042" valuetype="2" value="기본값" /> <a1043 name="1043" valuetype="2" value="Standaard" /> <a1044 name="1044" valuetype="2" value="Default" /> <a1046 name="1046" valuetype="2" value="Padrão" /> <a2070 name="2070" valuetype="2" value="Pré-definido" /> <a1053 name="1053" valuetype="2" value="Standard" /> <a1049 name="1049" valuetype="2" value="По умолчанию" /> </Desc> </Default> <FirstTrialKey valuetype="2" value="0020AC-M8N1R0-J4BY5X-WBQ9BQ-19ACVJ" /> <PostMakeAlert valuetype="1" value="1" /> <AppPaths valuetype="2" value="C:\Program Files\muvee Technologies\muvee Reveal\" /> <ProductVersion valuetype="2" value="7.0.40.8982" /> <AppLanguage valuetype="2" value="" /> <TemplateDir valuetype="2" value="C:\Documents and Settings\All Users\Application Data\muvee Technologies\071203\0000\0026" /> <AppSamplesPath valuetype="2" value="C:\Program Files\muvee Technologies\muvee Reveal\Samples" /> <PrivateBuild valuetype="2" value="1068" /> <BuildId valuetype="2" value="2056" /> <PartnerID valuetype="2" value="" /> <DefaultStyle valuetype="2" value="S00516_Plain" /> </HKEY_LOCAL_MACHINE> </My_Computer>TNX for any helpcoucou
lordicast Posted April 24, 2009 Posted April 24, 2009 Hello,I'm looking for how modifying a value in the here bellow .xml file %ProgramFiles%\muvee Technologies\muvee Reveal\hklm2.xml<AppLanguage valuetype="2" value="fr"What "Value" thats pretty vague... [Cheeky]Comment[/Cheeky]
coucou Posted April 26, 2009 Author Posted April 26, 2009 Sorry, i thought my question is clear In fact, if you look closely the file content here above, you'll see this line<AppLanguage valuetype="2" value="" />I want adding fr in that line, as <AppLanguage valuetype="2" value="fr" /> I'll appreciate any helpcoucou
exodius Posted April 26, 2009 Posted April 26, 2009 Wouldn't this do it? $varcontainingyourxmltext = FileRead ("C:\Program Files\muvee Technologies\muvee Reveal\hklm2.xml") StringReplace ($varcontainingyourxmltext, <AppLanguage valuetype="2" value="" />, <AppLanguage valuetype="2" value="fr" />)
coucou Posted April 27, 2009 Author Posted April 27, 2009 TNX exodius for yr help, they were quotation missed. Anyway, the .xml file stay UNmodified $varcontainingyourxmltext=FileRead(@ProgramFilesDir & "\muvee Technologies\muvee Reveal\hklm2.xml") StringReplace($varcontainingyourxmltext, '<AppLanguage valuetype="2" value="" />', '<AppLanguage valuetype="2" value="fr" />')
water Posted April 27, 2009 Posted April 27, 2009 (edited) To rewrite the file you'll have to add $hFile = FileOpen("C:\Program Files\muvee Technologies\muvee Reveal\hklm2.xml",2) FileWrite($hFile,$varcontainingyourxmltext) FileClose($hFile)This will replace your xml file with the new content. Edited April 27, 2009 by water My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
PsaltyDS Posted April 27, 2009 Posted April 27, 2009 Hello, I'm looking for how modifying a value in the here bellow .xml file %ProgramFiles%\muvee Technologies\muvee Reveal\hklm2.xml <AppLanguage valuetype="2" value="fr" expandcollapse popup<?xml version="1.0" encoding="utf-8" ?> - <My_Computer> - <HKEY_LOCAL_MACHINE> <BID valuetype="2" value="00000026" /> - <Default> <BitField valuetype="2" value="z7fzfdc002" /> - <Desc> <a1033 name="1033" valuetype="2" value="Default" /> <a2052 name="2052" valuetype="2" value="预设值" /> <a1028 name="1028" valuetype="2" value="預設" /> <a1030 name="1030" valuetype="2" value="Standard" /> <a1031 name="1031" valuetype="2" value="Vorgabe" /> <a3082 name="3082" valuetype="2" value="Predeterminado" /> <a1035 name="1035" valuetype="2" value="Oletus" /> <a1036 name="1036" valuetype="2" value="Par défaut" /> <a1040 name="1040" valuetype="2" value="Predefinito" /> <a1041 name="1041" valuetype="2" value="デフォルト" /> <a1042 name="1042" valuetype="2" value="기본값" /> <a1043 name="1043" valuetype="2" value="Standaard" /> <a1044 name="1044" valuetype="2" value="Default" /> <a1046 name="1046" valuetype="2" value="Padrão" /> <a2070 name="2070" valuetype="2" value="Pré-definido" /> <a1053 name="1053" valuetype="2" value="Standard" /> <a1049 name="1049" valuetype="2" value="По умолчанию" /> </Desc> </Default> <FirstTrialKey valuetype="2" value="0020AC-M8N1R0-J4BY5X-WBQ9BQ-19ACVJ" /> <PostMakeAlert valuetype="1" value="1" /> <AppPaths valuetype="2" value="C:\Program Files\muvee Technologies\muvee Reveal\" /> <ProductVersion valuetype="2" value="7.0.40.8982" /> <AppLanguage valuetype="2" value="" /> <TemplateDir valuetype="2" value="C:\Documents and Settings\All Users\Application Data\muvee Technologies\071203\0000\0026" /> <AppSamplesPath valuetype="2" value="C:\Program Files\muvee Technologies\muvee Reveal\Samples" /> <PrivateBuild valuetype="2" value="1068" /> <BuildId valuetype="2" value="2056" /> <PartnerID valuetype="2" value="" /> <DefaultStyle valuetype="2" value="S00516_Plain" /> </HKEY_LOCAL_MACHINE> </My_Computer> TNX for any help coucou The XML file can be handled with eltorro's XML DOM UDF. This demo worked: #include <_XMLDOMWrapper.au3> $sXML = @ScriptDir & "\Test1.xml" $sPath = "/My_Computer/HKEY_LOCAL_MACHINE/AppLanguage" $sAttrib = "Value" $sValue = "fr" $oXML = _XMLFileOpen($sXML) _XMLSetAttrib($sPath, $sAttrib, $sValue) $oXML = 0 Using this cleaned up xml file for Test1.xml: expandcollapse popup<?xml version="1.0" encoding="utf-8"?> <My_Computer> <HKEY_LOCAL_MACHINE> <BID valuetype="2" value="00000026"/> <Default> <BitField valuetype="2" value="z7fzfdc002"/> <Desc> <a1033 name="1033" valuetype="2" value="Default"/> <a2052 name="2052" valuetype="2" value="???"/> <a1028 name="1028" valuetype="2" value="??"/> <a1030 name="1030" valuetype="2" value="Standard"/> <a1031 name="1031" valuetype="2" value="Vorgabe"/> <a3082 name="3082" valuetype="2" value="Predeterminado"/> <a1035 name="1035" valuetype="2" value="Oletus"/> <a1036 name="1036" valuetype="2" value="Par defaut"/> <a1040 name="1040" valuetype="2" value="Predefinito"/> <a1041 name="1041" valuetype="2" value="?????"/> <a1042 name="1042" valuetype="2" value="???"/> <a1043 name="1043" valuetype="2" value="Standaard"/> <a1044 name="1044" valuetype="2" value="Default"/> <a1046 name="1046" valuetype="2" value="Padrao"/> <a2070 name="2070" valuetype="2" value="Pre-definido"/> <a1053 name="1053" valuetype="2" value="Standard"/> <a1049 name="1049" valuetype="2" value="?? ?????????"/> </Desc> </Default> <FirstTrialKey valuetype="2" value="0020AC-M8N1R0-J4BY5X-WBQ9BQ-19ACVJ"/> <PostMakeAlert valuetype="1" value="1"/> <AppPaths valuetype="2" value="C:\Program Files\muvee Technologies\muvee Reveal\"/> <ProductVersion valuetype="2" value="7.0.40.8982"/> <AppLanguage valuetype="2" value="" Value="fr"/> <TemplateDir valuetype="2" value="C:\Documents and Settings\All Users\Application Data\muvee Technologies\071203\0000\0026"/> <AppSamplesPath valuetype="2" value="C:\Program Files\muvee Technologies\muvee Reveal\Samples"/> <PrivateBuild valuetype="2" value="1068"/> <BuildId valuetype="2" value="2056"/> <PartnerID valuetype="2" value=""/> <DefaultStyle valuetype="2" value="S00516_Plain"/> </HKEY_LOCAL_MACHINE> </My_Computer> Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
coucou Posted April 27, 2009 Author Posted April 27, 2009 TNX PsaltyDS,I just downloaded eltorro's XML DOM UDF latest version, put it in same directory as yr script. When I launch it, i get the following error messageLine 142 (file _XMLDomWrapper.au3)Func _XMLFileOpen($strXMLFile, $strNameSpc = "", $iVer = -1, $bValOnParse = True)Error "If" statement has not matching "EndIf" statementAnywat i thing that is too much script for a small modificationRegardscoucou
bluebearr Posted April 27, 2009 Posted April 27, 2009 This should do it:$sFile = "C:\Program Files\muvee Technologies\muvee Reveal\hklm2.xml" $varcontainingyourxmltext=FileRead($sFile) $varcontainingyourxmltext = StringReplace($varcontainingyourxmltext, '<AppLanguage valuetype="2" value="" />', _ '<AppLanguage valuetype="2" value="fr" />') $hFile = FileOpen($sFile,2) FileWrite($hFile,$varcontainingyourxmltext) FileClose($hFile)BlueBearr BlueBearrOddly enough, this is what I do for fun.
coucou Posted April 28, 2009 Author Posted April 28, 2009 Wooowww Many TNX BlueBearr works like a charm coucou
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