Bitpicker

_Base64Encode String Length

2 posts in this topic

#1 ·  Posted

Using iim iMacros scripts of usually 30 to 40 statements of varying lengths. These are encoded via _Bas64encode  UDF. Various iMacros errors would occur at execution leading me to isolate the iMacros errors to executing so far into the lengths of the commands. Have included a dummy string and kept lengthening until I generated error in first statement that iMacros interpreted.  

Is there a length constraint I am blowing? Autoit has stated statement length of 4095. The error occurs at around 1405 characters. I have had other code where I shortened the string the string of commands by taking out comments etc and all statements in the string ran. So believe I am up against a length constraint. Any observations will be appreciated. Test code as follows:

; ============================================================================================================
Local $sImBedMacro= _
'''1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890' & @CRLF & _
'''1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890' & @CRLF & _
'''1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890' & @CRLF & _
'''1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890' & @CRLF & _
'''1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890' & @CRLF & _
'''1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890' & @CRLF & _
'''1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890' & @CRLF & _
'''1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890' & @CRLF & _
'''1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890' & @CRLF & _
'''1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890' & @CRLF & _
'''1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890' & @CRLF & _
'''1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890' & @CRLF & _
'''1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890' & @CRLF & _
'''1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890' & @CRLF & _
'''1234567890123456789012345678901234567890123456789012345678901' & @CRLF & _
'URL GOTO=https://www.ibmsecu.org/' & @CRLF & _
@CRLF
; ====
If Not WinExists("Mozilla Firefox") Then ShellExecute ("C:\Program Files (x86)\Mozilla Firefox\Firefox.exe")
WinWait ("Mozilla Firefox")
$iMacroSCRIPT = 'imacros://run/?code=' & _Base64Encode($sImBedMacro)  ;  CONVERT the string to SCRIPT CODE
    ; ================================
    ShellExecute($iMacroSCRIPT)  ;  Run the SCRIPT CODED MACRO
    ; ================================
Sleep(3000)
Exit
;==================================================================================================================
;Calculated Length thru "'UR" of Line 17 ABOVE ~ 1405 CHARACTERS
;Produces iMacros Error: unknown command: UR, line 16 (Error code: -910)
;Windows 10 PRO 10.0.10586
;Firefox 52.0 (32-bit)
;iMacros 9.0.0.2379
;SCITE3.7.3
;Thanks

Thanks again, BitPicker

Share this post


Link to post
Share on other sites



#2 ·  Posted

New at Using a Forum so Please let me know if out of bounds.

Apologize for not including #include <base64.au3>  in original code and perhaps not creating Post correctly as I only see a star while all others have bold dot entry. 

After additional testing _Base64Encode IS NOT the problem. I have added test code to encode and then decode the encode result and it is exact at any length I tested.

I do have a string length problem, but I believe it is either with iMacros excuting the encoded string, or Firefox URL length accepting the imacros://run/?code= + the encoded string. 

I am using ShellExecute to fire >> imacros://run/?code=  + the base64encoded iMacro with Total Length of 3000 characters. If I include the unencoded iMacro by one character, it increases the base64encode Length by 4 and the IMacro will not complete in FireFox. It does make FireFox Window active, but no iMacro service is invoked.

So, I ask how to proceed? Should this be closed, and how to do that.

Thanks BitPicker

Share this post


Link to post
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