Jump to content

XML search get change settings.


FMS
 Share

Recommended Posts

Hello ,

I've the following problem and hope somebody can push me in the right direction or have a good example on how to do it.
The problem is :I want to search / select / change /check a XML setting in a XML file.

The example XML file is as following :

<Configuration>
  <Categories>
    <Category Name="default">
      <SubCategories>
        <SubCategory Name="defaultsettings">
          <Settings>
            <Setting Name="machinename" TypeName="System.String" Value="defaultname" />
            <Setting Name="cpuspeed" TypeName="System.String" Value="false" />
            <Setting Name="cmptemp" TypeName="System.String" Value="false" />
            <Setting Name="cmpspeed_set" TypeName="System.String" Value="" />
            <Setting Name="cmptemp_set" TypeName="System.String" Value="" />
          </Settings>
        </SubCategory>
      </SubCategories>
    </Category>
    <Category Name="settings">
      <SubCategories>
        <SubCategory Name="comp1">
          <Settings>
            <Setting Name="machinename" TypeName="System.String" Value="comp1" />
            <Setting Name="cpuspeed" TypeName="System.String" Value="true" />
            <Setting Name="cmptemp" TypeName="System.String" Value="false" />
            <Setting Name="cmpspeed_set" TypeName="System.String" Value="12" />
            <Setting Name="cmptemp_set" TypeName="System.String" Value="" />
          </Settings>
        </SubCategory>
        <SubCategory Name="comp2">
          <Settings>
            <Setting Name="machinename" TypeName="System.String" Value="comp2" />
            <Setting Name="cpuspeed" TypeName="System.String" Value="false" />
            <Setting Name="cmptemp" TypeName="System.String" Value="true" />
            <Setting Name="cmpspeed_set" TypeName="System.String" Value="" />
            <Setting Name="cmptemp_set" TypeName="System.String" Value="9" />
          </Settings>
        </SubCategory>
      </SubCategories>
    </Category>
  </Categories>
</Configuration>

In this XML file I want to :

-search if subcategory whit the name "comp3" exists
-if exist change of setting "cpuspeed" value to false
-if not exist make a new subcategory "comp3" whit the default settings from subcategory "default settings"

what i have this far is :

Func xml_test1()
   Dim $return[0]
   Local $file = @ScriptDir & "\test.xml"
   FileOpen($file, $FO_READ)
   _FileReadToArray($file,$return)
   FileClose($file)
         msg("",$return[28])
         msg("",$return[29])
EndFunc
   
func xml_test2()
   Local $file = @ScriptDir & "\test.xml"
   Local $oXML = ObjCreate("Microsoft.XMLDOM")
;~    $oXML.load("D:\___BUILDS___\___SRMT___\test.xml")
   $oXML.load($file)
   
   $oOther= $oXML.SelectSingleNode("//Configuration/Categories/Category/SubCategories/SubCategory/Settings/Setting") ; or //other
   ConsoleWrite("$oOther.text=[" & $oOther.text & "]" & @CRLF)
EndFunc

i know it is not enough what I'm trying to do but I'm realy stuk in what to do next.
I've searched in the XML.udf but could not find in the examples what to do what i want to do.
The things what i found are about <settings>false</settings> writing style of XML and not the way I've the XML.
(or I'm reading it wrong)

Is there somebody who can help me on mine way or has a good example script?

Thanks in advanced
 

Edited by FMS

as finishing touch god created the dutch

Link to comment
Share on other sites

11 hours ago, FMS said:

-search if subcategory whit the name "comp3" exists

$oMatches = $oXML.selectNodes("SubCategory[Name='comp3']")
If $oMatches.Length>0 Then
    ;1 or more matches
Else
    ;no matches
EndIf

 

11 hours ago, FMS said:

-if exist change of setting "cpuspeed" value to false

For $i=0 To $oMatches.Length-1
    $oMatches.Item($i).selectSingleNode(".//Setting[@Name='cpuspeed']").SetAttribute("Value", "False"); Using selectSingleNode due to expectation that it only appears once withing the match?
Next

 

11 hours ago, FMS said:

-if not exist make a new subcategory "comp3" whit the default settings from subcategory "default settings"

$oMatch = $oXML.selectSingleNode("//Category[@Name='default']//SubCategory[@Name='defaultsettings']")
$oNode = $oMatch.CloneNode( True )
$oNode.SetAttribute("Name", "comp3")
$oNode.selectSingleNode(".//Setting[@Name='cpuspeed']").SetAttribute("Value", "false")
$oMatch = $oXML.selectSingleNode("//Category[@Name='settings']/SubCategories")
$oMatch.AppendChild( $oNode )

MsgBox(0, "", $oXML.xml); showing the xml after changes

 

Now I'm a bit lazy, so i did not add much error checking... but you can check up on the documentation, should you need it:

DOM Reference

XPath Syntax

IXMLDOMElement Members

 

Let me know if you need further help, or this makes no sense to you :)

Edited by genius257
Link to comment
Share on other sites

hello,
 

thanks for the example script @genius257.
I think i got it (for a bit i must say)
I fiddeled something around whit it because it was indeed something rocky code :)
(strangly i got a error whish i don't understand - "Variable used without being declared. - > For $i=0 To $oMathes.Length-1")
But this variable was made a sentence before :
 

Local $file = @ScriptDir & "test.xml"
Local $oXML = ObjCreate("Microsoft.XMLDOM")
$oXML.load($file)
;-if exist change of setting "cpuspeed" value to false
$oMatches = $oXML.selectNodes("SubCategory[Name='comp3']")
If $oMatches.Length>0 Then
    ConsoleWrite("hit = 1 or more" & @CRLF)
Else
    ConsoleWrite("hit = 0" & @CRLF)
EndIf

;-if exist change of setting "cpuspeed" value to false

For $i=0 To $oMathes.Length-1
    $oMatches.Item($i).selectSingleNode(".//Setting[@Name='cpuspeed']").SetAttribute("Value", "False"); Using selectSingleNode due to expectation that it only appears once withing the match?
Next
ConsoleWrite("setting should be changed cpuspeed = False" & @CRLF)
;-if not exist make a new subcategory "comp3" whit the default settings from subcategory "default settings"

$oMatch = $oXML.selectSingleNode("//Category[@Name='default']//SubCategory[@Name='defaultsettings']")
$oNode = $oMatch.CloneNode( True )
$oNode.SetAttribute("Name", "comp3")
$oNode.selectSingleNode(".//Setting[@Name='cpuspeed']").SetAttribute("Value", "false")
$oMatch = $oXML.selectSingleNode("//Category[@Name='settings']/SubCategories")
$oMatch.AppendChild( $oNode )
ConsoleWrite("section comp3 should be present" & @CRLF)
MsgBox(0, "", $oXML.xml); showing the xml after changes

anyway ,
i made 2 functions for it whish i hope u can help me whit.
The first funcion is to change the variable
Here he din't find any but i know it's there, so i fiddled around whit the $LC_hits (nothing found this far:))
if it lays on this i dont know.
 

Func XML_change()
   Local $LC_XML_file = @ScriptDir & "LocalSettings_forum.xml"
   Local $LC_XML_obj = ObjCreate("Microsoft.XMLDOM")
   $LC_XML_obj.load($LC_XML_file)
;~    Local $LC_hits = $LC_XML_obj.selectNodes("//Configuration/Categories/Category/SubCategories/SubCategory[name='Initialization']")
;~    Local $LC_hits = $LC_XML_obj.selectNodes("SubCategory[name='comp1']")
   Local $LC_hits = $LC_XML_obj.selectNodes("//Configuration//Categories//Category[@name='default']//SubCategory[name='comp1']")
   If $LC_hits.length = 0 Then
      ConsoleWrite("hit = 0" & @CRLF)
   ElseIf $LC_hits.length = 1 Then
      ConsoleWrite("hit = 1 " & @CRLF)
      For $i = 0 To $LC_hits.length - 1
         $LC_hits.Item($i).SelectSingleNode(".//Setting[@name='PosId']").SetAttribute("Value","1")
      Next
      ConsoleWrite("value should be changed" & @CRLF)
   ElseIf $LC_hits.length > 1 Then
      ConsoleWrite("hit = more then 1" & @CRLF)
   EndIf
EndFunc

The second function i made is to search and make
here i get an error " The requested action with this object has failed." -> ""Local $LC_XML_node = $LC_hit.CloneNode( True )"
and possibly also that he cant find even if it exist.

Func XML_search_or_make()
   Local $LC_XML_file = @ScriptDir & "LocalSettings_forum.xml"
   Local $LC_XML_obj = ObjCreate("Microsoft.XMLDOM")
   $LC_XML_obj.load($LC_XML_file)
;~    Local $LC_hits = $LC_XML_obj.selectNodes("//Configuration/Categories/Category/SubCategories/SubCategory[name='Initialization']")
   Local $LC_hits = $LC_XML_obj.selectNodes("SubCategory[name='comp3']")
   If $LC_hits.length = 0 Then
      ConsoleWrite("hit = 0" & @CRLF)
      Local $LC_hit = $LC_XML_obj.SelectSingleNode("//Category[@name='default']//SubCategory[@name='defaultsettings']")
      Local $LC_XML_node = $LC_hit.CloneNode( True )
      $LC_XML_node.SetAttribute["Name","Comp3"]
      $LC_XML_node.selectSingleNode(".//Setting[@name='cpuspeed']".SetAttribute("Value","false")
      $LC_hit = $LC_XML_obj.selectSingleNode("//Category[@name='settings']/Subcategories")
      $LC_hit.AppendChild( $LC_XML_node )
      MsgBox(0,"",$LC_XML_obj.xml)
   ElseIf $LC_hits.length = 1 Then
      ConsoleWrite("hit = 1" & @CRLF)
   ElseIf $LC_hits.length > 1 Then
      ConsoleWrite("hit = more then 1" & @CRLF)
   EndIf
EndFunc

Could somebody help whit this?

PS. Are there any includes i need for all this?

Thanks in advanced.

 


 

as finishing touch god created the dutch

Link to comment
Share on other sites

5 minutes ago, FMS said:

(strangly i got a error whish i don't understand - "Variable used without being declared. - > For $i=0 To $oMathes.Length-1")

Sorry, that's my mistake :sweating:

I mispelled a variable in my second answer:

$oMathes

should be:

$oMatches

I will edit it in the post above right away :>

 

7 minutes ago, FMS said:

here i get an error " The requested action with this object has failed." -> ""Local $LC_XML_node = $LC_hit.CloneNode( True )"

That's what i was talking about with the error handling i did not do much of. "SelectSingleNode" will return a null object, if no match was found, whereas the selectNodes return a collection you can measure the length of. So the error is the result of you trying to call a function that does not exist in a null object.

 

11 minutes ago, FMS said:

PS. Are there any includes i need for all this?

For my examples? No.

Link to comment
Share on other sites

 lol I din't find that misspelling :S.
But i must say I'm a little lost in what you say.....
I tried to correct it in the code but dont know how to start.
Could u help me correct the 2 functions?
Or did you mean the code i've written will never work?
 

as finishing touch god created the dutch

Link to comment
Share on other sites

20 minutes ago, FMS said:

Could u help me correct the 2 functions?

I'll give it a look :)

Edit:

Could you post the xml, if it's different than the original?

Edited by genius257
Link to comment
Share on other sites

So I've added some comments explaining some of the errors.

But mostly it's just comes down to the fact that you need to be case specific so something like "Subcategories" would fail, but "SubCategories" would work

Func XML_change()
;~    Local $LC_XML_file = @ScriptDir & "LocalSettings_forum.xml"
   Local $LC_XML_file = @ScriptDir & "test.xml"
   Local $LC_XML_obj = ObjCreate("Microsoft.XMLDOM")
   $LC_XML_obj.load($LC_XML_file)
;~    Local $LC_hits = $LC_XML_obj.selectNodes("//Configuration/Categories/Category/SubCategories/SubCategory[name='Initialization']")
;~    Local $LC_hits = $LC_XML_obj.selectNodes("SubCategory[name='comp1']")
   Local $LC_hits = $LC_XML_obj.selectNodes("//Configuration//Categories//Category[@name='default']//SubCategory[name='comp1']")
   If $LC_hits.length = 0 Then
      ConsoleWrite("hit = 0" & @CRLF)
   ElseIf $LC_hits.length = 1 Then
      ConsoleWrite("hit = 1 " & @CRLF)
      For $i = 0 To $LC_hits.length - 1
         $LC_hits.Item($i).SelectSingleNode(".//Setting[@name='PosId']").SetAttribute("Value","1")
      Next
      ConsoleWrite("value should be changed" & @CRLF)
   ElseIf $LC_hits.length > 1 Then
      ConsoleWrite("hit = more then 1" & @CRLF)
   EndIf
EndFunc
Func XML_search_or_make()
;~    Local $LC_XML_file = @ScriptDir & "LocalSettings_forum.xml"
   Local $LC_XML_file = @ScriptDir & "\test.xml"
   Local $LC_XML_obj = ObjCreate("Microsoft.XMLDOM")
   $LC_XML_obj.load($LC_XML_file)
;~    Local $LC_hits = $LC_XML_obj.selectNodes("//Configuration/Categories/Category/SubCategories/SubCategory[name='Initialization']")
   Local $LC_hits = $LC_XML_obj.selectNodes("SubCategory[name='comp3']")
   If $LC_hits.length = 0 Then
      ConsoleWrite("hit = 0" & @CRLF)
      Local $LC_hit = $LC_XML_obj.selectNodes("//Category[@Name='default']//SubCategory[@Name='defaultsettings']");the @Name must be case specific
      If Not ($LC_hit.Length>0) Then Return; Escape the function if no match is found
      Local $LC_XML_node = $LC_hit.Item(0).CloneNode( True )
;~       $LC_XML_node.SetAttribute["Name","Comp3"]; This should be called with parenthesis, not square brackets ^^'
      $LC_XML_node.SetAttribute("Name","Comp3")
;~       $LC_XML_node.selectSingleNode(".//Setting[@name='cpuspeed']".SetAttribute("Value","false"); you are missing a parenthesis
      $LC_XML_node.selectSingleNode(".//Setting[@Name='cpuspeed']").SetAttribute("Value","false")
      $LC_hit = $LC_XML_obj.selectSingleNode("//Category[@Name='settings']/SubCategories"); Subcategories should be SubCategories
      $LC_hit.AppendChild( $LC_XML_node )
      MsgBox(0,"",$LC_XML_obj.xml)
   ElseIf $LC_hits.length = 1 Then
      ConsoleWrite("hit = 1" & @CRLF)
   ElseIf $LC_hits.length > 1 Then
      ConsoleWrite("hit = more then 1" & @CRLF)
   EndIf
EndFunc

Sorry if i didn't remove all my garbage lines for debugging, I'm off to bed for now :)

Link to comment
Share on other sites

1 hour ago, FMS said:

unfortanyl i dont think the searching part in "change" function is working.

Well

Local $LC_hits = $LC_XML_obj.selectNodes("//Configuration//Categories//Category[@name='default']//SubCategory[name='comp1']")

Should be

Local $LC_hits = $LC_XML_obj.selectNodes("//Configuration//Categories//Category[@Name='default']//SubCategory[@Name='comp1']")

 

I hope you noticed that yourself, and yes i know that's my mistake :)

Second, the xml you posted, I test with does not have anything that would match your query, so it's hard to know if the function succeeds or not.

That's why i said:

On 10/9/2016 at 0:04 AM, genius257 said:

Could you post the xml, if it's different than the original?

 

Link to comment
Share on other sites

thank you very mush @genius257 , everything is working fine now :)
And no i din't find that typo :S it's mine dyslectia playing around whit me :)

Also I've learned some new things now, many thanks for that.
The final thing I cant work out is tho exaly write it to the XML file :)

I see it now changed in the :

MsgBox(0,"",$LC_XML_obj.xml)

But not in the file itself :S , I think it is a noobisch question but working whit XML is a new thing for me :)
Is there a special function to write it back to the XML itself?

 

as finishing touch god created the dutch

Link to comment
Share on other sites

I'm happy everyting is working :)

18 minutes ago, FMS said:

Is there a special function to write it back to the XML itself?

Yes and no :sweating:

It's not just one function, as you will have to overwrite the entire output in the file.

So something like:

$hFile = FileOpen(@ScriptDir & "\test.xml", 2);$FO_OVERWRITE
FileWrite($hFile, $LC_XML_obj.xml)
FileClose($hFile)

I would suggest looking into the help files and add error checking, if you wish to avoid problems. ^_^

They may end up wasting countless hours on debugging (i have that problem a lot :P)

Edited by genius257
Link to comment
Share on other sites

:lmao:rofl , no that can't be it.....
Stupid of me i din't think of doing that, i thought it was mush harder than that.
But what do you mean whit error checking on this 3 line of code?
maybe i don't understand it right but do u mean only check on fileopen , fileclose and filewrite?
Or do you mean if in the $LC_XML.obj is changed what i want to change?

 

as finishing touch god created the dutch

Link to comment
Share on other sites

Just now, FMS said:

But what do you mean whit error checking on this 3 line of code?

FileOpen may fail for various reasons, i imagine FileWrite is also worth checking, just in case. FileClose however don't need any error checking.

It's just a precaution, to avoid data not being saved before you close down the program, thinking everything is dandy ^_^

Link to comment
Share on other sites

o is that all :)
that's what i always do but thank you for pointing out :)
(even i check on fileclose , why i should't i don't now)
I probaly check everything i do i must say.
But final question i've got on mine mind if you are up for that.
Do i need also to properly dispose of the $LC_XML_obj because it's now loaded in ?
Or because it's locale in the function it's cleaning up itself?

That was mine final question , many thanks for helping me around this subject.
10.000 points for grifindor!

as finishing touch god created the dutch

Link to comment
Share on other sites

12 minutes ago, FMS said:

Do i need also to properly dispose of the $LC_XML_obj because it's now loaded in ?
Or because it's locale in the function it's cleaning up itself?

Well honestly I'm not 100% sure, i believe the local variables gets cleaned up by the garbage collector when the function ends. Personally i just leave it like that, but that question might be worth searching for in the forum, i believe I've seen it discussed.

12 minutes ago, FMS said:

That was mine final question , many thanks for helping me around this subject.
10.000 points for grifindor!

It was fun for me too :)
Haha! Why thank you :lol:

Edited by genius257
Link to comment
Share on other sites

humm I'm very sorry to disturb you again @genius257 but when i thought i got it  , a error was lurking around :>
I hope u can help me once more because i realy don't understand why it gives me this error.
When I was making this "Beta" function :

Func XML_change();hidden button 1
   Local $LC_XML_file = @ScriptDir & "\forum.xml"
   Local $LC_XML_obj = ObjCreate("Microsoft.XMLDOM")
   $LC_XML_obj.load($LC_XML_file)
   Local $LC_hits = $LC_XML_obj.selectNodes("//Configuration//Categories//Category[@Name='settings']//SubCategory[@Name='comp1']")
;~    MsgBox(0,"",$LC_XML_obj.xml)
   If $LC_hits.length = 0 Then
      ConsoleWrite("hit = 0" & @CRLF)
   ElseIf $LC_hits.length = 1 Then
      ConsoleWrite("hit = 1" & @CRLF)
      For $i = 0 To $LC_hits.length - 1
         $LC_hits.Item($i).SelectSingleNode(".//Setting[@name='cmptemp_set']").SetAttribute("Value","1")
      Next
      MsgBox(0,"",$LC_XML_obj.xml)
   ElseIf $LC_hits.length > 1 Then
      ConsoleWrite("hit = more then 1" & @CRLF)
   EndIf
EndFunc

I did got this error :

$LC_hits.Item($i).SelectSingleNode(".//Setting[@name='cmptemp_set']").SetAttribute("Value","1")
$LC_hits.Item($i).SelectSingleNode(".//Setting[@name='cmptemp_set']")^ ERROR

At first I thought it was the <settings> between <subcategory> and <setting> , but in no case it got me another error then this.
If I'm not mistaking it can't find the attribute value? (but can find //SubCategory[@Name='comp1'])


 

as finishing touch god created the dutch

Link to comment
Share on other sites

9 hours ago, FMS said:

I did got this error :

$LC_hits.Item($i).SelectSingleNode(".//Setting[@name='cmptemp_set']").SetAttribute("Value","1")
$LC_hits.Item($i).SelectSingleNode(".//Setting[@name='cmptemp_set']")^ ERROR

 

Yeah no match is returned from you query.

I bet if you notice the attribute name is all lower case, you find your answer. :)

hint:

@name

 

Link to comment
Share on other sites

10 hours ago, FMS said:

I did got this error :

$LC_hits.Item($i).SelectSingleNode(".//Setting[@name='cmptemp_set']").SetAttribute("Value","1")
$LC_hits.Item($i).SelectSingleNode(".//Setting[@name='cmptemp_set']")^ ERROR

 

You can not use such long onliner, you should pares it for each method to separate lines and check for errors  after each line.

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

pfff was that it the uppercase N :)
thanks, all works fine (again) @genius257

also thanks for pointing that out @mLipok , but i must say I'm rather new to XML searches and changes.
And realy don't know where you are talking about.
Could u show me what u mean>?

as finishing touch god created the dutch

Link to comment
Share on other sites

$step1 = $LC_hits.Item($i)
If @error ....
$step2 = $step1.SelectSingleNode(".//Setting[@name='cmptemp_set']")
If @error ....
$step3 = $step2.SetAttribute("Value","1")
If @error ....

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
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
 Share

×
×
  • Create New...