String Length Problem passing iMacros code= to Firefox

Discussions and Tech Support specific to the iMacros Firefox add-on.
Forum rules
iMacros EOL - Attention!

The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.

Thank you again for your business and support.

Sincerely,
The Progress Team

Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
jpwags
Posts: 4
Joined: Thu Aug 11, 2016 12:10 am

String Length Problem passing iMacros code= to Firefox

Post by jpwags » Sun Mar 19, 2017 1:24 am

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. This would produce various errors, apparently due to how far into a iMacro statement it would achieve. Total length of all iMacros commands was suspected as a problem becuase when I encountered problems I would delete comment statements etc making less command lines and it would work. I now have a few rather lengthy iMacros with many command lines and thus my problem.
I 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 ~2080 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.
Simply add a ONE Character to the start of the Comment line and it will then fail
It does make FireFox Window active, but no iMacro service is invoked.

Code: Select all

#Region ==== Options, Includes, Declares & PROGRAM DESCRIPTION
Opt("WinTitleMatchMode", 2)  ; ANY SUBSTRING - OVERRIDE
#include <base64.au3> ; USed for imbedded iim Macro
Global $iMacroSCRIPT
#EndRegion
#Region 	; =-=-=-=-=-=-=-= IMBEDDED IMACRO COMMANDs To Be ReFormated With Base 64 Encoding  =============================-
;ORIGINALINCLUDEIIM
Local $sImBedMacro= _
'''123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901' & @CRLF & _
'URL GOTO=https://www.autoitscript.com/' & @CRLF & _
@CRLF
#EndRegion  ; =-=-=-=-=-=-=-= IMBEDDED IMACRO COMMANDs To Be ReFormated With Base 64 Encoding  =============================-
; ======  Start Firefox if not open  ================================================================================
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
		; ======    TEST CODE To SHOW LENGTHs =====================================================================
			; The following line for Length check only
			ToolTip("URL line for Length only >>" & StringLen('URL GOTO=https://www.autoitscript.com/') & "<<")
			Sleep(10000)
			ToolTip("$sImBedMacro Length comment line + URL line >>" & StringLen($sImBedMacro) & "<<")
			Sleep(10000)
			ToolTip("iMacros://run/?code= LENGTH only >>" & StringLen('imacros://run/?code=') & "<<")
			Sleep(10000)
			ToolTip("$iMacroSCRIPT ENCODED TOTAL Length >>" & StringLen($iMacroSCRIPT) &  "<<")
			Sleep(10000)
			ToolTip("$iMacroSCRIPT Actual String Passed to ShellExecute>>" & $iMacroSCRIPT & "<<")
			Sleep(10000)
; ================================
	ShellExecute($iMacroSCRIPT)  ;  Run the SCRIPT CODED MACRO
; ================================
Sleep(3000)
Exit
I am using iMacro 897 becuase of an earlier problem with the Run command in FireFox. I did upgrade to 903 and then encountered that original code as posted here did not execute, so backed down to 897.
iMacros VERSION BUILD=8970419 RECORDER=FX
FireFox 52.0.1 (32-bit)
Microsoft Windwos 10 PRO version 10.0.10586 Build 10586
64 bit system w/16GB mem

While the demo code shows string lengths I am not sure whether the count always reflects what is being passed what with the delimiters, etc. "'", but definitely the one character addition causes the encode to increase by 4 and then the total to FireFox fails.

Code: Select all

Local $sImBedMacro= _
'''X12345678901234567890.........
Appreciate any observations.
Thanks, BitPicker
Post Reply