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
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.........
Thanks, BitPicker