chivracq wrote:chivracq wrote:Tja, let's play a little Game and see if sbd else, TechSupport for example eh-eh-eh...!, can discover it as well..., gniarf-gniarf...!
Hint Nr 1:
The (2nd) Bug I just discovered gives the following RuntimeError:
Code: Select all
NS_ERROR_FAILURE: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsITransferable.getTransferData], line 9 (Error code: -1001)
(Tested on iMacros for FF v8.8.2, Pale Moon v24.6.2 (=FF31), Win7-x64.)
Hum..., nobody wants to play with me...!!!???
OK, Hint Nr 2:
Part of the Trick is to use an Empty String... in a Var, like I already mentioned...
Hum, not many People seem to be interested, grr...!! But OK, I've got my Proof of Concept ready and it works fine... but only for Informative PROMPT's, and not for PROMPT's that require some User Input, because the Technique I use would require to be able to embed a Variable in a Variable and it doesn't work, iMacros treats the embedded Var as a String. I miss a Switch/Command like '#NOVAR#' that does the contrary and treats the Double Curly Brackets of a Var as a String... Or like I've already asked as an Enhancement Request, I miss a "Super" Built-in Var that could contain Commands like 'PAUSE', 'REFRESH', even 'PROMPT' and other (Built-in) Vars.
But anyway, it is already Friday afternoon (for me in Europe), so I will already disclose my Proof of Concept, in case anybody wants to play with it on a boring Friday afternoon at work or during the WE, ah-ah...!!
The little Bug I discovered while doing some Testing for
this Thread [EDIT: 2020-05-27: Link is dead as the Thread seems to have been deleted, hum..., strange...
] with 'PROMPT' and the Clipboard came from the fact that I wanted to reset the Content of the Clipboard to NULL between several Tests in the same Macro but iMacros treats "NULL" in 'SET !CLIPBOARD NULL' like a String. Funny I thought, but no Pb, I will just set it to an Empty String then:
Code: Select all
SET !CLIPBOARD ""
PROMPT {{!CLIPBOARD}}
But this simple Code yields the RuntimeError I already mentioned in a previous Post...
Hum, strange, I thought, I tried a few things with Temp (Built-in) Vars, but same Result each time the Clipboard has been set to an Empty String and I tried to PROMPT it... But the good news was when using '!ERRORIGNORE', the 'PROMPT' Statement just does nothing and that gave me the clever Idea to try to misuse that Behaviour for a Conditional PROMPT, and yep, it works, but only for Informative PROMPT's, like I already mentioned.
So here is the Proof of Concept, you can just run it as is, first 1 Play and after with Loop (=10 or >10), It contains several Conditional PROMPT's that are self-explanatory with some extra Info. Enjoy and Feedback welcome...!
'This Macro is a Proof of Concept to demonstrate a Conditional PROMPT in pure '.iim' for iMacros for FF.
'Several Conditional PROMPT's will be displayed while looping the Macro, and only for a few specific Loops.
'Unfortunately, this Method only works for Informative PROMPT's and not for PROMPT's that require some User Input.
'Warning...!: This Technique uses the OS Clipboard and resets it a few times to NULL,
'... meaning that you lose the Content of the Clipboard if you had stg stored in it before running/looping this Macro. Oops...!
'>
'Proof of Concept made by 'JF CHIVRACQ', January 2016, for the iMacros Forum.
'Feel free to reuse/improve. Enjoy...!!
Code: Select all
VERSION BUILD=8820413 RECORDER=FX
TAB T=1
SET !ERRORIGNORE YES
'This Macro is a Proof of Concept to demonstrate a Conditional PROMPT in pure '.iim' for iMacros for FF.
'Several Conditional PROMPT's will be displayed while looping the Macro, and only for a few specific Loops.
'Unfortunately, this Method only works for Informative PROMPT's and not for PROMPT's that require some User Input.
'Warning...!: This Technique uses the OS Clipboard and resets it a few times to NULL,
'... meaning that you lose the Content of the Clipboard if you had stg stored in it before running/looping this Macro. Oops...!
'>
'Proof of Concept made by 'JF CHIVRACQ', January 2016, for the iMacros Forum.
'Feel free to reuse/improve. Enjoy...!!
'SET Clipboard_Temp {{!CLIPBOARD}}
'Loop 1:
SET PROMPT_Msg "This is a Conditional PROMPT, only for Loop=1."
ADD PROMPT_Msg <BR><BR>
ADD PROMPT_Msg "Try looping this Macro for more than 10 times, you will get another Conditional PROMPT at Loop=5 and Loop=10 and the Macro will automatically stop after the last PROMPT at Loop=10...!"
'>
SET !CLIPBOARD EVAL ("if('{{!LOOP}}'==1){var x='{{PROMPT_Msg}}';} else {x='';}; x;")
PROMPT {{!CLIPBOARD}}
'Loop 3:
SET PROMPT_Msg "BUG...!! This is only Loop=3, I'm not supposed to get a PROMPT for this Loop...!"
ADD PROMPT_Msg <BR><BR>
ADD PROMPT_Msg "But hum, I didn't get a PROMPT for Loop=2, so hum..., maybe it works...!"
'>
SET !CLIPBOARD EVAL ("if('{{!LOOP}}'==3){var x='{{PROMPT_Msg}}';} else {x='';}; x;")
PROMPT {{!CLIPBOARD}}
'Loop 5:
SET PROMPT_Msg "OK, this is Loop=5, I expected this PROMPT and I didn't get one for Loop=4. This looks good...!"
ADD PROMPT_Msg <BR><BR>
ADD PROMPT_Msg "The next (and final) PROMPT should now only come at Loop=10."
'>
SET !CLIPBOARD EVAL ("if('{{!LOOP}}'==5){var x='{{PROMPT_Msg}}';} else {x='';}; x;")
PROMPT {{!CLIPBOARD}}
'Loop 10:
SET PROMPT_Msg "This is the final Loop (Loop=10), the Macro will now abort even if you specified a Nb>10 to loop it..."
ADD PROMPT_Msg <BR><BR>
ADD PROMPT_Msg "But notice that you only got PROMPT's at Loop=1+3+5+10."
ADD PROMPT_Msg <BR><BR>
ADD PROMPT_Msg "Unfortunately, this Method only works for Informative PROMPT's and not for PROMPT's that require some User Input."
ADD PROMPT_Msg <BR><BR>
ADD PROMPT_Msg "Warning...!: This Technique uses the OS Clipboard and resets it a few times to NULL, meaning that you lost the Content of the Clipboard if you had stg stored in it before running/looping this Macro. Oops...!"
ADD PROMPT_Msg <BR>
ADD PROMPT_Msg "(And the Content of this current PROMPT is now stored in the Clipboard...!)"
ADD PROMPT_Msg <BR><BR>
ADD PROMPT_Msg "Proof of Concept made by 'JF CHIVRACQ', January 2016, for the iMacros Forum."
ADD PROMPT_Msg <BR>
ADD PROMPT_Msg "Feel free to reuse/improve. Enjoy...!!"
'>
SET !CLIPBOARD EVAL ("if('{{!LOOP}}'==10){var x='{{PROMPT_Msg}}';} else {x='';}; x;")
PROMPT {{!CLIPBOARD}}
'SET !CLIPBOARD ""
'Prepare Report Msg:
SET Report_Msg <SP><SP><SP>No<SP>Error...!
ADD Report_Msg <BR><BR>
ADD Report_Msg "Proof of Concept for a Conditional PROMPT at Loop=1+3+5+10 before aborting."
ADD Report_Msg <BR><BR>
'Abort Macro and display mini-Report:
SET !ERRORIGNORE NO
SET Abort_Macro EVAL("if('{{!LOOP}}'==10) {MacroError('{{Report_Msg}}');}")
(Tested on iMacros for FF v8.8.2, Pale Moon v24.6.2 (=FF31), Win7-x64.)