sahi scripting issue to record text of popup window - sahi

How to write custom script in sahi to record textbox text in a popup window?
Please, someone suggest me the main file, where I can write my custom function for sahi tool recording?

for pop-ups, use _selectWindow() API.
for ex:
_selectWindow("/1/"); //Here in Sahi controller you can see the pop-up window id in prefix field, you can also use id as regular expression if it's dynamic, as i've used.
_click(_span(15));
_selectWindow();

Related

Featherlight getting value of input text box after close?

I've uploaded an example file (html + js) for a form which is called by FeatherLight. You can download the example from here:
https://ufile.io/f9gpo
The problem is that after closing the FeatherLight lightbox, i have a trigger for "afterClose" and i'm trying to print the value of the input text box, but i get "undefined" instead of the actual value.
How can i access that value after closing the FeatherLight lightbox?.
Thank you.
Why not use the trigger beforeClose instead... The persist option also allows to have a persistent form.

How do I display data/information with Matlab App Designer?

I would like to display some information to the user via Matlab App Designer's GUI. I am new to this program and can't seem to find a widget that provides what I feel should be a simple function. Am I missing something? Examples would include showing the user:
The path of the file that he/she selected
Errors such as "No files detected" that are printed in a Matlab script called on by the GUI code.
Other print statements in code such as "Done!", etc that will inform the user when a process is complete.
Is there a way to capture the output in the Matlab command line and report these in a window of some sort in the GUI? Thanks in advance!
You can use a TextArea to display information for the user. Here's how I made a simple example:
Drag a button to the app in design view.
Drag in a text area also. I changed the label to Feedback.
Select the button and use the Callbacks tab in the bottom right of app designer to add a callback with the default name it gives you.
Edit the callback to contain
answer = 'what your want to display';
app.FeedbackTextArea.Value = answer;
When you push the button the text area gets filled. In your code, instead of just setting 'answer' to some string, set a variable using whatever code is dealing with your user's information. The key is to store what you want the user to see in a variable and then assign that to the "Value" parameter of the text area or other widget where you want them to see the results.

MS Access 2013 textbox update macro

What I am trying to accomplish:
Use button to open a form, filter the form, and set specific value to an unbound textbox in the opened form's header. There are multiple buttons being used open the same form and I would like this textbox to changed every time a specific button is clicked.
What I have done so far:
Used a macro to open the form and the "where" condition to filter the records. I also used "SetProperty" to change the value of the unbound textbox in the opened form's header depending on which button was clicked. When I do used the SetProperty option in the macro I get the error "The control name ... is misspelled or refers to a control that doesn't exist. Error 32004
I have verified numerous times that this is the correct name for the textbox and everything. I am pretty new to access and don't do VBA all that much so any assistance would be greatly appreciated. Thanks.
First Form and Macro for the "Physical Security" Button
Second form with error and unbound txt box I want to change to "Physical Security"
A few Ideas to track down your problem:
Maybe there's a problem with opening and (immediately) accessing the forms controls(?) You could try to fire a macro from within the same from that (only) changes the value of this text-box to make sure it definitely works there. Of course you'd want to make it work there if it failed before you'd go back to your original problem.
Is the property called value? Could it be text?
Are you sure you need to separate (all) hierarchies using !? Just by desperation: Maybe try using Forms!frmVW.txtXY or Forms.frmVW.txtXY
If that doesn't solve it:
It's often best to reduce your problem to it's very basics. Copy your application (!!!!) and radically delete unneeded stuff. Or start a short experiment from scratch (one or two forms, maybe only a button and a textbox, a macro, most probably not even a single Datatable/Source).

Sahi not able to recognize popup window

My application has several popup windows opening from javascript validations. Sahi is not recognizing those. If I manually add it like
_popup("windowTitle"),
It says no such window found. The windows are not javascript popups but normal html pages opening as popups.
the exact error message is:
_popup("Error Window")._click(_button("CERRAR"));
Window/Domain not found: popupNameFromStep=Error Window; derivedName=; windowName=; windowTitle=Happy Time; wasOpened=0
Here the title it is recognizing is actually the parent window title.
What does the controller records it as? If it is a popup or a different window, the controller will record it correctly.
You can use the API _selectWindow which will use to select popup.
// switch to popWin popup window
_selectWindow("popWin");
// perform actions on popWin
_assertEqual("Link Test", _getText(_link(0))); // no mention of popWin needed
var $href;
_set($href, _link(0).href); // no mention of popWin needed
...
// switch back to base window
_selectWindow();
// perform actions on base window
For more details you can visit this link: https://sahipro.com/docs/sahi-apis/popup-windows.html#_selectWindow

Access VBA: Form command button to do something/call function

I have created a basic form in access that has a couple of buttons and text fields.
I want the button to do something along the lines of when I click it, it should bring up a browse file dialog and when I select a file, change the text field to the path of the file.
My question is how can I program this? Specifically, do I create a module that goes like?
sub command1_onClick()
..bla bla...
end sub
Or are forms programmed differently? How can I tie a function to a button?
You can add actions to the button. In the properties window of the button is an Event-Tab. Click on On Click and select Event Procedure. You are then taken to the VBA Editor (ALT+F11) into following procedure:
Private Sub Command1_Click()
End Sub
In that procedure, you can use an API call to open the standard file dialog:
API: Call the standard Windows File Open/Save dialog box
The TestIt function in above link shows you hove to open the dialog and get the path. You can set your textbox to that path like this:
Me!Text1 = strPath
strPath has to be populated with the path you get from the file dialog.
You will want to look at the file dialog property.
Dim fDialog As Office.FileDialog
MSDN File Dialog
The above shows an example that is performed on a button click
The example adds the selected file to a listbox, for your situation you would want to use a simple textbox instead of the listbox.
You may want to set AllowMultiSelect to false to ignore the looping part if you only want one item. (this would simplify the code in the example for you.
.AllowMultiSelect = false
I may be a lil rusty but then you would want to do something like this(someone edit or correct me if I am way off)
Assuming you used varFile
(Dim varFile As Variant)
Me.TextBox1.Text = varFile
EDIT: After encountering error
It seems the error can come froma few things. Check to make sure the reference is there.
Also you may need to add the Microsoft DAO 3.6 Object Library reference.
See the "More information" section of this Link (Hopefully 2002 is close enough to 2003)
. It may have a few more helpful tips if that doesn't solve the problem.