I have custom .per files used to provide the user a way to interact with an application from Lauterbach. However, once in a while the values of some variables do not update and the only way to get it back to regular functioning is to close the per file and re-open it.
Is there a command that can be called to "self-refresh" the .per file?
Unless you have limited the updating of windows showing memory (e.g. with command MAP.UpdateOnce) all values should be updated periodically (according to SETUP.UpdateRATE).
So I think, there should be no need for a refresh command. Maybe you should contact Lauterbach support and they can help you to find the source, why some values are not updated..
Anyway, the command to force an update of all windows showing memory is Data.UPDATE
If Data.UPDATE is not doing the trick, you could also add a button to your PER window, which allows you to easily re-open the window. To do that, use the following PRACTICE script (cmm-script):
MENU.ReProgram
(
ADD
BUTTONS "per.-W"
(
MENUITEM "[:refresh]refresh"
(
PRIVATE &cmd &left &up
&cmd=WINdow.COMMAND(WinTOP)
&left=WINdow.POSition(WinTOP,LEFT)
&up=WINdow.POSition(WinTOP,UP)
WinCLEAR WinTOP
WinPOS &left &up
&cmd
)
)
)
You need to execute this code before opening the PER window. (I suggest to add this code to the file C:\t32\system-settings.cmm to get it executed on every start of PowerView.)
When opening a new PER window after executing the script, your PER window will have this button:
When clicking the button it will re-open your PER window.
You can add a button for Data.UPDATE to your PER windows in the same way.
Related
When decompiling an app, I find lately, that a few apps' manifests do not seem to have designated activities for the view I want. For example, if com.example.app is on the view I want and I run the following command:
dumpsys window windows | grep -E 'mCurrentFocus|mFocusedApp'
the resultant output will be something like:
mCurrentFocus=Window{9280f2a u0 com.example.app/com.example.app.MainSubMenu}
mFocusedApp=AppWindowToken{da37759 token=Token{9d56fa0 ActivityRecord{5c490a3 u0 com.example.app/.MainSubMenu t98}}}
This is fine, but when the screen I am on is obviously a subactivity/subview/fragment, dumpsys nor logcat will show me the full path to this view. In short, I would like to find the name of the fragment/view and launch directly to it. This syntax looks promising for achieving a fragment view launch (perhaps with some variation):
am start -n com.example.app/.MainSubMenu -e :android:show_fragment com.example.app.somefragmentview
but I am unsure of how to find all fragment names for each activity of the app.
I ended up using AutoInput in combination with MacroDroid to select specific elements of the app's main (launch) screen, based on text. This gets me to any screen of an app without having to rely on touch event coordinates, since developers of these apps typically switch up menu item locations with subsequent updates.
Here is the AutoInput process in detail (which I imagine can be integrated with Tasker as well):
Install both aforementioned apps.
When selecting an Action for MacroDroid, choose the 'Locale/Tasker Plugin' option. This will list AutoInput's options, and any other options for different plugins you've downloaded, I suppose.
Choose the 'AutoInput Action' option from the list.
Select 'Action' from the next screen, then 'Click'.
For 'Field Type' choose 'Text', or any other piece of information you know about the menu/button/element that you would ordinarily select to get to the screen you want. We are talking about a menu/button/element that exists on the main (launch) screen of your app.
Fill in 'Field Text' with the menu/button/element's text.
Hit the checkmark at the top right when you are finished, and it will return you to MacroDroid.
A few notes:
The menu/button/element MUST be visible on the main (launch) screen for AutoInput to identify and select it. The initial menu item I was attempting to open could only be reached by scrolling down first. To remedy this, I told MacroDroid to run a script with an 'input swipe' command first to make the menu item visible.
If your target menu/button/element is not on the main (launch) screen, you will have to follow up your initial AutoInput Action with subsequent AutoInput Actions until you reach the menu/button/element/screen you want. The screen I wanted was twice removed from the main (launch) screen.
Maybe it goes without saying, but I separated each AutoInput Action with an appropriate pause (in MacroDroid, Actions-->'Wait Before Next Action') to select each menu/button/element while accounting for screen load time.
This is all a bit obtuse, I realize, but without knowing how to extract the (has extras) information from Logcat, this was the only available solution that didn't force me to rely on coordinates for touch events. Hopefully this offers a viable alternative until someone finds/offers a way to pull raw extra data from activities.
I'm writing a MEL script which involves opening the grease pencil UI toolbar. I want to remove the close button on that toolbar. I tried doing
GreasePencilTool;
window -edit -tbm 0 greasePencilFloatingWindow;
but get Error: line 2: window: Object 'greasePencilFloatingWindow' not found.
Further tests reveal that running
GreasePencilTool;
window -q -exists greasePencilFloatingWindow;
will return a result of 0.
Running GreasePencilTool; and then window -edit -tbm 0 greasePencilFloatingWindow; at separate times works as expected, as does running window -edit -tbm 0 greasePencilFloatingWindow; when the toolbar is already open.
However, I need to be able to remove the close button immediately when the toolbar opens.
The closest thing I can think of that illustrates what I want to do are Javascript callback functions, where another function can be executed once the current function is finished... but is there a way to do something like that in MEL?
I've also tried using the evalDeferred command without success.
The grease pencil tool is launched asynchronously so the window will not be present for some unknown length of time. This means the best you could do is trigger a function which would check periodically and do it the next time you find the correctly named window; you could attach this to an idle time script job.
It's ugly. But it is probably the only way since there's no event that will notify when thje window arrives. If you do that, make the script job suicide after it fires so it's not sitting there on every idle check till the end of time.
In child window of my application, I have placed one single line edit control named as sle_name. Its tab order is 1.
Below that control I have placed DataWindow having formatted as free form style.
When I run the app, if my focus is in sle_name, and I click on sle_name then rbuttondown event is triggered. Then I move my focus to DataWindow(dw_account). Once I got focus on dw_account and then if I try to click on sle_name, my focus is not moving on sle_name and neither I can run rbuttondown event on sle_name.
What is the reason for this problem?
One more thing: when I start this window my focus in set in sle_name, from that control if I press tab key then my focuse moves to dw_account and if I press again shift+tab then my focus is moved back to sle_account.
But if I try to set focus from dw_account to sle_account using mouse pointer it is not moving focus.
What is the reason behind this behaviour?
I had the same behavior in a child window.
It was fixed when disabled the 'ControlMenu' and 'TitleBar' properties in the window. (It's so strange).
Hope it helps
Juanma
This isn't natural behaviour, so the cause is likely something you've scripted. Depending on your architecture, the culprit code could be a number of places (e.g. framework objects). If this were my problem, I'd run with the PBDEBUG trace turned on (a System Option in the IDE, or /PBDEBUG on the command line after the deployed EXE name), and see what is firing when you try to move back to the SLE.
I'd also be using PBL Peeper to see the trace and the code side-by-side, so it's easier to see what code is being executed (the trace only shows you script name and line number).
Good luck,
Terry.
you must have to create the event ID pbm_lbuttonup, with the same parameter as rbuttondown event. Then in the code you write this.setfocus()
I am making a program called "BasicSys". It is a BASIC System simulator that uses a textbox for the console. So far I have everything working great but I need to have the text box act like a command prompt window. It needs to be able to ask for input and retreive the value without allowing the user to modify anything outside of the prompt space (the space where the user should only be able to type is after a ":" or a ">"). Some feilds are password feilds that require either no echoing or having the chartacters replaced by *'s. Is it possible to make a console out of a textbox?
P.S. I also want to know if there are any small BASIC v2 compilers for Win32 so BasicSys can compile and run BASIC programs.
Depending on how realistic you want it to be you can use the API to open a real console window and interact with it. There are many examples available that you can find by searching such as this one. My suggestion though would be to fake it with a multi-line textbox. It would not be very tricky. Set an index every time you draw the prompt, then as long as the cursor is positioned after the index the textbox is read / write. If the user scrolls backwards make the textbox read only. It should be fairly simple using the KeyDown event and setting the ReadOnly property True / False to get a passable "command" window.
I would like to know if it's possible to simulate the process: Right click on an image -> Click on "Save image as.." on the popup menu -> save the image in local.
I tried CaptureBitmap() function, but the result is just a screenshot taken by QTP, not the same image file obtained as the procedure above.
Are there other ways? Many thanks in advance.
Allen
I suppose it depends what you want to do. If you want to compare the bitmap then the CaptureBitmap options should work. If you want to compare the path to the image you can use Image("x").GetROProperty("src").
If you really want to save the src image file then unfortunately QTP doesn't supply a way to interact with the browser's context menu. You can try to use some third-party mechanism to download the image from the src URL (e.g. wget).
Edit: I just had another thought, I'm not at work so I can't verify that it will work but I'm pretty sure it will.
First cause the context menu to appear, in order to do this you have to change the replay mode to device and run a RightClick operation.
replayType = Setting.WebPackage("ReplayType") ' Store old replay mode
Setting.WebPackage("ReplayType") = 2 ' change to device replay mode
Browser("b").Page("p").Image("I").RightClick
Setting.WebPackage("ReplayType") = replayType ' Revert to old mode
Then send the letter v to the browser which will select the Save menu item (on both IE and Firefox) by using the device replay object
Set deviceReplay = CreateObject( “Mercury.DeviceReplay” )
deviceReplay.SendString "v"
Now interact with the save dialog as a usual Win32 control.
Moral: Never underestimate what QTP will let you do if you try hard enough