I am using Firefox Scratchpad to understand the scaling behavior that
results when the user types the CTRL-PLUS and CTRL-MINUS keys.
In Javascript Scratchpad, I'm evaluating a snippet of Javascript code that accesses the
Components.interfaces.nsIDOMWindowUtils.screenPixelsPerCSSPixel
property like this:
var util = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindowUtils);
util.screenPixelsPerCSSPixel
In Scratchpad typing CTRL-L after the last l in screenPixelsPerCSSPixel above results in an Exception:
Exception: The operation is insecure.
(Note that the current active Firefox tab is pointing to http://www.google.com).
The devtools.chrome.enabled flag is set to true in this
context, but that does not seem to matter as an Exception is still being thrown.
What do I need to do in order to get Javascript Scratchpad to display
that value?
This is intended only to be temporary to gain understanding during a
debug ritual. Set aside for now the obvious question of "Why is it a
security risk to show a scaling factor?". I'm only after getting at
the value from the confines of standard, and safe, Firefox controls
such as enabling/disabling about:config values that I can easily
undo later when I'm done.
Here is the answer I found:
Accessing the window variable from the Scratchpad scope whose
Environment (see its Environment menu) is set to Content yeilds one
type of object, while if Environment was set to Browser, a different
type of object is in play (CTRL-L on it in Scratch pad reports it is
of type ChromeWindow). The window.content object is the content
object relative to the ChromeWindow object.
The value of
....QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindowUtils).screenPixelsPerCSSPixel
relative to the window object (ChromeWindow) object returns
1, while calling it on the window.content shows something other
than 1 and show that scaling is involved.
(EDIT: I relocated the Javascript code that used to be here; see below.)
To demonstrate using the value, I've provided some sample Javascript in an answer to my other question at Finding top-level X Window x/y coordinates of CTRL-F text in Firefox
Related
I've tried nearly anything, The "Type Into" activity won't print plain text into the text box let alone a held variable. The textbox element in question is the update work items comment box in the acme-test website from the Level 3 RPA developer course. I am able to type into the box manually and the robot is able to find it (the cursor moves to the centre of the text box and the program continues). I've tried quite a lot, including using a click activity and then sending the string as hotkeys.
Most probably the issue is related to your selectors. Since you are on level 3 RPA developer course I assume you are using Reframework for the task and I believe because of comprehensive error handling capabilities of this template your application just continuous with the next item instead of crashing when it can't find the element.
To solve the selector issues I usually do the following:
Use partial selectors instead of full selectors
Use wildcards for dynamic parts of your selectors (* for replacing any number of characters, ? for replacing exactly 1 character)
You can also store the page you are working on in a Uipath.Core.Browser type variable to eliminate the need of reselecting browser.
Also keep in mind that if you have used basic recorder functionality of UI path it generates full selectors.
using IUP - Is there any way to clear all the content out of a IupText object? I'm implementing a very simple 4 line display that is supposed to emulate a hardware device. Unfortunately, through days of experimentation, I found that using IupInsert eventually reaches a limit, so you need to delete the contents. The only way I was able to simulate this was to destroy the IupText object and the IupDialog object containing it. This is very inefficient and ugly, but the documentation is misleading. I also attempted to detach and destroy the text box, without destroying the dialog, but I was unable to insert/append a new text box that would actually show up on the screen. The return value from the append was valid, but even after refresh, IupShow, etc., the dlg would never display the text again. Thank you for any insights
Just set the VALUE attribute to "".
Inside one my tabview tabs I have a 'Logout' button with this
var application = require("application");
application.run({ moduleName: "app-login" });
However I get:
RangeError: Maximum call stack size exceeded
when the code is executed. Ultimately I'm trying to get back to the login screen when the user needs to logout, in full screen (i.e not within the tab). The architecture of the application is based similar to the tabview-template example, with frames for each tab.
Any help much appreciated!
Indeed the application.run() is the method that bootstraps your app. You shouldn't call it twice.
The nested frames feature isn't officially supported and isn't documented, but it's possible in NativeScript core. The reason it's not yet official is due to some unexpected side effects with ActionBars and such. In your scenario you should simply get the correct Frame and call navigate() on it. I created a simple playground example here - https://play.nativescript.org/?template=play-tsc&id=tq6B2K
The key in this example is to assign an id to each Frame in your xml, so that you can use the getFrameById() method to find the correct Frame in the hierarchy.
Also, note that I have set actionBarHidden to true on the page with the tabs. If this is not set, you would see two nested ActionBars.
I may be misunderstanding your architecture, but I don't think calling the bootstrap function application.run({ moduleName: "app-login" }); more than once in the app's lifecycle is valid as the app is already running (regardless the screen it's on).
I am trying to view the entire contents of a variable in the IDLE Debugger for Python 3.6.1. The debugger gives a preview but there appears to be no way to pull all the data out from the debugger.
The only work-around I've found is to throw a print() statement in the code somewhere. Is this the only way? See picture:
This example's decryptedText variable has over 700 characters but as we see, only a few are visible. Thanks.
As the IDLE debugger is currently written, the only way to get more information about the state of an object at a particular point in the execution is to either insert print calls in the code or stop execution (raise SystemExit, for instance) and interact with the object in the Shell.
What you see in the locals/globals panels are representations of objects produced by reprlib.Repr with maxstring and maxother increased to 60. One could edit NamespaceViewer in idlelib/debugger.py (3.6 name) to increase maxstring to, say, 200 and maximize the debug window. (I verified that this works to show more of a string.) One could also try replacing the single line Entry widget with a Label widget sized to height lines and width chars and setting maxstring to height * width. (Untried.)
I agree that being able to get more information on a object would be good. I am currently thinking about a separate popup window with type, length (if appropriate), and a much bigger slice of the contents.
So I'm writing a script to modify quickly a VB6 application's interface with COM controls. (Created in C# .net). Most of it works fine, but some panels are giving me a lot of trouble.
Basically, I open the .frm file and read it, and when I find some controls I modify their values or insert new things. When I find a panel, I create a different panel around it so it looks better. I'll put, say Top = 2340 in the file for my new element. If I open the .frm in notepad, I can clearly see that the value of Top is at 2340. Once I open VB6, the panel's top value is at Top = 8190. It also modifies the Left value, but nothing else. If I save and exit vb6, then reopen the .frm in notepad, the Top value will be saved at 8190.
Why does VB6 uses different values than the ones in the .frm file? Is it trying to avoid elements stacking on top of each other ? What is happening between reading the file and opening it, that forces a different value of the Top property?
Just a theory, but I believe the issue is that the ScaleMode property isn't setup right. By default, unless the container window has the property, it'll be set to Twips. So what may be valid under certain containers won't be valid in other containers.
The MDIForm container, for example, forces Twips, and may even re-position objects based on alignment.
If this is the form itself, which I don't think it is but worth mentioning, make sure the StartUpPosition is properly set to 0 (Manual).