Accessing the changed state of a radio button using rollout creator (Maxscript) - radio-button

I've run across another issue using the dynamic rollouts. I'd like to add a handler for when a radio button group's selection is changed. Here is what I have:
--Instantiate a new dynamic rollout object
dro = rolloutCreator "CustomParamsRollout" "Edit Custom Parameters"
--Begin building rollout
dro.begin()
--Create an array to hold the names of the radio button options
dro.addLocal "RadioOptions" init: #("Predefined", "Custom")
--add control --type --label --displayed name --labels --alignment
dro.addControl #radiobuttons #rdo_1 "radio_1" paramStr: "labels:RadioOptions align:#left"
--Add a handler for the first radio button
dro.addHandler #rdo_1 #changed filter:on paramStr:"1" codeStr:"MessageBox #Hey#"
createDialog (dro.end())
The error I keep getting is:
Compile error: Bad number or time syntax
In line: on rdo_1 changed 1do
Whenever I click on a radio button. I'm most certain that my syntax is poorly written, as that has been the biggest hangup in this project so far. Any helpful hints would be appreciated.
Thank you.

Since 3ds Max 2012 you need to add an extra space to the parameter string (in Max 2011 and earlier version it works without glitches. So instead of paramStr:"state" it would have to be paramStr:"state " – note that using integer for a name of variable will not work, rollout handlers don't in any way work like pattern matching, you need to handle different parameters inside the handler scope.

Related

Apex, Dynamic action, Confirm action, not picking up correct text - what am I missing?

I'm obviously missing something and hoping someone might be able to help.
I've an Interactive Grid, and a button.
When the button is pressed the dynamic action on the button has 2 steps.
Action 1 - Execute Javascript to take a value from one of the IG cells and put it into a page item.
Action 2 - Confirm Action - Are you sure you wish to delete &P10_JOB_ID.
I've made the page item, &P10_JOB_ID, visible and I can see the value has correctly been changed to the value from the IG.
I write P10_JOB_ID into a database table - I get the correct value
But the confirm message isn't picking up the correct value from P10_JOB_ID.
Namely it uses the value in P10_JOB_ID when the page starts, but then as I move around the IG pressing the button and changing the value of P10_JOB_ID, the text in the confirm message never changes.
Can anyone suggest what I might have missed, I'm baffled.
Thanks a lot
Substitutions like &P10_JOB_ID. are made when the page is rendered, not dynamically, so reflect the value at time of page load.
You will need to use Javascript to perform the conform action, something like:
apex.page.confirm ('Are you sure you wish to delete ' + $v('P10_JOB_ID') + '?', 'DELETE');
$v is an APEX Javascript function that returns the current value of a page item.
I used 'DELETE' as an example of a request value; you may want to do something different here.
Ok - having the setting of value and confirm as 2 separate actions is what causes the problem.
As per fac586
That is the expected behaviour. Static text substitutions are performed once during page show processing. They are not evaluated dynamically in the browser at runtime as values change.
Drop the second action and extend the first to display the confirm dialog using the apex.message.confirm JS API method, accessing the item value using the $v shorthand method.

iMacros Tag Line properties

I'm trying to create a macro to log in to a company owned web page. When I record putting the cursor into the User Name text box, the following command is recorded:
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:/pdp/qnyfy/resumeSAML50/pdp/startSSO.ping
The problem is that the "qnyfy" part of the tag line changes. The next time I try to record this tag line, every thing is the same except that "qnyfy" changes to something else; which renders my VBA code useless for logging into this web page.
Is there a way to extract this information first, find out what that 5 characters should be and then re-build a string to use the correct tag line?
Windows 7
Excel 2016
iMacros 10.3
Thanks for the help........
OK, #OP opened some parallel Thread on the iMacros Forum (iMacros Tag Line Properties), which allows me to simplify a bit this Answer and to remove a few of the original IF-IF-IF...
(The parallel Thread contains a bit more (Background) Info and more precise Sols/Scripts applied to this specific Script, for those interested...)
First, FCI (Full Config Info) was originally not completely clear, now it is:
=> iMB v10.3, 'Scripting Interface' v10.3, Win7.
("iMacros v10.3" could have meant 'v10.3 for CR 'Free'/'PE'' also...)
(The 'TAG' Statement is truncated is this Thread, it is complete + complete Script in the parallel Thread...)
Several Solutions, I'll go from "simplest" to "more complex":
1- The 'FORM' Parameter can probably simply completely be removed. It is usually not needed, unless there are several Forms on the Page with similar HTML Elements, here the 'INPUT' Field.
2- Same like '1', but using for example the 'CLASS' Attribute or any Attr(s) that might identify this 'INPUT' Field uniquely if there are several Forms on the Page with similar (but not identical) 'INPUT' Fields. (Or by adjusting the 'POS=n' if they are identical...)
3- Same like '1' or '2', but combined with 'Relative Positioning', on some HTML Element that can be identified "easily" and uniquely to be used as the Anchor, either inside ('3a') the same 'FORM' or 'DIV' (=> this 'INPUT' probably has some 'Label' next to it like some "Login:" for example), or just outside ('3b') if that Form has some Name/Title for that "Section", usually in 'H2' or 'H3' Type.
4- Simply replace the dynamic part ("qnyfy") with a Wildcard:
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:/pdp/*/resumeSAML50/pdp/startSSO.ping
Sols [1-4] probably provide a "Shortcut" to probably achieve the desired Result, but they actually don't really answer #OP's Qt which was "How to identify/extract/isolate this "qnyfy" 5 Letter String...?"
5- Using first one of [1-4] Methods, manage to tag some Element that will be inside that 'FORM', either the 'INPUT' Field itself or one Element that could be used as Anchor in '3a' (with Anchor Inside the Form), and then use 'Double Relative Positioning' (more Info on the iMacros Forum where I've several times already completely explained the Principle) to identify and tag and extract (=HTM) the complete 'Containing 'DIV'' (or could be 'SPAN', but there will very probably be some (outer) 'DIV' also) containing the 'FORM' to then isolate the "qnyfy" part using 'EVAL', stg like...:
SET !EXTRACT_TEST_POPUP NO
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:/pdp/*/resumeSAML50/pdp/startSSO.ping ATTR=CLASS:* EXTRACT=TXT
TAG POS=R-1 TYPE=DIV ATTR=TXT:* EXTRACT=TXT
SET !EXTRACT NULL
TAG POS=R1 TYPE=DIV ATTR=TXT:*&&CLASS:* EXTRACT=HTM
SET Form_ID EVAL("var s='{{!EXTRACT}}'; var x,y,z; x=s.split('ACTION:/pdp/'); y=x[1].split('/'); z=y[0]; z;")
PROMPT EXTRACT:<BR><BR>{{!EXTRACT}}<BR><BR>Form_ID:<SP>_{{Form_ID}}_
6- This one actually comes between '4' and '5', it would be by using '3b' to first locate some Anchor outside the 'FORM' and its 'Containing 'DIV'', then only one Level of 'Relative Positioning' would be needed... (And the 'EVAL()' Statement remains the same...)
That's it...! It would help / add some "Reliability" if for example the Class of the Containing 'DIV' can be identified/added.
Not relevant for iMB v10.3 anymore:
And if "iMacros v10.3" meant "iMacros for CR v10.3 'Free'", you'll need to use ['!VAR1'-'!VAR3'] instead of 'Form_ID' as User Defined Vars are not supported in the 'Free' Version...
[All Solutions/Scripts not tested of course...! Hum, I had previously mentioned that I could directly think of 3 or 4 Solutions, here are already 6, ah-ah...!, and there are also different possible Variants on all 6 of them...]
7- In the parallel Thread on the iMacros Forum, I also mentioned and explained about a Sol_7 using the 'EVENT' Mode with or without ID, which wouldn't be of use for this User as the 'EVENT' Mode was not supported in iMB v10.3.
Rmk:
Sol_5 and Sol_6 can actually be used to deal with Dynamic ID's, same Principle...!
>
I might one day have to delete this Answer as I am currently (re)using each time my last 5/5 'Answer_Credit', I each time have to delete some previous Answer, to be able to post a 5th one, as most Users on the 'iMacros' Tag-Channel usually never follow up on their Threads and don't do "+1" or "Accept Solution"..., and all my previous Answers also usually all get downvoted anyway by some "angry" User(s), so I never manage to pass the Threshold for more than 5 Answers, ah-ah...!, tja...!
(No big deal probably as I actually never or very-very rarely answer Threads on SOF as I don't like the Rep-Pts System, I only answered this one because #OP is a "nice User" that I knew from the iMacros Forum, ah-ah...!)
(I still don't know what the 'community wiki' CB means below posting an Answer...?)

QTP - Checking dynamic pages

I'm trying to check if a value is contained in the innertext of a webelement but I'm having a little problem: frames seem to change at every refresh of the pages.
These are the steps I've recorded:
Browser("SystemPage").Page("SystemP").Frame("dme2_header").Image("Gestione Anagrafiche").Click<br>
Browser("SystemPage").Page("SystemP").Frame("dme2_appl").WebEdit("pdrBean.pdrPod").Set parameter("POD")<br>
Browser("SystemPage").Page("SystemP").Frame("dme2_appl").WebButton("Cerca").Click
Browser("SystemPage").Page("SystemP").Frame("dme2_appl_2").Image("show_files").Click
Browser("SystemPage").Page("SystemP").Frame("dme2_appl_6").Image("Lente").Click
cctype = Browser("SystemPage").Page("SystemP").Frame("dme2_appl_7").WebElement("arrow_down").GetROProperty("innertext")<br>
DataAct = Browser("SystemPage").Page("SystemP").Frame("dme2_appl_7").WebElement("arrow_down_2").GetROProperty("innertext")<br>
Browser("SystemPage").Page("SystemP").Frame("dme2_header").Image("Gestione Anagrafiche").Click
The frames "dme2_appl6" and "dme2_appl7" changes at every refresh of the two pages.
The question is simple: how can I rewrite these two actions to make them universal?
I've tried to do something like:
Set objFrame = Frame("title:=dme2_appl_.")
and then
Browser("SystemPage").Page("SystemP").objFrame.Image("Lente").Click
But QTP gives me an error in return: "property or method not supported by the object"
Please try using the below code
Browser("SystemPage").Page("SystemP").Image("Lente").Click
Avoid using the "Frame" and if you really want to use it, put regex for name property of Frame.
Go to Object Properties--> Click on the Frame object --> Mandatory Properties--> Change name property as
like iFrame_213123123 to i.*
Hope this will solve your problem.
I don't think you can use a frame object that way. When you write Page().Frame() UFT sets the frame's parent in different way than if you first create the Frame.
Think of Frame() as a function that behaves differently when called on a Page or as a free function.
Try:
Browser("SystemPage").Page("SystemP").Frame("title:=dme2_appl_.")

Simulate TAB keypress event in Selenium RC

I need to simulate a tab keypress in Selenium RC, using the Java API.
I do this after having entered some text using:
selenium.type(input, "mytext");
I've tried 3 alternatives to get the tab working:
selenium.keyPress(input, "\\9");
and:
selenium.focus(input);
selenium.keyPressNative("09");
and even:
selenium.getEval("var evt = window.document.createEvent('KeyboardEvent');evt.initKeyEvent ('keypress', true, true, window,0, 0, 0, 0,0, 9,0);window.document.getElementsByTagName('input')[2].dispatchEvent(evt);")
The best I can get is a "tab space" to be inserted after my text so I end up with this in the input field:
"mytext "
What I actually want is to tab to the next control. Any clues? Thanks!
(Note: I have to use tab and can not use focus or select to chose the element I want to go to, for various reasons, so no suggestions along these lines please!)
selenium.keyPressNative(java.awt.event.KeyEvent.VK_TAB + "");
I don't use the Java API, but this post from google groups suggests it is your solution. I can't imagine that "9" is different from "09" in your question, but give it a try?
Try the official TAB char: \t or \u0009
Some functions may used Onblur. It will trigger the function when the field lose the key focus. here we can use fireEvent with "blur" or "focus" command as follows:
command: fireEvent
target: id=your_field_identification
value: blur
Reference: http://qaselenium.blogspot.com/2011/01/how-to-triger-tab-key-in-selenium.html
Improvising Ryley's answer, we can use
selenium.keyDownNative(java.awt.event.KeyEvent.VK_TAB + "");
selenium.keyUpNative(java.awt.event.KeyEvent.VK_TAB + "");
I tried this method for VK_CONTROL in IE and it worked good.
Use typeKeys():
Quoting the above link:
Unlike the simple "type" command, which forces the specified value into the page directly, this command may or may not have any visible effect, even in cases where typing keys would normally have a visible effect. For example, if you use "typeKeys" on a form element, you may or may not see the results of what you typed in the field.
In some cases, you may need to use the simple "type" command to set the value of the field and then the "typeKeys" command to send the keystroke events corresponding to what you just typed.

In SAP SCRIPT, how to add a page break or print the records in a new page

I would like to print the records in a new page every time the contract number changes. What is the syntax for new page in the SAP SCRIPT.
Kindly let me know if you know how to achieve this.
Inside of SAPSCRIPT (Transaction SE71) use the control command NEW-PAGE. (Control Commands are identified by typing /: in the format column).
Inside the Print Program (Transaction SE38) use Function Module CONTROL_FORM to call the command NEW-PAGE:
CALL FUNCTION 'CONTROL_FORM'
EXPORTING
COMMAND = 'NEW-PAGE'
EXCEPTIONS
UNOPENED = 1
UNSTARTED = 2
OTHERS = 3.
You only need to use one of these options, depending on where you will determine if a page-break is needed.