Autohotkey: Scrape text from window (LOTRO) - automation

I am fairly advanced with my LOTRO scripting, but sadly, have not figured out a way to capture data from the chatbox. I am trying to write an external mapping application and would like to have autohotkey automatically grab data from the screen, particularly the location data that has the heading, by typing:
/loc
inside of the chat box.
This image is linked to imgur with the areas I am trying to capture highlighted.
I find it very odd as I can highlight the text in the window easily, and copy and paste it to notepad or any other wordpad editor.
I have tried to following methods to attempt to gather the text from the window, but I cannot seem to find any controls or text, even when running the script as administrator.
WinGet, cList, ControlList, A
Loop, Parse, cList, `n, `r
{
ControlGetText, cText, % A_LoopField, A
if cText
res.="Control: " A_LoopField "`tText: " cText "`n"
}
MsgBox % res
WinGetText, text ; The window found above will be used.
MsgBox, The text is:`n%text%
Any ideas?

Games have non conventional GUIs and you can't just get there controls and use them.
For getting information from screen for nonconventional GUIs you can use following commands: ImageSearch, PixelGetColor, PixelSearch.
You can also try to get information from registry (maybe information that you need is stored in registry) with RegRead command.
Some information can be stored in text files and you can read them with FileRead, FileReadLine, LoopReadFile.
Also you can try to get information from memory. For scripts and guides about reading memory with AutoHotkey just google "AutoHotkey read memory".
Also be aware of that.

Related

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.

Calabash-android: How do I read text which comes from an API?

I want to read the text which comes from API end, When I query (query("*")) it does not appear on the calabash-android console.
wait_for_text(text, timeout: 10) does not work either.
query "all * marked'Email field can not be empty'"
Calabash doesn't return results that are not visible by default. So if the error message is on the screen but just invisible, using the all operator should do the trick.
In android two different message can show in edit text field by using hint text and error text
if its hint text use this:
query("* id:'edit_text_id'", :hint)
if its error message use this:
query("* id:'edit_text_id'", :error)
Normally these kind of text messages won't show by querying -> query("*")

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();

ClearAll["Global`*"] automatic insert

I don't know where to find and adjust the configuration file to have Mathematica insert ClearAll["Global`*"]
at the beginning of every new notebook. How can I do this, rather than having to type it everytime I open a new notebook?
AFAIK there is no way to change the default new Notebook. But it is possible to add custom keyboard shortcut and/or menu command which will create new Notebook which will contain whatever you need. For example, you can add menu item "New my Notebook" under the "File -> New" submenu and assign Ctrl+Shift+N keyboard shortcut to evaluate it (this modification will only persist during current FrontEndSession) by evaluating the following (taken from here and here):
FrontEndExecute[
FrontEnd`AddMenuCommands[
"New", {MenuItem["My new Notebook",
System`KernelExecute[
CreateDocument[ExpressionCell[Defer#ClearAll["Global`*"], "Input"]]],
FrontEnd`MenuKey["N", FrontEnd`Modifiers -> {"Control", "Shift"}],
System`MenuEvaluator -> Automatic]}]]
Now pressing Ctrl+Shift+N will open new Notebook window with "Input" cell already containing ClearAll["Global`*"]. If you replace FrontEnd`Modifiers -> {"Control", "Shift"} with FrontEnd`Modifiers -> {"Command"}, the keyboard combination will be Alt+N.
Information on how to make this change permanent can be found in this MathGroups post:
You can completely reset the menus using...
FrontEndExecute[FrontEnd`ResetMenusPacket[{Automatic}]]
You'll get some ugly flicker, but that would work. You can also put
the AddMenuCommands function in a front end init.m which can be found
someplace on the path specified in the ConfigurationPath option. In
that case, the init.m file will get executed by the FE as it starts,
not the kernel, and so it won't matter how many kernels you start or
quit.
So you need to create the init.m file in one of the paths given by the ConfigurationPath option:
Options[$FrontEnd, ConfigurationPath][[1, 2]]
{FrontEnd`FileName[{$InstallationDirectory, "Configuration", "FrontEnd"}],
FrontEnd`FileName[{$UserBaseDirectory, "Autoload", _, "Configuration", "FrontEnd"}],
FrontEnd`FileName[{$BaseDirectory, "Autoload", _, "Configuration", "FrontEnd"}],
FrontEnd`FileName[{$InstallationDirectory, "AddOns", "Autoload", _, "Configuration", "FrontEnd"}]}
Some of these paths contain blank (_) which is undocumented but seemingly means any name (I have not not checked this).
Another way to make this change permanent is to edit your MenuSetup.tr file, but it is not recommended.
P.S. I recommend you in future to ask your Mathematica-related questions on dedicated site, where they will receive more attention:
https://mathematica.stackexchange.com/

webmatrix list of keyboard shortcuts

List of keyboard shortcuts supported by Microsoft webmatrix.
Official list from Microsoft here:
http://www.microsoft.com/web/post/webmatrix-keyboard-shortcut-guide
Also, you can use the Alt key to display top level key tips. The top level key tips are show below:
Then, press Alt plus a top level key (such as H for Home as shown above) to show all of the keys that can be used on that tab. Use the displayed key value to access the related functionality.
For instance, Alt + H then T will allow you to print.
Just for those who happen upon this post, please check out the up to date list here:
http://www.microsoft.com/web/post/webmatrix-keyboard-shortcut-guide
Here are some additional ones that work inside the editor. Mind these are in an internal format that maps hotkeys to command codes. Its fairly readable though.
If you save this file in the WebMatrix config folder (typically c:\program files (x86)\Microsoft WebMatrix\Config), the editor will pick up modifications you make to this file. * Use at your own risk *
None;Right;RIGHT
None;Left;LEFT
None;Up;UP
None;Down;DOWN
None;PageUp;PAGEUP
None;Next;PAGEDN
None;Home;HOME
None;End;END
None;Escape;CANCEL
None;Delete;DELETE
None;Back;BACKSPACE
None;Insert;INSERT
None;Return;RETURN
None;Tab;TAB
Shift;Back;BACKSPACE
Shift;Right;RIGHT_EXT
Shift;Left;LEFT_EXT
Shift;Up;UP_EXT
Shift;Down;DOWN_EXT
Shift;Home;HOME_EXT
Shift;End;END_EXT
Shift;PageUp;PAGEUP_EXT
Shift;Next;PAGEDN_EXT
Shift;Tab;BACKTAB
Shift;Return;RETURN
Alt, Shift;Right;RIGHT_EXT
Alt, Shift;Left;LEFT_EXT
Alt, Shift;Up;UP_EXT
Alt, Shift;Down;DOWN_EXT
Alt, Shift;Home;HOME_EXT
Alt, Shift;End;END_EXT
Control, Shift;Right;CTLMOVERIGHT
Control, Shift;Left;CTLMOVELEFT
Control, Shift;Home;TOPLINE_EXT
Control, Shift;End;BOTTOMLINE_EXT
Control, Shift;L;DELETELINE
Control, Shift;Oem6;GOTOBRACE_EXT
Control, Shift;Space;PARAMINFO
Control, Shift;P;SELUPCASE
Control, Shift;W;SELLOWCASE
Control;Space;COMPLETEWORD
Control;J;SHOWMEMBERLIST
Control;Back;DELETEWORDLEFT
Control;Delete;DELETEWORDRIGHT
Control;A;SELECTALL
Control;Right;WORDNEXT
Control;Left;WORDPREV
Control;Home;TOPLINE
Control;End;BOTTOMLINE
Control;Up;SCROLLUP
Control;Down;SCROLLDN
Control;C;COPY
Control;X;CUT
Control;V;PASTE
Control;Z;UNDO
Control;Y;REDO
Control;OemPlus;ZOOMIN
Control;Add;ZOOMIN
Control;OemMinus;ZOOMOUT
Control;Subtract;ZOOMOUT
Control;D0;ZOOM1X
Control;NumPad0;ZOOM1X
Control;Oem6;GOTOBRACE
Control;L;CUTLINE
Control;T;TRANSPOSECHAR
Control,Control;K,D;FORMATDOCUMENT
Control,Control;K,F;FORMATSELECTION
Control,Control;K,I;QUICKINFO
Control,Control;K,C;COMMENT_BLOCK
Control,Control;K,U;UNCOMMENT_BLOCK
Control,Control;M,M;OUTLN_TOGGLE_ALL
Control,Control;M,U;OUTLN_TOGGLE_CURRENT
Control,Control;M,O;OUTLN_COLLAPSE_TO_DEF
Control,Control;M,P;OUTLN_STOP_HIDING_ALL
Control,Control;M,S;OUTLN_START_AUTOHIDING
CTRL-C
CTRL-V
CTRL-O
CTRL-S
CTRL-A
CTRL-W
CTRL-T moves a letter one step to the left?
CTRL-Z
CTRL-U
CTRL-I search in file (direction down)
CTRL-F find
CTRL-G go to line
CTRL-H replace
CTRL-X
CTRL-N new file
To view the current file in the browser instead of the site root.
CTRL+F12
As the Webmatrix 2 'Run' button opens the root index html file.