Forum Replies Created
I have no code at this time. Only that XML example which I shared earlier.
This is the exact problem. The unique value is the data INSIDE the tags. I need to be able to differentiate one tag of the same name from another in code. The fact that one tag may be the parent tag…. great! I am assuming that will be the first tag listed. The problem is the XML document will change from time to time the number of “Same Name” tags it has in it, and the data will be different every time. In the example above that I have listing three video files, the next XML sheet to be used will: 1. have a different XML name altogether, 2. Have a different number of video files and associated “Same Named” tags, AND will have different data that needs to be updated in one, some, or all of the same named tags. So again, some sample code of showing how to overcome these multiple issues in powershell would be appreciated. I was thinking of something like regex expressions, but need some sample code showing how to overcome these multiple obstacles kvprasoon, or anyone else out there who can give me something other than a “general answer”. Thank you and God bless you!!!
My thoughts exactly. Thank you
OK Tony, here is a sample of the XML I wish to change.
Notice all the similar tag names:PowerShell1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677<type>subtitles</type><eBarcode>E2135087</eBarcode><componentId>4732621</componentId><fileName>HBOMAXLAT_LIGHTS_OUT_16x9_E2056834_FEATURE_2_0_LTRT_8800521_ENGLISH_SDH.itt</fileName><size>80022</size><checksumValue>7046d57a5d9b47e66848e2ca724668cf</checksumValue><checksumType>md5</checksumType><territory/><language iso="EN">ENGLISH</language><textType>SDH</textType><format>ITT</format></subtitle>-<subtitle><type>subtitles</type><eBarcode>E2134720</eBarcode><componentId>4732668</componentId><fileName>HBOMAXLAT_LIGHTS_OUT_16x9_E2056834_FEATURE_2_0_LTRT_8800521_PORTUGUESE_BRAZIL_FORCED.itt</fileName><size>4590</size><checksumValue>b403db2252c7be0a9e0d3c7a921eeea7</checksumValue><checksumType>md5</checksumType><territory/><language iso="PT_BR">PORTUGUESE_BRAZIL</language><textType>FORCED</textType><format>ITT</format></subtitle>-<subtitle><type>subtitles</type><eBarcode>E2134889</eBarcode><componentId>4732307</componentId><fileName>HBOMAXLAT_LIGHTS_OUT_16x9_E2056834_FEATURE_2_0_LTRT_8800521_SPANISH_LATIN_FORCED.itt</fileName><size>4839</size><checksumValue>9b936a026a444ad18209935ee57a5039</checksumValue><checksumType>md5</checksumType><territory/><language iso="ES">SPANISH_LATIN</language><textType>FORCED</textType><format>ITT</format></subtitle>
You will notice all the similar tag names. Can you provide some sample code of how to choose which tag gets the new data that I wish to input?
Let me ask you this Matt:
How would you get that particular script you wrote to go off at the quarter mark, (15, 30, 45, top of the hour), of every hour in the day continuously?
Any scripting examples you would like to share based on your initial response please?
For Xpaths in PowerShell research I can find many examples and uses for this tool for a specific NODE. Doesn’t seem to work when you have multiple nodes with the same name within one XML document.
Also the above mentioned tool has a primary use of Query inside XML document, not updating data with in a Node.
Your thoughts Mr. Kvprasoon?
- This reply was modified 3 months, 1 week ago by nal2us224.
ok thank you
Last thread is VERY HELPFUL for changing text in one node. i.e. <size>”Data Needing to be Changed”</size>.
But what if that same XML file has multiple nodes with the same name? How can you tell PowerShell which node to apply the change to?
i.e. <size>”Data Needing to be Changed”</size>
further down in the script another instance of same thing:
<size>”Data Needing to be Changed”</size>
further down in the script same thing… and so on.
How can powershell tell the difference so it knows which Node to place the data into?
I just tested it.
Its perfect. I think I will only need the core component but your example definitely illustrates the point clearly.
Thank you Sir and have a blessed day!!!
Thank you for the reply Matt.
May I ask what the code would look like beyond its most basic? Samples please?
Thank you and God bless you Sir!!!
That script is beautiful Rob. It is exactly what I needed. Thank you so much!!!!
Thank you very much and have a blessed day!!!
Ok Rob understood and thank you for that clarification. Having said that if “File Watcher” is NOT the solution can you provide a sample of what would be a viable solution? I only need to scan the folder once per run, keep the scan active for a predetermined period of time and then cease that operation.
Thank you Sir for your valuable input!!!
Forgive my amateur use of the term “polling” Rob. Yes you are correct. I want to place a command at the end of the script I shared that causes the polling function to completely CEASE as the code I shared is part of a bigger script. Then the rest of the code will run and at the end of the script I will LOOP the entire script which will allow the code to run once more , then once again stop, until the next run of the script from the loop. Make sense Sir?
The sample code from the link you shared seems to do the job except for one problem. The user STILL has to manually push CNTR + C to execute the unregister sequence.
I need some sample code that will emulate the CNTR + C Keystroke in code without the use for manual input.
- This reply was modified 3 months, 2 weeks ago by nal2us224.