How To Automate a Native OSX Application with VSCode? - macos

How can I gain programmatic access, with VSCode, to the objects in a native OSX application, written in Swift or Objective-C?
When i say "with VSCode", I mean coding against the object-hierarchy of the target application in the Visual Studio Code IDE, using any language that VSCode supports.
Ideally, consider 2 scenarios:
Scenario in which I am the author of said native application, so I can prepare it for access by VSCode.
Scenario in which I am not the author of said native application, so I cannot get 'under the hood'.
Could something like this be used?
https://developer.xamarin.com/guides/ios/advanced_topics/binding_objective-c/
Note, I wish to gain programmatic access to the underlying object-hierarchy, not just click buttons on the UI.

You can use AppleScript, if the application supports it. If you wrote the application yourself, you can add AppleScript support to it.

Related

what is the development tool of this GUI

I have a light/simple app (Winodws GUI), I want to know what is the development tool of this app? most of the app's files are as bellow.
I am newer to app development, I expected to know like "this app is developed by WPF&C#, Electron&Js, Qt&C++" this message. I am not sure if this message could be idenfied from the files shown
btw, there is an .exe with them
It is impossible to say exactly because these libraries are pretty common.
msvcp140 implies that the base is C++ developed with Visual Studio 2015 or later.
d3d* means something there is using Direct3D as well (could be Chromium). EGL/GLES is more graphics stuff, probably used by Chromium.
The presence of Chrome* means it is either using Chromium to display some web content or the entire app is HTML/Javascript based like Electron.
You should inspect the .exe in a hex editor. And a strings tool.
Use something like WinSpy to inspect the main application window. What is the class name?

Develop application for windows without any depedendency

I need to create an application for all versions of windows (XP, Vista, 7) without the need to install .NET or other 3rd party tools.
The application needs to download files asynchronous which are received in a json format and display a html page which can communicate with the application using javascript.
Is there a way to do that using an advanced IDE like Visual Studio but without requiring anything besides the application exe?
Are there any open source alternatives?
Thank you.
Look into the WebBrowser control. It's basically an Internet Explorer control you can embed in your application, and it has an interface that allows all sorts of manipulations. And given Internet Explorer is always a part of windows, it'll always be available without further installations.
Using the control requires some work. You can start by looking at Using the WebBrowser control, simplified. It uses MFC, but you can use the control with plain C++ as well.
The way I'd use it is push as many complicated tasks as possible to the browser control, and run them using JavaScript. A-synchronously downloading JSON is a pain in C++, but a no-brainer in JS. So you can basically divide your logic between C++ and JavaScript, and figure out some interface (by using, say, the DOM).

Any way to make cross platform simple thin client in Ruby that utilizes system-tray and status-item?

I know that cross platform GUIs can be built in Ruby using various tools like shoes and FxRuby, but do these types of tools have platform specific access to the level that I need?
My app is mostly web based, but needs a thin client that is basically just for desktop configuration settings. So I'm only going to have it exist as a menu, and then a few simple tools like folder selection boxes, and when the thin client is launched it will only exist in the tray on windows or in the status item section for a Mac.
Just looking through what is out there, I can't tell if something like this can be coded in a cross platform way or if it is too platform specific.
Using Swing through JRuby might be your best bet. Whether you're ok distributing JARs that allow easy access to your source code is another matter. The MonkeyBars gem sought to simplify the use of Swing in JRuby but I don't think it's seen much development recently. At any rate it's fairly trivial to wrap most of the Swing classes without piling syntactic sugar on top.
MacRuby can't be rivalled for its integration with Cocoa and other OS X frameworks, but you'd then be tied to macs.

How do you port a Cocoa/Mac application to Windows?

How do you port a Cocoa/Mac application to Windows? I mean how would you go about it? Assume the app was written with Objective-C and Cocoa, there's nothing fancy going on, no "engine" that could be factored out, etc.
Rewrite from scratch? I don't think there will be huge overlaps between the Mac and Windows codebases, right?
I have doubts about cocotron.
Its not clear from the cocotron website that cocotron is actually production ready yet. Id suspect that it would be possible to start new app development and use cocotron constantly to maintain and test windows builds on the go.
But to retrofit it into an existing project might be a much larger task. There are also no alternatives to cocotron - other than perhaps gnustep.
The practical approach to cross platform development involves developing the non gui components of your application, once, in C or C++. And then using a cross platform GUI library like QT - which is VERY good at generating and using native UI where possible or faking it where not. Please DO go to qt.nokia.com and download the latest build of QTCreator for windows and mac - See how the same QT application looks and feels very convincingly native on both platforms.
If QT doesn't provide a native enough solution, then you need to develop your GUI twice :- once in Cocoa, and once in Win32. The cocoa GUI would be in objective C of course, the Win32 GUI in C/C++.
Your non gui application code would - written in c++ - not be able to call Objective-C directly, but its not hard to write shim classes, implemented in .mm files - the provide a c++ interface, and wrap access to an objective c object or class.
You are also going to have to come up with an alternative to CoreData on windows - perhaps sqlite? Given that XCode has integrated support for the sqlite framework, and testing multiple code paths is, well, more work - perhaps dropping CoreData in favor of a common layer is a better approach?
The problem with Objective C is its very poor support on any platform that is not OS X. You can attempt to use the Cocotron, but I wouldn't consider it production ready yet.
For portability, a re-write is in order. With judicious use of standard C or C++ for the "core" of the application, you could still implement platform specific GUI code. If you don't like maintaining two GUIs, you can also try a toolkit such as Qt
Depending on which objects and framework you are using for your cocoa app, you might be able to get away with using gnustep, although the end result will probably look very weird to windows users, and the development environment might be a bit difficult to setup at first.
Are you aware of Cocotron? It looks like the project may have gone stale, but it's a good starting point anyway. It's a project to port Core APIs.
If your application is not cleanly separated (ie: a la MVC) then the only solution is a rewrite, I think.

Programming language for GUI compilable to native binary

I need to write an app that reads a config file with info on the menu bars it needs to create.
Normally, I'd just use java, but I need the application to have the least run-time dependencies possible, this includes not forcing the user to download anything, even JRE, let alone something like NET Framework.
So I need something that can compile to an EXE (windows only for now), and that will allow me to CODE the GUI, so I can dynamically create it from my config.
BTW: something like C++ is a bit too low level, all I need is to create menus, and display HTMLs in a panel.
How about wxPython together with py2exe?
There is a nice tutorial on how to do it here.
If Java's too high-level and C++ too low-level, there ins't much in-between. Maybe Delphi?
I wouldn't totally write off using Java and/or Python for a few reasons.
1) py2exe can compile your Python code to an exe.
2) GCJ can compile your Java code to an exe.
Delphi is best chose for you. Because Delphi compile source code into native x86.
Unless you have serious reasons to avoid interpreted languages, I would suggest you better look into ways of packaging or compiling interpreted scripts because doing this will likely reduce your learning and development time.
I would write a simple GUI in Tcl/Tk, and then package it as a Starpack.
ActiveState provides a distribution (ActiveTCL) and a decent editor (Komodo Edit), and it is fairly easy to get simple GUIs going with Tk. Check out TkDocs for some hand holding.
Once you're done, you can package your code, a Tcl runtime, a database, and a virtual filesystem, all into a single executable that you can easily distribute.
Earwicker is right. You can use HTA:
http://www.interclasse.com/scripts/htanotepad.php
But if you know C++, then creating this type of an application is actually very easy with Visual C++. Use MFC, and statically link everything. You can draw the menu in the resource editor, and attach events to the menu items. I wouldn't use HTML if I were you. Just use regular Windows controls. But if you're really set on using HTML, you can embed a Browser control in the formview.
Have you considered D ? It has a syntax that is like a mixture of Java, C++ and Python with the ability to make native windows apps. The tutorials on dprogramming.com are great to get up and going with the language. For quick GUIs you'd be interested in The D Forms Library and the Entice Designer.
Here are some short video tutorials to get up and running with Entice.
Alternatively, have you tried Qt & Qt Creator? It takes a lot of the hair pulling out of C++ Programming and it's also cross-platform.
You say:
all I need is to create menus, and
display HTMLs in a panel.
A lot like a Web browser, then. If it's going to run on Windows, then the user has IE. Why not use IE to do all the work for you?
You can make something a lot like an .exe with IE, called an .hta:
http://msdn.microsoft.com/en-us/library/ms536496(VS.85).aspx

Resources