Jump to content

Recommended Posts

Posted

I have an xml file with the string "/merchant/poslogin.php?key=20000209_432</url>" and my script changes the value of 20000209_432. If I need to change it again I want to search for the string "/merchant/poslogin.php?key=" and tell autoit to count 27 characters from the string and replace the next 12 digits with my inputbox value. How can I tell StringReplace to start 27 digits from the string being replaced?

$NewCustomerID = StringReplace($chars, "2000293", $CustomerID) <-- Here
    $NewCustomerPin = StringReplace($NewCustomerID, "432", $CustomerPin)
    FileOpen("tiapp.xml", 2)
    FileWrite("tiapp.xml", $NewCustomerPin)
    FileClose($xmlfile)
    Exit

Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Posted (edited)

OK that worked out good. Here is my final code:

$NewCustomerID = StringReplace($chars, 553, $CustomerID) ;Repaces the Customer ID in tiapp.xml
    $NewCustomerData = StringReplace($NewCustomerID, 562, $CustomerPin) ;NewCustomerData hold the properly modified xml data
    FileOpen("tiapp.xml", 2)
    FileWrite("tiapp.xml", $NewCustomerData)
    FileClose($xmlfile)
    Exit
Edited by computergroove

Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

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
×
×
  • Create New...