How to open my electron program when a link (like myprogram://a/a) is clicked in a web browser - html

I want to transfer information from my website to my electron program by using a link that has some data in it (like myprogram://data). But can't seem to find any info on the internet about this. Any help would be gladly appreciated.
Thanks!

You need to register your app as a protocol handler using app.setAsDefaultProtocolClient
app.setAsDefaultProtocolClient("myprogram")
On Windows, when the "myprogram://data" link is clicked, a new instance of your application will be launched and the arguments will be included in process.argv
Use app.requestSingleInstanceLock if you don't want multiple instances of your app to be running
On macOS, you can get the arguments using the open-url event

Related

pywinauto: accessing chrome gui

I am trying to select a printer and print on chrome browser, using pywinauto, but I am not able to access the gui components. I can see the components in Microsoft Inspect.exe in UIAutomation mode. (See screenshot).
I have started chrome with --force-renderer-accessibility flag.
I tried several things but I am not able to access anything in the chrome window. Is it possible to access the chrome gui components using pywinauto?
screenshot: ]1
Probably you use default backend="win32" which is used when you call Application(). To use MS UI Automation you have to set backend="uia" when instantiating Application object:
app = Application(backend='uia').start('chrome.exe <other params>')
My student wrote example script dragging file from explorer.exe to Google Drive in Chrome. Is it working for you?
P.S. If you already use backend='uia', please provide more detailed description with some code and output.

How can XCUITest be used from within an OSX application to remote control iDevices?

Visionary scenario and current goal
My visionary scenario is to remotely control an non-jailbroken iDevice as lag-free as possible.
My current goal is to execute a tap on an iDevice from within an OSX application. For example: A button in a cocoa application which when clicked taps the middle of the screen on a lightning-connected iDevice.
I am not bound to OSX and am open to other avenues.
Approach
XCUITest in the XCTest framework allows to run automatic UI Tests. It is the native way of executing remote taps on iDevices.
The following line would execute a tap in the middle of the screen:
XCUIApplication().coordinateWithNormalizedOffset(CGVectorMake(0.5, 0.5)).tap()
Cheat Sheet for XCUITest: http://masilotti.com/ui-testing-cheat-sheet/
Unofficial Reference: http://masilotti.com/xctest-documentation/
Question
How can I use the XCUITest framework from within an OSX application to remotely tap a connected iDevice? I don't actually want to UI Test an existing application.
My problems start with #import XCTest which is not allowed without a test target and continue with .tap() (iOS) not being available in my cocoa application. How do integrate all this?
Other avenues
What other way should I possibly use instead? It must be possible to execute taps on a connected iDevice remotely, because Appium and Calabash use the now deprecated UIAutomation framework to do so. Both must switch to XCUITest from iOS10 onwards.
Edit 1 - Current status
It seems like my approach is much too complicated and basically means implementing Appium-light. My current approach is to use the Appium Server which handles UIAutomation (and in the future XCUITest). I then implement my own Client to send HTTP requests to the Appium REST-API.

Filemaker Using Web Viewer to build Database Navigation Menu Using Callback URLs

I would like to use the Filemaker web viewer to build and style a database navigation menu. I have found a handful of samples and I have played with the code but the problem that I am having is that it launches in another window (Note that I also have several versions of Filemaker on my desktop and it also tries to launch the pop up in Filemaker 13 when I am building in Filemaker 12).
The goal is to call the script inside of the current database and current application so that it functions as a system navigation menu. In straight HTML in a site environment I would add target="_blank" or target="_parent" to the href but I can't seem to get the syntax right to try it in the web viewer and I'm not sure if this would be the solution. Can any angel from tech heaven assist or offer any advice? Here is the sample code that I currently have that calls a Filemaker script in a local system for a google map interface. I'll be using the script differently but the structure will be the same.
"data:text/html," &"
<html>
<body>
<a href='"&"FMP://" &
Case(
IsEmpty(Get(HostIPAddress)); Get(SystemIPAddress);
not IsEmpty(Get(HostIPAddress)); Get(HostIPAddress);
)
&"/"& Get ( FileName )& "?script=Open-Detail-Map&param=" & Data::ID_Data&"'>View Map
Detail</a>
</body>
</html>"
This works for me, and it opens it in the same window. I'd recommend using FileMaker 13 for development, or uninstalling it. It launches in 13 because the URL protocol handler (FMP) is the same for both versions, so your OS uses the newest version of FileMaker to handle the URL call.
Note that triggering scripts using a URL will not work in standalone files in FileMaker Pro, only hosted files or FileMaker Go.
It is possible to call the script from another file directly in FileMaker, rather than trying to do it from a webviewer. Can you clarify why you're trying to create your navigation menu in a webviewer?
If a webviewer is not compulsory, I would recommend:
creating an External Data Source that points at the other file
Adding FileMaker buttons for your navigation
Right-click on the button you want to trigger the script, and choose "Button Setup", then choose "Perform a Script" and specify the script you want to run from the other file.
Honestly, this makes no real sense to do. I get what you are trying and it seems interesting, but build your navigation in FileMaker and display your banner ads in a web viewer. The other option, which is always available, is to just build out the solution as a PHP site using the FMP PHP API.
I realize that this is an answer for a rather old question, but I think it warrants pointing out what the solution here is...at least in modern versions of FileMaker. I don't recall exactly when this was fixed...13.05 or .06? It was present in earlier versions but wouldn't work for locally opened files, only hosted files; now it works in both.
You need to use the 'currently open file' reference in the FMP URL: "$". So your URL string should look like this:
"fmp://$/fileName?script=AScriptName&param=..."
In your code:
<a href='"&"FMP://" &
If ( IsEmpty(Get(HostIPAddress)); "$"; Get(HostIPAddress) )
&"/"& Get ( FileName )& "?script=Open-Detail-Map&param=" & Data::ID_Data&"'>View Map Detail</a>

Run a program from a local webpage

I'm trying to use a webpage as an entry point for a kiosk. The HTML will be run in local, I need two things:
<a href="c:\Users\Admin\Documents">...
Which works like a charm
And..
<a href="c:\Program Files\Windows Live\Mail\wlmail.exe">...
(program just an example, all programs are the same)
Which works but.. it prompts to download the file then you are prompted to start it.. Is there any way to do this directly, like click and bam you opened notepad.exe? Maybe using a Java applet?
EDIT:
I know it can't be done remotely, I'm talking about local files.
The file will be accessed as c:\myhtml.html
And will open ONLY already installed files, nothing from the web.
If i get your question right , the closest thing to get what you want would be using *.hta which is a HTML Application that runs outside the browser window just like a normal app.
<script type="text/javascript" language="javascript">
function RunFile() {
WshShell = new ActiveXObject("WScript.Shell");
WshShell.Run("c:/windows/system32/notepad.exe", 1, false);
}
</script>
Bit more info here:
http://www.kunal-chowdhury.com/2010/09/how-to-execute-local-file-using-html.html
The right way to implement this is by creating custom protocol in Windows. Details in the MSDN article "Registering an Application to a URI Scheme"
No, this is security issue, browsers don't allow it because it could be security risk to run apps without prompt, just by clicking on the link.
There are several technologies like java WebStart and ASP ClickOnce - they will install the app more or less automatically, signing the application helps too - the messages the user gets look less scary.
Correct me if I didn't understand you. If you're running the web page locally (http:\127.0.0.1) and want to execute a program in the same machine, it will depend on the technology that you're using, for example in php you could use exec() to execute a program on user input but it will run on the server side.

Can an AIR app be programmed to handle a URL protocol?

I'm writing what is essentially a browser in Adobe AIR (ActionScript, not AJAX). A great bit of functionality to implement would be protocol handling. iTunes, for instance, handles itms protocols; when your friend sends you a link beginning with "itms://", it's going to launch iTunes as long as it's installed. Is there a way to write an AIR app (requiring AIR 2 would be fine) that can be the "handler" for a protocol in this way?
There is no way, programatically speaking, to specifically handle a particular protocol. However, there is InvokeEvent. InvokeEvent will be fired when the application is "invoked", either when it's explictly launched or if an associated file or URL is activated.
The process of associating your app with a particular file type or protocol scheme is separate and application-dependant. In iOS, for example, you would need to specify the protocol in Info.plist under CFBundleURLTypes/CFBundleURLSchemes.
Yes. You can use the URLLoader class to download data in binary form (URLLoader.BINARY) and then parse this as appropriate. See this CS3 documentation on working with external data.
http://www.patrick-heinzelmann.de/labs/lastfm/
I'm not sure exactly how it works and I don't see a way to download the app, so I can't even test it, but maybe it will help...
Check out this page. I am trying to find out the same thing, but I haven't found any solution to do it with just Air yet. Seems like you might need a custom installer to setup the correct registry entries, and a proxy application to "wash" the input to a correct format that then can start your application with the correct command line parameters. Hope this can be of any assistance.