could anyone help how to deal with ribbon commnad bars in testcomplete
I'm trying to save a wordpad file
I'm writing the next code
function saveFile() {
TestedApps.wordpad.Run();
var pWordPad = Sys.Process("wordpad");
var wWordPad = pWordPad.Window("WordPadClass", "Документ - WordPad", 1).Window("RICHEDIT50W", "", 1);
wWordPad.Keys("smth");
var ribbon = pWordPad.Window("WordPadClass", "* - WordPad", 1).Window("UIRibbonCommandBarDock", "UIRibbonDockTop", 3).Window("UIRibbonCommandBar", "Ribbon", 1).Window("UIRibbonWorkPane", "Ribbon", 1).Window("NUIPane", "", 1).Window("NetUIHWND", "", 1);
}
Here I'm stack...I wonder how to open dialog save file?
I tried like this
ribbon.Click("File|Save as...");
however, it doen't work
Use keyboard shortcuts to work with Ribbon in WordPad.
function wordPadSaveAs()
{
var wordpad = Sys.Process("wordpad");
wndWordPadClass = wordpad.Window("WordPadClass", "*");
wndWordPadClass.Activate();
Sys.Keys("~fa");
}
You need to add the NetUIHWND class name to the MSAA or UI Automation list so that TestComplete could recognize different objects on a ribbon. After this, try recording the actions.
Related
I'm using Aspose Cells with .net Core.
I would like to copy a cell formula to another cell and update the cells references in the formula with its new "location".
If I use the cell.copy it's working but It's copy also the cell attributes, like 'locked'.
Is there way around it?
Like when using MS-Excel and you do a “Special Paste Formula Only”
I post my question on the Aspose Forum and got a quick answer from #Amjad Sahi
https://forum.aspose.com/t/copy-formula-from-a-cell-to-another-with-updated-references-without-the-source-cell-attribute-like-locked/239996/2
It's worked for me.
I end up with this:
public void CopyFormulaFrom(ICell cell)
{
var cells = cell.Sheet.Name == Sheet.Name
? _cell.Worksheet.Cells
: _cell.Worksheet.Workbook.Worksheets[cell.Sheet.Name]?.Cells;
var cellSource = cells.CreateRange(cell.Row, cell.Column, 1, 1);
var cellDestination = cells.CreateRange(_cell.Row, _cell.Column, 1, 1);
var options = new PasteOptions() { PasteType = PasteType.Formulas };
cellDestination.Copy(cellSource, options);
}
I'm using go-qt bindings (therecipe).
I faced such a problem that I cannot bring the window with the file dialog forward, I tried all the functions (and their combinations) that I could find on the Internet, but none of them did not help bring the dialog up.
I try to use this function:
fileDialog.SetWindowFlag(core.Qt__WindowStaysOnTopHint,true)
fileDialog.ActivateWindow()
fileDialog.SetWindowState(core.Qt__WindowActive)
fileDialog.SetWindowState(core.Qt__WindowMinimized|core.Qt__WindowActive)
fileDialog.Raise()
fileDialog.SetFocus2()
I also noticed a feature that if you call the dialog again after fileDialog.Exec (), then it will be displayed on top of all windows as needed.
code for this case
var fileDialog = widgets.NewQFileDialog2(nil, "Open Directory", "", "")
if fileDialog.Exec() != int(widgets.QDialog__Accepted) {
return
}
if fileDialog.Exec() != int(widgets.QDialog__Accepted) {
return
}
Code for function where I'm using Dialog:
func choseFile(){
var fileDialog = widgets.NewQFileDialog2(nil, "Open Directory", "", "")
fileDialog.SetAcceptMode(widgets.QFileDialog__AcceptOpen)
fileDialog.SetFileMode(widgets.QFileDialog__ExistingFile)
fileDialog.SetWindowFlag(core.Qt__WindowStaysOnTopHint,true)
if fileDialog.Exec() != int(widgets.QDialog__Accepted) {
return
}
fmt.Println(fileDialog.SelectedFiles()[0])
}
Problem might be related to native dialogs (in my case I am using ubuntu), so I put the flag DontUseNativeDialog. Then the problem was solved.
filename := widgets.QFileDialog_GetOpenFileName(ac.MainWindow,"Open Directory","","","",widgets.QFileDialog__DontUseNativeDialog)
upd: Its works even if the first argument is nil.
I want iterate over a list of string, output the string as plain text in jupyter lab then interactively highlight a substring to get easily the start index of the substring and the length. The goal is to do a quick annotation of text and get the coordinates of the substring.
Is it easy or even possible to do something like this with jupyter notebook (lab)? If then How?
I had a look at ipywidgets but couldn't find something for this use case.
Here's an example with the RangeSlider:
import ipywidgets
input_string = 'averylongstring'
widg = ipywidgets.IntRangeSlider(
value = [0, len(input_string)],
min=0, max=len(input_string)
)
output_widg = ipywidgets.Text()
display(widg)
display(output_widg)
def chomp_string(widg):
start,end = tuple(widg['new'])
output_widg.value = input_string[start: end]
widg.observe(chomp_string, names='value')
You can implement this using jp_proxy_widgets. See the following screenshot:
Note that there are warnings about compatibility for selection protocols -- I only tested this on Chrome on a Mac. Also I don't know why the indices are off by one
(select_callback(startOffset+1, endOffset+1);)
Please see https://github.com/AaronWatters/jp_proxy_widget for more information
Edit: Here is the pastable text as requested:
import jp_proxy_widget
select_widget = jp_proxy_widget.JSProxyWidget()
txt = """
Never gonna give you up.
Never gonna let you down.
Never gonna run around and
desert you.
"""
selected_text = None
def select_callback(startOffset, endOffset):
global selected_text
selected_text = txt[startOffset: endOffset]
print ("Selected", startOffset, endOffset, repr(selected_text))
select_widget.js_init("""
// (Javascript) Add a text area.
element.empty()
$("<h3>please select text:</h3>").appendTo(element);
var textarea = $('<textarea cols="50" rows="5">' + txt + "</textarea>").appendTo(element);
// Attach a select handler that calls back to select_callback.
var select_handler = function(event) {;
var target = event.target;
var startOffset = target.selectionStart;
var endOffset = target.selectionEnd;
select_callback(startOffset+1, endOffset+1);
};
textarea[0].addEventListener('select', select_handler);
""", txt=txt, select_callback=select_callback)
# display the widget
select_widget.debugging_display()
I just started using SALT for a project i am working on. It is said to work with Python but I find quite a bit of difference in thier syntax and overall format. I have pasted a code for a simple task which just opens and imports and loads some libraries onto the SALT console. I hope someone can check abnd see if he/she can instantly identify the language being used and what the code does. This is because i have a suspicion that the code is a mixture between C, Python as well as Java... if that is so doen't that mean it should be a totally different language on its own?
code:
var rtwxlib = import'rtwxlib';
var string = import'string';
var monitor = rtwxlib.Monitor
{
EvActivate = func() { print "Activate\n"; };
EvShutdown = func() { print "Shutdown\n"; };
EvProgress = func(self, fDone, msg = "") {
print("Progress: %d %s \r"::format(fDone*100, msg));
};
EvEventMsg = func(self, msg) {
print("\nEvent: %s\n"::format(iStat, msg));
};
};
var solver = rtwxlib.Solver(monitor);
solver::Open("test.wrx");
solver::DelGeometry();
solver::SaveAs('testresults.wrx');
solver::Close();
I was able to indentify the syntax of the language used as C. I beieve the problem I had which confused me was the libraries used for this code which I later found out was for a particular program. Thank you to all those who tried to help though :)
I have this issue when I change a small bit of text in a label based on the query string. what I am currently trying is
Text = "after 30 June "'<%=Request.QueryString ("Year")%>'" in the comments field"
and getting the following error
'System.Web.HttpRequest.QueryString' cannot be used like a method.
Any help would be much appreciated..
Cheers,
ok according to ur comment i am writing this new code
First Take all your labels in array for which you want to set dynamic text
var labels = ["<%=label1.ClientID%>", "<%=label2.ClientID%>", "<%=label3.ClientID%>", "<%=label4.ClientID%>", "<%=label5.ClientID%>"];
then write this function
function ForLabel(){
var year= '<%= Request.QueryString["Year"]%>';
var labels = ["<%=label1.ClientID%>", "<%=label2.ClientID%>", "<%=label3.ClientID%>", "<%=label4.ClientID%>", "<%=label5.ClientID%>"];
AddDynamicTextToLabel(labels,year);
}
then call this below function in ForLabel Function
function AddDynamicTextToLabel(labels,year){
for (var i = 0; i < labels.length; i++) {
Elem = document.getElementById(labels[i]);
Elem.Value=Elem.Value+year;
}
}
call the function ForLabel in page load
function pageLoad() {
ForLabel();
}
Since you have said that you want to set lable text on client side then you have to write the following code
var label = document.getElementById("<%=Label1.ClientID%>");
var year= '<%= Request.QueryString["Year"]%>';
label.value="after 30 June "+year;
Instead of using the asp:Label, I just made use of the default HTML Label tag which allows me to add <%=Request.QueryString["Year"]%> any where between the text.