Loop several times, Prompt only once

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:

CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST

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.

Loop several times, Prompt only once

by eresopo on Mon Oct 23, 2017 5:56 am

Hello team,
I'm having a problem to set a loop with a prompt, currently is asking for the prompt on every loop :cry: it is possible to optimize it to ask only once and loop several times?
Currently it works, but I would like (if possible) to improve it
can I have some help? :oops:
Thanks in advance :wink: :wink:

Code: Select all
VERSION BUILD=9030808 RECORDER=FX
SET !DATASOURCE test.csv
SET !DATASOURCE_COLUMNS 6
SET !LOOP 2
SET !DATASOURCE_LINE {{!LOOP}}
PROMPT "Please enter your intranet password:" !VAR1
'random password VAR2
SET !VAR2 EVAL("var letters = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','w','x','y','z']; var string = ''; for(var i = 0; i < 10; i++){string += letters[parseInt(Math.random() * 25)]}; string")
SET !ERRORIGNORE YES
TAB T=1
URL GOTO={{!COL1}}
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:LogonForm ATTR=ID:username CONTENT={{!COL2}}
SET !ENCRYPTION NO
TAG POS=1 TYPE=INPUT:PASSWORD FORM=NAME:LogonForm ATTR=ID:password CONTENT={{!VAR1}}
TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:LogonForm ATTR=NAME:submitbutton
TAG POS=1 TYPE=A ATTR=TXT:Request<SP>Product
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:RequestProductForm ATTR=ID:searchCriteria CONTENT={{!COL5}}
TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:RequestProductForm ATTR=ID:search_services
TAG POS=1 TYPE=DIV ATTR=TXT:{{!COL5}}
TAG POS=1 TYPE=DIV ATTR=TXT:Individual
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:RequestProductForm ATTR=ID:tabs[0].widgets[0] CONTENT={{!COL3}}{{!COL4}}
TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:RequestProductForm ATTR=ID:CustomFormDefaultButton
TAG POS=1 TYPE=INPUT:PASSWORD FORM=NAME:RequestProductForm ATTR=ID:confirmationPasswordForm.newPassword CONTENT={{!VAR2}}
TAG POS=1 TYPE=INPUT:PASSWORD FORM=NAME:RequestProductForm ATTR=ID:confirmationPasswordForm.newPasswordConfirmation CONTENT={{!VAR2}}
TAG POS=1 TYPE=TEXTAREA FORM=NAME:RequestProductForm ATTR=ID:justification CONTENT={{!COL6}}
SET !ENCRYPTION NO
TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:RequestProductForm ATTR=ID:requestProduct
eresopo
 
Posts: 5
Joined: Mon Oct 23, 2017 5:50 am

Re: Loop several times, Prompt only once

by chivracq on Mon Oct 23, 2017 6:31 am

eresopo wrote:Hello team,
I'm having a problem to set a loop with a prompt, currently is asking for the prompt on every loop :cry: it is possible to optimize it to ask only once and loop several times?
Currently it works, but I would like (if possible) to improve it
can I have some help? :oops:
Thanks in advance :wink: :wink:

Code: Select all
VERSION BUILD=9030808 RECORDER=FX
SET !DATASOURCE test.csv
SET !DATASOURCE_COLUMNS 6
SET !LOOP 2
SET !DATASOURCE_LINE {{!LOOP}}
PROMPT "Please enter your intranet password:" !VAR1
'random password VAR2
SET !VAR2 EVAL("var letters = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','w','x','y','z']; var string = ''; for(var i = 0; i < 10; i++){string += letters[parseInt(Math.random() * 25)]}; string")
SET !ERRORIGNORE YES
TAB T=1
URL GOTO={{!COL1}}
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:LogonForm ATTR=ID:username CONTENT={{!COL2}}
SET !ENCRYPTION NO
TAG POS=1 TYPE=INPUT:PASSWORD FORM=NAME:LogonForm ATTR=ID:password CONTENT={{!VAR1}}
TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:LogonForm ATTR=NAME:submitbutton
TAG POS=1 TYPE=A ATTR=TXT:Request<SP>Product
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:RequestProductForm ATTR=ID:searchCriteria CONTENT={{!COL5}}
TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:RequestProductForm ATTR=ID:search_services
TAG POS=1 TYPE=DIV ATTR=TXT:{{!COL5}}
TAG POS=1 TYPE=DIV ATTR=TXT:Individual
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:RequestProductForm ATTR=ID:tabs[0].widgets[0] CONTENT={{!COL3}}{{!COL4}}
TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:RequestProductForm ATTR=ID:CustomFormDefaultButton
TAG POS=1 TYPE=INPUT:PASSWORD FORM=NAME:RequestProductForm ATTR=ID:confirmationPasswordForm.newPassword CONTENT={{!VAR2}}
TAG POS=1 TYPE=INPUT:PASSWORD FORM=NAME:RequestProductForm ATTR=ID:confirmationPasswordForm.newPasswordConfirmation CONTENT={{!VAR2}}
TAG POS=1 TYPE=TEXTAREA FORM=NAME:RequestProductForm ATTR=ID:justification CONTENT={{!COL6}}
SET !ENCRYPTION NO
TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:RequestProductForm ATTR=ID:requestProduct

FCIM...! :mrgreen: (Read my Sig...)
=> iMacros for FF v9.0.3, FF55/56...?, OS...?

Hum, the 'PROMPT' and 'alert()' Commands happen to be a little bit buggy in iMacros for FF (at least until v8.9.7, not sure about v9.0.3)...
I've posted in the following Thread a Workaround for a Conditional 'PROMPT' in FF in pure '.iim':
- Re: PROMPT Messagebox - Yes - No - Cancel (end)
That Thread and Post from me in that Thread was already from Jan 2016, but I think I remember "my" Workaround only worked for a "Display" 'PROMPT' and not for an 'Input' 'PROMPT' like you want in your Script for the User to enter their 'Intranet Password'...
But I had posted some Update a few months later about another Method that worked as well for a Display 'PROMPT' and might work as well for an Input 'PROMPT'. (I didn't test that part...) Read the whole Thread I referred to for more Info...
But hum, if you want to investigate if that Syntax works as well for an Input 'PROMPT', you might need to revert to v8.9.7 for FF as it uses the 'URL GOTO=javascript:' Syntax which I think is not supported anymore in v9.0.3 for FF... (v8.9.7 still works on FF v55.0.3, I still haven't tested by myself if it is still compatible with FF56...)

As you are on FF, you might want otherwise to use a '.js' Script that would allow you to split the Logic of your Script into 2 parts, one for the Input 'PROMPT' Functionality and one for the part that needs Looping

Well, good luck and post your Final Script, I'll be curious if you go for the '.iim' Workaround, to hear if it works for an Input 'PROMPT', on v9.0.3 and/or v8.9.7 for FF. :idea:
(And mention your FCI...)
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 6484
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Loop several times, Prompt only once

by eresopo on Mon Oct 23, 2017 11:04 pm

Hello chivracq :oops: thanks for your quick reply and sorry for FCIM :cry: :(
Currently I'm developing on RHEL6 enviorment with Firefox 52.3.0 (64-bit) and Imacros for Firefox v.9.0.3.
Before starting with the csv approach, Prompt worked perfectly fine, user was typing his password and it was saving the password on the variable and doing everything ok.
When this week I started with the csv approach, I spent a while googling how to do the loop properly for 57 lines and after all, now it works, but on every loop is asking for the password.

I found that on vbs it was some way :cry: but im not so expert with vbs :cry:

can you give me and advice or some help about it, what do you recommend to me :roll:
eresopo
 
Posts: 5
Joined: Mon Oct 23, 2017 5:50 am

Re: Loop several times, Prompt only once

by iimfun on Tue Oct 24, 2017 11:35 pm

And now the very conditional PROMPT.

Code: Select all
' 0 - No   1 - Yes
SET needPrompt 1
SET d EVAL("{{needPrompt}} ? '' : 'u';")
SET !ERRORIGNORE YES
PROMPT "Really need to enter a value?" promptVar EVAL({{d}})
SET !ERRORIGNORE NO
For those who still believe in miracles...
iimfun
 
Posts: 239
Joined: Tue Jul 19, 2016 6:06 am

Re: Loop several times, Prompt only once

by chivracq on Wed Oct 25, 2017 8:24 am

eresopo wrote:Hello chivracq :oops: thanks for your quick reply and sorry for FCIM :cry: :(
Currently I'm developing on
Code: Select all
RHEL6 enviorment with Firefox 52.3.0 (64-bit) and Imacros for Firefox v.9.0.3.

Before starting with the csv approach, Prompt worked perfectly fine, user was typing his password and it was saving the password on the variable and doing everything ok.
When this week I started with the csv approach, I spent a while googling how to do the loop properly for 57 lines and after all, now it works, but on every loop is asking for the password.

I found that on vbs it was some way :cry: but im not so expert with vbs :cry:

can you give me and advice or some help about it, what do you recommend to me :roll:

OK for FCI...

I didn't have the time to reply to your previous Post but other Advanced User @iimfun seems to have posted in the meantime a working Solution in pure '.iim'... :D

I was going to tell you to check a bit the Thread(s) I had referred to as it/they already contained/could lead to some possible Solution...

Concerning '.vbs', well..., yep that's a way to go indeed, like the way I mentioned using a '.js' Script. But for '.vbs' Scripts, you'll need the 'iMacros Scripting Interface' which belongs to the 'Enterprise Edition', while '.js' Scripts (in JavaScript) can be written and run on FF (only) using the Free iMacros for FF Add-on. So..., unless you have strong '.vbs' Knowledge in house, using a '.js' Script would look like an easier path to me, and you'll find a lot more Examples and Expertise of/with '.js' Scripts on the Forum than '.vbs' Scripts... (But on the other hand, if you buy the Enterprise Edition, you then have Access to Tech Support where they do have '.vbs' Expertise...)

iimfun wrote:And now the very conditional PROMPT.

Code: Select all
' 0 - No   1 - Yes
SET needPrompt 1
SET d EVAL("{{needPrompt}} ? '' : 'u';")
SET !ERRORIGNORE YES
PROMPT "Really need to enter a value?" promptVar EVAL({{d}})
SET !ERRORIGNORE NO
For those who still believe in miracles...

OK, looks promising, even if it took me a while to understand a bit how it works (your Syntax often looks a bit "obscure" @iimfun, would be handy if you could include some bits of Explanation sometimes), and it would be handy as well if you could mention in which FCI you've written/tested your Scripts, especially concerning the 'PROMPT' Functionality which works differently (or sometimes doesn't even work at all) between the different Browsers and even between different Versions of iMacros for FF...

But OK, I tested this Script in 2 different Versions of iMacros for FF and it works in both... Good News, ah-ah...! :D

The Trigger to get the (Conditional) 'INPUT PROMPT' is for the 'needPrompt' Var to have a +/- Decimal Value (or Integer of course) <> 0. (You don't get the 'PROMPT' for "0" (or "+/-0.000000") or a String.)

=> Adapted to @OP's Requirement to get the 'PROMPT' only for "!LOOP=1", that would give:
Code: Select all
VERSION BUILD=8820413 RECORDER=FX
TAB T=1

' 0 - No   1 - Yes
SET needPrompt EVAL("var d='{{!LOOP}}'; var z; if(d==1){z=1;} else{z=0;}; z;")
SET d EVAL("{{needPrompt}} ? '' : 'u';")
SET !ERRORIGNORE YES
PROMPT "Really need to enter a value?" promptVar EVAL({{d}})
SET !ERRORIGNORE NO

PROMPT LOOP:<SP>_{{!LOOP}}_<BR>needPrompt:<SP>_{{needPrompt}}_<BR>d:<SP>_{{d}}_<BR><BR>promptVar:<SP>_{{promptVar}}_
Tested (and works fine) on the following 2 FCI's:
Code: Select all
- iMacros for FF v8.8.2, Pale Moon v26.3.3 (=FF47), Win10_x64.
- iMacros for FF v8.9.7, FF v55.0.3, Win10_x64.

... And I would expect it to work as well on v9.0.3 for FF. :D

I was a bit surprised btw to notice that 'promptVar' retained between the different Loops, the Value that was entered in the 'PROMPT' in Loop_1. I always understood that all '!VARn' and User Defined Vars were reset (by Design) between Loops. Same Result with '!VAR1' instead of a User Defined Var... :o

But OK..., in order not to "pollute" this Thread too much away from @OP's original Qt/Need, I will post my further Comments (and was going to link to this Thread anyway) in the "main" Thread about 'PROMPT' I already referred to... Direct Link:
- [... Will be added later...]
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 6484
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Loop several times, Prompt only once

by iimfun on Wed Nov 01, 2017 12:38 am

Bumped just to remind to add the "Direct Link".
iimfun
 
Posts: 239
Joined: Tue Jul 19, 2016 6:06 am

Re: Loop several times, Prompt only once

by chivracq on Wed Nov 01, 2017 2:18 pm

iimfun wrote:Bumped just to remind to add the "Direct Link".

Yeah-yeah, sorry, I know... I still haven't added my "new" Post in the other Thread, I need to do a bit of "Thinking" for that Post with the Testing I did with your new Workaround, but it's Halloween time now and I play about 20 Games related to Halloween, with constantly 10-12 Scripts running at the same time 24h/24h, it's already a "Challenge" for me to find a "free" Browser Instance to check the Forum, ah-ah...! :wink:
But I haven't forgotten... I will bump this Thread, and the 'PROMPT' Thread of course when I'll have posted my Post...

And hum, @OP has still not reacted, no Follow-up, hum...: => Spanking deserved...!! :twisted:
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 6484
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Loop several times, Prompt only once

by eresopo on Wed Nov 15, 2017 6:35 am

:oops: Sorry!, I was on business trip and busy with some other stuff, so I saw the answer but until today i were not able to test it.

I can confirm that it works, is exactly what i wanted :) thanks so so so much.

I would like to ask, related to same topic, but a different branch of the same topic...
When im prompting asking for password, it appears as plain text the password, so if someone is walking behind the person, can see the password...

It is possible to make it kind-of-more-secure? :oops:
I mean, like asterisks or like dots ? :oops:

Thanks in advance guys, you made my day :wink: :wink:
eresopo
 
Posts: 5
Joined: Mon Oct 23, 2017 5:50 am

Re: Loop several times, Prompt only once

by iimfun on Thu Nov 16, 2017 12:33 am

Okay, know one "royal" way... But this time I'm ready to help only privately. If this is agreed, leave your email and I'll contact you soon.
iimfun
 
Posts: 239
Joined: Tue Jul 19, 2016 6:06 am

Re: Loop several times, Prompt only once

by eresopo on Thu Nov 16, 2017 2:14 am

Hello iimfun :) thanks for your reply back.

For sure no problem from my side, my private mail is <removed>
looking forward to heard from you
eresopo
 
Posts: 5
Joined: Mon Oct 23, 2017 5:50 am

Re: Loop several times, Prompt only once

by eresopo on Tue Nov 21, 2017 2:09 am

Hello again,

We almost got it
:oops:
eresopo
 
Posts: 5
Joined: Mon Oct 23, 2017 5:50 am

Re: Loop several times, Prompt only once

by chivracq on Tue Nov 21, 2017 11:01 am

eresopo wrote::oops: Sorry!, I was on business trip and busy with some other stuff, so I saw the answer but until today i were not able to test it.

I can confirm that it works, is exactly what i wanted :) thanks so so so much.

I would like to ask, related to same topic, but a different branch of the same topic...
When im prompting asking for password, it appears as plain text the password, so if someone is walking behind the person, can see the password...

It is possible to make it kind-of-more-secure? :oops:
I mean, like asterisks or like dots ? :oops:

Thanks in advance guys, you made my day :wink: :wink:

iimfun wrote:Okay, know one "royal" way... But this time I'm ready to help only privately. If this is agreed, leave your email and I'll contact you soon.

eresopo wrote:Hello again,

We almost got it
:oops:

Yeah, thanks for the Update... Would be nice if you could share your Final Script once you've got that 'Obfuscate Password' Functionality implemented, I would be interested, and other Users as well I guess..., and I maintain a Thread dedicated to all Functionality related to 'PROMPT'... 8)

I don't understand btw why this "part" had to go "private"... :shock:
This is not very in the "Spirit" of the Forum... There are several Threads on SOF about this Functionality in pure JavaScript (with several Solutions), so there is nothing really "secret" about it..., and it would be nice to have one Thread on our Forum about it, with a Solution applied to iMacros... 8)
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 6484
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)


Return to iMacros for Firefox

Who is online

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

-->