MattBuck wrote:I may have been a little premature when I stated that this worked perfectly.
It does work - I am prompted to enter the datasource name, and when I enter it, the script does execute. However, once the first iteration of the script has completed, I am prompted to enter the datasource name again (my initial test only contained one record in the datasource so it worked as I expected/wanted it to).
Here's my complete script:
Code: Select all
VERSION BUILD=10.4.28.1074
TAB T=1
'********************************************************************************************************************
'Enter the datasource name for the client's users (requesters)
PROMPT "Enter the datasource name for the client's users (requesters)" !VAR2
'This variable will be used to set the datasource name for the client that you are working with.
SET !DATASOURCE {{!VAR2}}
'********************************************************************************************************************
SET !LOOP 2
SET !DATASOURCE_LINE {{!LOOP}}
SET !VAR1 {{!URLCURRENT}}
TAB CLOSEALLOTHERS
'To add users (others) using this script, please follow these steps:
'1. Log into the account.
'2. Click the Account Setup tab
'3. Click the link to add Users
'4. Click the link to add new users
'5. Execute the script
'URL for adding users
'URL GOTO=https://app10.facilitydude.com/toolbox/mydtwo/mydtwo_s/mydtWO-participantsrole.asp?passback=1
'Select user role
TAG POS={{!COL2}} TYPE=INPUT:RADIO FORM=NAME:role ATTR=NAME:roleid CONTENT=YES
'Send login information to user via email
TAG POS=1 TYPE=INPUT:CHECKBOX FORM=NAME:role ATTR=NAME:sendemailtouser CONTENT={{!COL7}}
'Click save button
TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:role ATTR=NAME:save
'Enter login name
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:frmParticipants ATTR=NAME:username CONTENT={{!COL5}}
'Enter first name
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:frmParticipants ATTR=NAME:FirstName CONTENT={{!COL3}}
'Enter last name
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:frmParticipants ATTR=NAME:LastName CONTENT={{!COL4}}
'Enter password
'**************************************************************************************************
'Password is defaulted to newuser
SET !ENCRYPTION NO
TAG POS=1 TYPE=INPUT:PASSWORD FORM=NAME:frmParticipants ATTR=NAME:password2 CONTENT=newuser
TAG POS=1 TYPE=INPUT:PASSWORD FORM=NAME:frmParticipants ATTR=NAME:password3 CONTENT=newuser
'**************************************************************************************************
'Enter email address
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:frmParticipants ATTR=NAME:email CONTENT={{!COL6}}
'Receive email notifications
TAG POS=1 TYPE=INPUT:CHECKBOX FORM=NAME:frmParticipants ATTR=NAME:MDReceiveEmailNotification CONTENT={{!COL8}}
'Click save button
TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:frmParticipants ATTR=NAME:save
'Select location assignment
'**************************************************************************************************
'No selection is made on this page
'Click the save button
TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:frmUserLocation ATTR=NAME:save
'**************************************************************************************************
'Select craft assignment
'**************************************************************************************************
'No selection is made on this page
'Click the save button
TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:frmUserLocation ATTR=NAME:save
'**************************************************************************************************
'Enter labor rate
'**************************************************************************************************
'No entry is made on this page
'Click save button
TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:frmrate ATTR=NAME:save
'**************************************************************************************************
'Delay
WAIT SECONDS=1
URL GOTO={{!VAR1}}
'EOS
My goal would be to enter the datasource name and have it stored for the duration of the script.
Yep, (Conditional) PROMPT is not possible straightforward at this moment in pure .iim nor when looping a Macro.
See an Enhancement Request I already defined in this Thread, will be a good "excuse" to bump it btw...!, ah-ah...!:
-
Re: PROMPT Messagebox - Yes - No - Cancel (end)
But, hum, I will quote my Post here as most of it is relevant to your Case... and I may update the other Thread later if "interesting" things come out in this Current Thread...:
chivracq wrote:Yep, that's indeed the Behaviour I observed..., but I wasn't shocked...! (But I only tested on iMacros for FF (v8.8.2).)
>>>
Nice as well if the Developer(s) "work" on the 'PROMPT' Command would be to add an Enhancement Request for an extra Parameter to define the Prompt Type:
- OK (Default if no Input Var is defined.)
- OK/Cancel (Default if an Input Var is defined.)
- YES/NO
- YES/NO/Cancel
(with OK/Cancel being the Default if nothing is specified...)
>>>
And nice as well would be to have another Parameter when looping a Macro to be able to specify when the PROMPT will be triggered:
- All Loops (Default).
- Only First Loop.
- Only Last Loop (-1).
- Only Loop n.
- Only Loops 3,4,5,10-15,*2*.
>>>
And while the Developer(s) look(s) at 'PROMPT', another thing related to PROMPT which is not working is this bit from the
Wiki on 'URL GOTO':
Using Javascript
The URL can also call Javascript functions that are either defined in this line or are embedded in the page (V6.22 and later):
Code: Select all
URL GOTO=javascript:alert("TEST");
This prevents from making Conditional PROMPT's with 'EVAL()'...
The Section about the 'Loop' Parameter would then be relevant for you...
But the 'URL GOTO' Syntax with 'alert()' I mention which is broken, seems to be broken only in FF, Tom from TechSupport replied in a next Post in that Thread, meaning that you could still use it as you are "lucky" to be using the iMacros Browser...
In pure .iim, I do have a Workaround which I vaguely mentioned in that Thread without giving any Details, but I'm not sure it would work in the iMacros Browser, and hum..., for 2 Reasons actually, because I am using 2 unsupported "Tricks" of which I discovered recently one (using the 'run' Syntax for one .iim calling another .iim) doesn't work in CR (never tested on IE and iMB) and the other one (using Negative Loop) I've only used it in FF (so I've never checked on IE / CR / iMB) and according to Tom it's supposed not to work in iMB.
In pure .iim again, I handled a Thread a few months ago already (maybe 1 year now...?) with a "difficult" and not "very cooperative" User who mentioned they had found ("on some other Forum" they mentioned, without any other precision...) another way to do a Conditional PROMPT but they never posted it although I asked several times...
I tried as well to located that "other Forum" myself, but to no avail, maybe you might get luckier than me...
I wait until they have another Pb/Qt to "spank" them violently with a lot of joy until they publish that Method as a Condition to ueberhaupt eventually consider helping them again...
The "royal" and supported way to achieve what you want to do would be anyway to handle the Conditional Behaviour of your Script from a main .js Script in FF or from the Scripting Interface for iMB, TechSupport and all JavaScript Coders will tell you...!
(iMB = iMacros Browser)
If you choose for the "'URL GOTO' Syntax with 'alert()'" way, post your Working Script, I'll be curious to see how it looks like for the 'EVAL()' and 'alert()' Statements and how you manage to pass your Variable for DataSource between the 'alert()' and the rest of your .iim Script. And that might help other Users as well...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...