Find matlab command window handle/reference - matlab

From matlab it is possible to get a (java) reference to the matlab editor using these commands:
desktop = com.mathworks.mde.desk.MLDesktop.getInstance;
jEditor = desktop.getGroupContainer('Editor').getTopLevelAncestor;
Thanks to Undocumented Matlab
Does anyone know how to get a reference to the Command Window?
It is impossible to obtain it the same way as the group titles do not include 'Command Window'
cl = desktop.getGroupTitles()
cl =
java.lang.String[]:
'Editor'
'Figures'
'Web Browser'
'Variables'
'Comparison Tool'
'Help'
'Time Series Plots'
'Scopes'

Perhaps like this?:
desktop = com.mathworks.mde.desk.MLDesktop.getInstance;
cmdwin = desktop.getClient('Command Window');
Maybe you need to add this too:
cmdwinview = cmdwin.getComponent(0).getViewport.getComponent(0);
h_cmdwin = handle(cmdwinview, 'CallbackProperties');
All of this comes from this forum thread: http://www.mathworks.com/matlabcentral/newsreader/view_thread/257842.
Remark: I am not a MATLAB/Java guru. Google, on the other hand, I can use :)

Related

How to get the list of external tools in eclipse

Eclipse knows external tools (menu run->external tools) and I would like to show the list of external tools on a right click in my view so the user can select a tool which I then execute.
I however simply fail to find the external tools.
The code I have now dumps the commands (and there are plenty) but I do not find the external tools I created.
ICommandService commandService=PlatformUI.getWorkbench().getService(ICommandService.class);
Command[] allCommands = commandService.getDefinedCommands();
for(Command curCommand :allCommands) {
Category cat = curCommand.getCategory();
System.out.print(cat.getName()+" ");
System.out.println(curCommand.getName());
}
Where can I find a list of external tools?
Based on the info of greg I found the following to work in my case.
ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType type = manager.getLaunchConfigurationType("org.eclipse.ui.externaltools.ProgramLaunchConfigurationType"); //$NON-NLS-1$
ILaunchConfiguration[] lcs = manager.getLaunchConfigurations(type);
This works for program launch configurations because I use the key ("org.eclipse.ui.externaltools.ProgramLaunchConfigurationType".
If you do not know which type is your command use getLaunchConfigurationTypes() to find all types and list the names to find the Type you need.
There are plenty.

WMI StartService Parameter

I am currently starting a Service in my C# code using WMI, and I would like to set its startup parameters.
Is there a way to do this? I couldn't find anything relevant so far.
Thanks in advance.
Thomas.
These other posts helped me to solve my issue :
https://superuser.com/questions/809868/wmi-startservice-parameter
Dynamics AX 2012 RegConfig does not work
Check the open source project
Services+
Contains full usage of WMI with StartService
Example VB.Net:
Dim objPath = "\\ComputerName\root\cimv2:Win32_Service.Name='ServiceName'"
Using objService As New ManagementObject(objPath)
Dim outParams = objService.InvokeMethod("StartService", Nothing)
rtnVal.WmiValue = CInt(outParams)
End Using

how to move images in openoffice.org BASIC or LibreOfffice.org

After moving pictures in VBA using Shape.IncrementLeft and Shape.IncrementTop I would like to move pictures in openoffice.org BASIC code.
After searching internet with these keywords "move picture" and "openoffice.org" or "open BASIC" or "OOo BASIC" I did not find the answer.
I have found how to move pictures in Java, c++, android, but not in OpenOffice.org BASIC,
I read trough these guides
https://wiki.openoffice.org/wiki/Documentation/BASIC_Guide
http://www.pitonyak.org/OOME_3_0.pdf
I tried to find the answer through LIBRE OFFICE also, but without success.
I tried to record a macro, insert a picture, move it with the mouse and stop the macro.
When looking into the code, the answer of my question take me to the dispatcher and one of the UNO methods, I believe is has something to do with these keywords:
Properties in the com.sun.star.awt.UnoControlImageControlModel service
com.sun.star.drawing.GraphicObjectShape
BorderBottom
BorderLeft
BorderRight
BorderTop
oPoint = oShape.Position
getPosition()
setPosition(Point)
but I cannot find a clear answer and I do not know how to combine them to make the image (or it can be a shape inserted also) to move.
can anybody guide me how to find the answer?
first of all: https://wiki.openoffice.org/wiki/Extensions_development_basic is a good starting point. In particular the XRAY tool is very helpfully.
The following Code changes the position of a selected Image on a Calc Worksheet:
Sub Test
dim aNewPosition as new com.sun.star.awt.Point
oDoc = thisComponent
oSelection = oDoc.CurrentSelection(0)
if oSelection.supportsService("com.sun.star.drawing.Shape") then
aPosition = oSelection.Position
x = aPosition.X
y = aPosition.Y
aNewPosition.X = x + 100
aNewPosition.Y = y + 100
oSelection.setPosition(aNewPosition)
endif
End Sub
Greetings
Axel

Winamp with gen_scripting in Jscript

Using the gen_scripting plugin for Winamp you must instantiate the object. In VBS this is
Set winamp = CreateObject("gen_scripting.WinAmp")
However, I'm pretty sure that the same plug-in can be used to script Winamp using Jscript (or possibly even Javascript - a better choice for me). So, I've tried
var winamp = Object.create("gen_scripting.WinAmp");
x = winamp.GetVersion();
alert(x);
winamp.ButtonPlay;
Only that doesn't work. Any help to get me started would be appreciated
JScript analog of VBScript CreateObject() is new ActiveXObject().
Also, alert is a browser-specific function; in Windows shell scripts you should use WScript.Echo.
var winamp = new ActiveXObject("gen_scripting.WinAmp");
var x = winamp.GetVersion();
WScript.Echo(x);
winamp.ButtonPlay();

Windows Automation with Matlab

Hello I'm trying to control FastHenry2 via Windows automation with Matlab.
I'm new to that topic. If I understood everything right I have to open it:
ax=actxserver('FastHenry2.Document');
and than run the function I want with the handle?
ax.Run('coils1.inp')
but that doesn't work. Matlab can't find Run and uses run instead, which is some build in Function not related at all with the problem. Also all other Function this UI should support don't work either. For Example FastHenry2.IsRunning or FastHenry2.GetInductance. So I guess I do something wrong with the whole UI handling. FastHenry provides an example script using VBS which I attached bellow and since it works fine FastHenry should be installed right on computer. I'm thankful for every hint I can get.
so long
eactor
The following VBS example works fine
Dim FastHenry2
pathPos = InstrRev(Wscript.ScriptFullName, Wscript.ScriptName)
path = left(Wscript.ScriptFullName, pathPos-1)
Set FastHenry2 = CreateObject("FastHenry2.Document")
couldRun = FastHenry2.Run("""" + path + "coils1.inp""")
Do While FastHenry2.IsRunning = True
Wscript.Sleep 500
Loop
inductance = FastHenry2.GetInductance()
WScript.Echo "Coils1 mutual inductance is " + CStr(inductance(0, 0, 1))
FastHenry2.Quit
Set FastHenry2 = Nothing
You might need to use an alternate syntax. Instead of
FastHenry2.Run('coils1.inp')
try this.
invoke(FastHenry2, 'Run', 'coils2.inp')
I've had to do this for some methods on the Excel.Application ActiveX control. I'm not clear why the first syntax doesn't work in some cases.