Recently Browsing 0 members
No registered users viewing this page.
I am looking for a script to replace the string in 2 different files types.
I have .hod files and .ws files. These are AS/400 Session file types.
If you open the files with a text editor you can change the Host they are connecting to.
I need to change if needed to a Standard Host name.
.HOD file has a line host=X.X.X.X or something of the sort and I need it to be host=DNSName
.WS file has a line HostName=X.X.X.X and needs to be HostName=DNSName
It would be nice to be able to run this script silently on the PC if running with a switch (can do with software deployment) and if a person wanted to run it manually they would get a pop-up on how many it changed. The bad thing is these files could be in quite a few different places on the PC. If I could put in the script the most common places to look for the files that would be good to. I also just found out that if the session is open and you change the string, when you close the session it changes the string back to what it was. I guess maybe error with "sessions need to be closed" if there is a certain exe running.
Thank you in advanced for any help you can provide.
As for the object, in this case the StringReplace() function does not work for me.
These are my steps:
1) Extract the subject from an EML file.
(the first character is an emoji )
source from EML file:
$sSubject = "?utf-8?B?8J+TiCA1IG9mIHRoZSBCZXN0IFN0b2NrcyB0byBCdXkgZm9yIERlY2VtYmVy?=" 2) in this case I perform a decoding with _QuotedPrintable_DecodeEncodedWord()
$sSubject = "?? 5 of the Best Stocks to Buy for December"
3) I perform StringReplace():
$sSubject = StringReplace($sSubject, "??", "") or
$sSubject = StringReplace($sSubject, Chr(63)&Chr(63), "")
But the characters ?? they are not replaced.
Yet if I make an Asc of every character of the string with a for loop, are the first two characters really? that is 63
Local $aArray = StringSplit($sSubject, "", $STR_NOCOUNT) For $i = 0 To UBound($aArray)-1 ConsoleWrite($aArray[$i] & " - " & Asc($aArray[$i])& @CR) Next Output:
? - 63
? - 63
5 - 53
o - 111
f - 102
t - 116
h - 104
e - 101
Does anyone have an explanation of why it doesn't work?
Thank you all
I am adding labour charge to total paid amount using :
#include <IE.au3> #include <Array.au3> $oIE = _IEAttach ("Shop") $oTable = _IETableGetCollection ($oIE, 1) $aTableData3 = _IETableWriteToArray ($oTable) Local $sitem1 = $aTableData3 Local $sitem2 = $aTableData3 Local $lcharge = "10" ;add manualy using inputbox, becuase not generating online Local $atotPric = "Payable Total Price " Local $oTds = _IETagNameGetCollection($oIE, "td") For $oTd In $oTds If $oTd.Innertext = $atotPric Then $iatotPric = $oTd.NextElementSibling.innertext MsgBox (0, "2", $iatotPric) EndIf Next $irCtotal = StringFormat("%.2f", $sitem1 + $sitem2 + $lcharge) $crTotp = StringReplace(_IEBodyReadHTML($oIE), $iatotPric, $irCtotal) _IEBodyWriteHTML ($oIE, $crTotp) But, It was also changing Total price, I want to change only Payable Total Price.
So basically need to pull text from a .txt file or .sql and use that text to replace something within a different file.
Text1 = jumps
Text2 = fence
My Dog XXXXX over the YYYYY.
My Dog jumps over the fence
I have found a good start, I'm basic programmer at best, I have some experience but this gets out of my wheel house.
Any help is appreciated.
Default keyword for optional parameter is interpreted wrongly.
ConsoleWrite(StringReplace("aa", "a", "b", Default, 1) & @CRLF) StringReplace ( "string", "searchstring/start", "replacestring" [, occurrence = 0 [, casesense = 0]] ) The code above will output ab even thou the default value for the occurrence is 0 (replace all).
Of course using zero instead of Default will work fine.