Hello CurtisDo,
Thank-you for your question.
Basically there is no build-in method in Zap-fix methods’ library which deals with encrypting text, therefore you can consider one of the following 3 possible solutions:
1. Usually text-fields which require encryption can be added as known objects (Not a Zap-fix based objects) to the UFT’s Object Repository, once such was added you can use the UFT’s "SetSecure" method upon it (And all other known UFT encryption manipulations).
2. If an AUT’s objects (AUT = Application Under Test) cannot be recognized by UFT, we are strongly recommend to use our standalone ZAPTEST testing app, in it you have the "TypeEncrypted" method.
3. If you still want to use UFT and the Zap-fix objects you can try implementing VBScript code, such as the following:
‘encrypt.vbs
set x = WScript.CreateObject("WScript.Shell")
txt = inputbox("enter text to be encoded")
msgbox encode(txt)
x.Run "%windir%notepad"
wscript.sleep 1000
x.sendkeys encode(txt)
function encode(s)
For i = 1 To Len(s)
newtxt = Mid(s, i, 1)
newtxt = Chr(Asc(newtxt)+3)
coded = coded & newtxt
Next
encode = coded
End Function
‘decrypt.vbs
set x = WScript.createobject("wscript.shell")
txt = inputbox("enter text to be decoded")
msgbox encode(txt)
x.Run "%windir%notepad"
wscript.sleep 1000
x.sendkeys encode(txt) function encode(s)
For i = 1 To Len(s)
newtxt = Mid(s, i, 1)
newtxt = Chr(Asc(newtxt)-3)
coded = coded & newtxt
Next
encode = coded
End Function
Please contact Zap for further help.
Thanks,
Sasha