String Length Problem passing iMacros code= to Firefox

Discussions and Tech Support related to the iMacros Firefox Add-on, including the built-in Javascript scripting interface for playing .js files.

Moderators: Community Moderators, iMacros Moderators

Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the Google search box (at the top of each forum page) to see if a similar problem or question has already been addressed. This will search the entire contents of the forums as well as the iMacros Wiki.
3. We can respond much faster to your posts if you include the following information:


Answering your own posts (e.g. attempting to "bump" your topic) drops your topic from the list of unanswered threads, so it may actually receive less views.

String Length Problem passing iMacros code= to Firefox

by jpwags on Sat Mar 18, 2017 6:24 pm

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
#Region    ; =-=-=-=-=-=-=-= IMBEDDED IMACRO COMMANDs To Be ReFormated With Base 64 Encoding  =============================-
Local $sImBedMacro= _
'''123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901' & @CRLF & _
'URL GOTO=' & @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=') & "<<")
         ToolTip("$sImBedMacro Length comment line + URL line >>" & StringLen($sImBedMacro) & "<<")
         ToolTip("iMacros://run/?code= LENGTH only >>" & StringLen('imacros://run/?code=') & "<<")
         ToolTip("$iMacroSCRIPT ENCODED TOTAL Length >>" & StringLen($iMacroSCRIPT) &  "<<")
         ToolTip("$iMacroSCRIPT Actual String Passed to ShellExecute>>" & $iMacroSCRIPT & "<<")
; ================================
   ShellExecute($iMacroSCRIPT)  ;  Run the SCRIPT CODED MACRO
; ================================

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.
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= _

Appreciate any observations.
Thanks, BitPicker
Posts: 2
Joined: Wed Aug 10, 2016 5:10 pm

Return to iMacros for Firefox

Who is online

Users browsing this forum: Bing [Bot] and 6 guests

Website Monitoring