open a sideloaded UWA app with parameters - windows

I have created a wpf app and have been learning how to deploy it as a side loaded windows store app through an appinstaller package.
I now want to launch the app through a shell command with parameters. I did setup a protocol, but it doesnt seem to open the app. to make things worse I do not have permission to see the contents of the windowsApps folder it should be installed in.
can anybody explain how i can launch this app with an argument? Also can anybody explain how the file structure is setup inside the windowsApps folder?

In the end i setup a protocol in the declarataions of my package manifest for my app to allow it to be opened through a url eg myapname:
here is an explanation of how this works
the full uri that is called is passed in the app parameters so i put custom handling in to allow me to pass waht i want in as a querystring
so for example i could call mayapp:?arg1=myvalue or myapp:localhost:80?myarg=myvalue

Related

How to add a custom URL scheme programmatically on macOS?

I need to create a URL scheme that will allow me to open a file with its default software.
For this, I have an .app file that contains the function to open a file via a sent parameter:
myCustomProtocol://Users/xxx/indesign/A.indd
So I managed to make it work by doing everything manually via: https://hublog.hubmed.org/archives/001154
I would now like to automate this URL scheme creation via a script (for the moment, I use SwiftDefaultApps: https://github.com/Lord-Kamina/SwiftDefaultApps).
The .app file will be provided to the user but I must be able to install the custom protocol when installing an application.
Here I have to create a URL scheme programmatically that runs this .app file (like this example with Zoom).
I did my research before making this post but did not find any clear answers.
Thank you in advance !
Just launch the .app file manually and restart the Mac (?) to register the url scheme in macos.
I can then call my custom protocol.
Source: https://github.com/chrisliuqq/mac-custom-url-scheme-to-script

How to red an external file during the installation of an .appxbundle

I want to distribute my UWP app using side-loading.
I have created the .appxbundle using Visual Studio, and also EV code-signed it.
So, when the user clicks on the .appxbundle file, my app is properly installed and the user can start working with it!
In this way, I can place such .appxbundle on my website, and the users can download and install it. Marvelous.
Now, I would like to customize each download, by adding a file with some tracking information to attribute a download e.g. to a specific ad campaign that I am running.
So my server can generate a ZIP file containing the .appxbundle and a little .txt file containing the tracking info (I need to generate a separate file because the signed .appxbundle takes too long - several minutes - to regenerate each time).
The user then unzips the ZIP file, clicks on the .appxbundle and installs the app.
The tricky part is that, during the installation of the app, I would like to copy the .txt file into the LocalState folder of the app that is being installed.
Is it possible?
How can I do that?
Thanks!
If your users are going to install the app by clicking a ms-appinstaller:// link, you can attach extra data using the activationUri.
This can be a custom URL scheme that you register for your app with any url parameters. The appinstaller will call this url once the app is installed.
We use this to pass login information to the app, like this:
ms-appinstaller:?source=https://localhost:8000/myApp.appinstaller&activationUri=my-app-track-install:?campaign=billboards
If your app registers for the my-app-track-install url scheme in the Appxmanifest, then from the apps perspective the first launch is then a url activation with the url you added as activationUri. In your case you would track the install, and then proceed to launch the app normally.
You can find more info on this in the example and remark for this (semi-related) api-documentation:
https://learn.microsoft.com/en-us/uwp/api/windows.applicationmodel.package.getappinstallerinfo?view=winrt-19041

Display PDF file in LocalState folder in Windows 8 app in Cordova

My application downloads a PDF and stores it in the LocalState folder for my Windows 8 app.
I have a link within the app that I would like to show the PDF when the user clicks it.
I've tried displaying it using ms-appdata:///local/pdfs/filename.pdf in a window.open call and I also tried using the InAppBrowser plugin within cordova with no luck. Additionally, I've tried the following:
var uri = new Windows.Foundation.Uri('ms-appdata:///local/pdfs/filename.pdf');
var file = Windows.Storage.StorageFile.getFileFromApplicationUriAsync(uri);
Windows.System.Launcher.launchFileAsync(file).done();
I know the file exists as I'm getting a file result back. Just not sure how to allow the user to view it.
By design, the local appdata folder on Windows is accessible only to that app, or to full-trust desktop applications (and this is probably true of similar sandboxed locations on other platforms). As a result, a Windows Store app that gets launched with Launcher.launchFileAsync won't be able access that location (nor can a webview process, which is also sandboxed). If a desktop application gets launched, on the other hand, it probably can access the file, but you can't tell ahead of time if that's the case. Bottom line is that local appdata isn't a good location for letting other apps get at the file.
You'll need to save the file in another location that is accessible to other apps. There are two approaches here, both of which will require a little user interaction to select a location, so they can place the PDFs anywhere they want:
Have the user select a save folder for your app, which they can do once. You would invoke the FolderPicker for this purpose, and save the selected folder in the FutureAccessList. This way you can have the user select the save folder, which grants you consent to save there, and by saving it in the FutureAccessList you can retrieve it in subsequent sessions without having to ask the user again. Refer to the File Picker Sample and the File Access Sample for more.
Have the user select a save location for each individual file, using the FilePicker (see the same sample), and you can also use the access cache to save permissions to those individual locations if you need them later.
There might be Cordova plugins that work with these APIs too, but I haven't checked. Either way, once the file is in an accessible location, launching the file should work just fine.
As an alternate solution, you could consider rendering the PDFs directly in your app. Windows has an API for this in Windows.Data.Pdf, with an associated sample. There might be a plugin or other JS libraries that could also work for this.

Create installer that runs application on login

I have spent more time on this task than I did actually creating the application.
I want to create an installer for my app that will:
Install the app into /Applications
Make the application launch on boot (it's just a menu bar status based app)
Number 1 is easy but I can get absolutely nowhere with getting #2 to work. I know I need to setup a postscript install somewhere I don't know how to make the script (I believe I need to put it in loginitems) and how to make it initialize as part of the package. My understandign from research is I need to look into making a postflight script but there is nothing at all in Package Manager for that.
Can someone please point me to something that works in 10.6+?
I've tried the script here in Add app to OSX "Login Items" during a Package Maker installer postflight script but it doesn't really explain where/how to actually add the script.
Launch at login can be a piece of cake or an absolute nightmare depending on wether or not your app is sandboxed. If it isn't sandboxed, then you can use LSSharedFileList to modify the login items preference pane: https://github.com/Mozketo/LaunchAtLoginController
If it is sandboxed then you're going to need to create a helper app: http://blog.timschroeder.net/2012/07/03/the-launch-at-login-sandbox-project/
The above tutorial didn't work for me on yosemite, I had to follow apple's sample code: https://developer.apple.com/library/mac/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLoginItems.html#//apple_ref/doc/uid/10000172i-SW5-SW1
As for the installer, check this answer here: https://stackoverflow.com/a/11487658/1320911

Opening a file from TFS using the full TFS Path, from a web site

So I have a website running that displays full path of a TFS File on the page somewhere, I want the user to be able to click on it, which should then open up that file from TFS inside their Visual Studio.
The command to do this inside Visual Studio is "File.TfsOpenFromSourceControl" (DTE command) - it's basically the user manually going to that file using the Source control explorer and double clicking to open it up.
I am wanting to simulate that action from my web app inside the browser.
Update: The Web app is a pure ASPNet MVC app with Jquery available to it. I am already showing the file's content to the user in the web app. But I want the user to open the same file in Visual studio, by clicking on the file path in the web app. The question is more of Browser to VS integration and how to execute the DTE command in question, from within the web app context of the browser.
Any clues would be helpful
I don't know the answer to Pavel's question, so I'll sketch an outline of both solutions.
If you want to display the file inside the browser, call the Item.DownloadFile() API. NB: in 2008 SP1 there is another overload of this method that allows streaming into a memory buffer instead of writing directly to the filesystem. If you don't already work with Item objects directly, you can retrieve them via the GetItem() / GetItems() APIs.
If you want to make the file open in VS, there are a couple approaches. Perhaps your web app already includes the concept of local workspace(s) for the user, similar to Source Control Explorer. If so, you'd simply call Workspace.GetLocalItemForServerItem() to find the local path of the item, then ShellExecute it. (Or maybe pass it as a command line parameter to devenv.exe, if it's not natively associated with VS.) If not, you can either create a temporary workspace on behalf of the user, or use the same DownloadFile() API shown before; stream the contents to the client over a web service, save to disk, then launch VS as before.
Naturally, the more involved scenarios under option #2 will require deeper OS integration than the DOM / Javascript can provide. Would help to know if this web app is already built on ActiveX, Flash, Silverlight, XBAP, or similar technology...

Resources