Script to launch interactive session inside Spss Modeler - scripting

i want do interactive tree for my project. i'm writing code inside modeler syntax and this program to get me what i want(which i want Rots tree values) . Launch interactive session opens the tree builder, values is okey but i dont generated model inside scripting. i need just a click generated model icon (without manual) but this way manuel click. who know is this trick with coding or scripting?
i'm writing my code example;
import modeler.api
stream = modeler.script.stream()
res=[]
m1= stream.findByID('id68YV8NTPKIR')
m1.setPropertyValue("prune_tree", False)
m1.setPropertyValue("model_output_type", "InteractiveBuilder")
m1.setPropertyValue("tree_directives", """Grow Node Index 0 Children 1 2 Spliton (
"TotalCharges", Interval ( NegativeInfinity, 100) Interval ( 100, Infinity ))""")
m1.setPropertyValue("tree_directives", "Test")
m1.setPropertyValue("model_name", "Cart_Drug")
m1.run(res)
thanks.

There is no way to automate the generation of the model from an interactive session as these are by design intended to be interactive.
Can you provide some insight into why you are looking to automate an interactive session rather than just using the default of generating a model directly? Is there some specific feature that you are looking for that is not otherwise available?

Related

ReadyAPI - Automation script to get the value from data source step

i am new to ReadyAPI and automation. But now i facing some issue where i wanted to fill in the consent page will the value that will get from the Data source.
The Role value is the value that i need to get and fill into the consent page
Here is my automation code to get the value:
I have to get the value from Data source, then fill into text box, then click button
This is the code im using:
document.getElementById('freeTextHabilitations').value = 'ObjectiveCombinaisons Data Source#Role';
document.getElementById('allowBtn').click();
I having problem where get nothing after the data source ran .
Anyone have any idea on how to inject the value from data source to automation script (java?)
Thank you.
Stanley,
Unclear as to how you are using DOM methods(with ReadyAPI), but to answer your question on accessing Data Source values
For that, you will need property expansion. So, your groovy script should be something like
xxxx.value = context.expand( '${ObjectiveCombinations Data Source#Role}' )
Property Expansion
This can be generated for you by using the Get Data dialog
Get Data Dialog

Karate UI automation, is it possible to make locators dynamic

Thanks Peter for API,Perf karate framework.
Now I am trying UI automation and it looks perfect as of now.
I have below question:
I have a menu bar with 15 items in it. they are named as following:
-Home
-Account
-groups
-settings
etc etc.
Locator for each one is like this "a[name=Home]" , "a[name=Account]", "a[name=groups]" . So ony the part after name= is something that is dynamic in nature. So my question is that is it possible to somehow make this dynamic locator?
I have written a called feature in which i have written steps to login and select a menu item. and I want to pass the menu item from calling feature in json like below:
if I want to click on Account menu
* call read(menuItem.feature) {menuItem: Account}
menuItem.feature looks something like below:
Given url 'xyz'
And input (username, userID)
And input (password, password)
And click("button[name=login]")
And click("a[name=Home]")
Here I want to make Home as dynamic in last click step on menuItem.feature so that I can pass other menu items and reuse all above steps/feature file to login everytime with different menu items passed from calling feature file in json{.
Again its just a query. I have currently written multiple scenarios to click on menu item and then in calling feature I call the called feature with tags like #Home,#account etc. and this works perfectly fine.
Also if there is any other better way to achieve this then please suggest
Yes. Let me put it this way, the things you see such as input('foo', 'bar') is pure JS behind the scenes. So normal programming-language rules apply. For example:
* def dynamic = 'foo'
* def locator = 'a[name=' + dynamic + ']'
* input(locator, 'some value')

How to convert the spectrum type ("Spectrum" -> "Convert Data to")

Is there a manner in which one can convert the spectrum type, for instance to EELS, by DM scripting? This screenshot represents what I'm referring to. I'd like to import a dataset using the GMS 3.4 Python interface, and then turn that into a EELS dataset for further processing (ideally without having to manually interface with the screenshotted menu bar).
Yes there is.
The "type" is simply a meta-data tag
which you can easily set with the TagGroup commands.
There is, however, one complication:
Data "registers" itself with DM when it first appears. Changing the meta-tags manually doesn't change this registration. (The menu command, however, does.)
Thus, you will only see effect of the type change when
either:
You save, close and reopen the data
You clone the data, throw away the original, and display the clone
The second option might cause issues with data-linkage though, as the unique image ID of the data is newly created.
Example using the first method (requires save & load):
image img:=GetFrontImage()
TagGroup tg = img.ImageGetTagGroup()
tg.TagGroupSetTagAsString("Meta Data:Signal","EELS")
imageDocument doc = img.ImageGetOrCreateImageDocument()
doc.ImageDocumentSave(0)
string path = doc.ImageDocumentGetCurrentFile()
doc.ImageDocumentClose(0)
doc = NewImageDocumentFromFile(path)
doc.ImageDocumentShow()
An alternative option is to rely on the menu command. If it is present, then you can simply use the ChoseMenuItem() command to invoke it.
However, the command will only be available with the UI when the data you want to change is front-most (i.e. not a script window!) You will need to ensure by script, that this is the case. A simple ShowWindow() will do.
image img:=GetFrontImage()
img.ShowImage()
if ( !ChooseMenuItem("Spectrum","Convert Data To","None") )
Throw( "Conversion to none failed.")
if ( !ChooseMenuItem("Spectrum","Convert Data To","EDS") )
Throw( "Conversion to none failed.")
Disadvantage of this solution: You will get the user-prompts.

How to get the IDObject with Attribute in SAP using Automation Anywhere with DLL?

I'm developing an automation process on SAP with Automation Anywhere using the SAP DLLs provided by Automation Anywhere itself. I need to find IDObject with specify attribute to click/get value the specify element , but seems that there are no fuctions that allow you to do it. An example of code generated from the SAP recorder is the following:
session.findById("wnd[0]/shellcont[1]/shell/shellcont[0]/shell").setCurrentCell 0,"ICON_EXEC"
session.findById("wnd[0]/shellcont[1]/shell/shellcont[0]/shell").selectedRows = "0"
session.findById("wnd[0]/shellcont[1]/shell/shellcont[0]/shell").clickCurrentCell
using the dlls I have already tried the following functions:
Step 1 : Login on existing session (in this case 0)
Step 2 : Search Object by ID (in this case wnd[0]/shellcont[1]/shell/shellcont[0]/shell )
Step 3: CurrentCellRow (in this case 0)
Step 4: DoubleclickCurrentCell
The problem is that it doesn't click where i want, because as you can see there is the attribute "ICON_EXEC" that specify the element that i want to click . (i also tried to insert in the SearchObjectbyID all the string with the attribute, but it doesn't work)
Currently to avoid that i'm using Execute VBscript, but it seems that error handling does not work with scripts, so i would like to avoid them too
Any tips?
Thanks,
U.
You can find out the SAP-Object ID (IDObject) by recording a (.vbs-)macro in SAP:
Hit Alt + F12 or click the respective icon and choose "Record script and playback" ("Skript-Aufzeichnung und -Playback" in my screenshot):
In the following dialogue window, hit the record button and click the desired object:
Open the recorded .vbs-macro and and look for something like this (=the desired object ID):
You can handle errors in sap vb script , please refer below articles as reference and handle error as per you requirement.
1) https://answers.sap.com/questions/9676858/error-while-logging-to-sap-through-excel.html
2) https://wiki.scn.sap.com/wiki/display/Img/Scripting%3A+Error+Handling+and+Debugging

How to make jedit file-dropdown to display absolute path (not filename followed by directory)?

All is in the title.
If a have opened the three files:
/some/relatively/long/path/dir1/file_a
/some/relatively/long/path/dir1/file_b
/some/relatively/long/path/dir2/file_a
The file dropdown contains:
file_a (/some/relatively/long/path/dir1)
file_a (/some/relatively/long/path/dir2)
file_b (/some/relatively/long/path/dir1)
And that bother me because I have to look on the right to differentiate the two file_a, and on the left for the others. This happens a lot to me mostly because I code in python, and thus I often have several __init__.py files opened.
How do I get jedit to display
/some/relatively/long/path/dir1/file_a
/some/relatively/long/path/dir1/file_b
/some/relatively/long/path/dir2/file_a
config:
jedit 5.1.0
java 1.6.0_26
mac osx 10.6
Unfortunately this is not easily possible currently, I just had a look at the source and this is not configurable.
You can:
Submit a Feature Request to make this configurable (good idea in any case)
Create or let create a startup macro that
registers an EBComponent with the EditBus that listens for new EditPanes getting created
retrieve the BufferSwitcher from the EditPane
retrieve the ListCellRenderer from the BufferSwitcher
set a new ListCellRenderer to the BufferSwitcher that first calls the retrieved ListCellRenderer and then additionally sets the text to value.getPath()
Try the Buffer List plugin as to whether it maybe suits your needs
Now follows code that implements the work-part of option two, runnable as BeanShell code which does this manipulation for the current edit pane. The third line is not necessary when done in an EBComponent, this is just that the on-the-fly manipulation is shown immediately.
r = editPane.getBufferSwitcher().getRenderer();
editPane.getBufferSwitcher().setRenderer(
new ListCellRenderer() {
public Component getListCellRendererComponent(list, value, index, isSelected, cellHasFocus) {
rc = r.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
rc.setText(value.getPath());
return rc;
}
});
editPane.repaint();