I need a way to allow a user to open an application on their machine (example: Photoshop) via a button on my website.
More specifically... something to the effect of running via the command line.. c:\Photoshop\run.exe some args OR open /Applications/Photoshop.app some args
Understanding the risks, security issues this raises and seeing how javascript is unable to access the users local file system. To add this
Im starting to explore a way to perhaps have a DLL or browser extension dynamically add this trigger/button that will in turn open/execute this application. Where the user can install something locally to do this.
Im looking for a general idea of how I can achieve this... what combination of programming language.. protocol.. any hints...
Related
I have read several posts on this site that ask similar questions but the key difference is they involve a client and a server. For my use, this is not the case. I am simply pasting a file directory on my computer into my browser in order to view a local HTML file, packed with CSS and some jQuery.
I've been looking around and the answers I've found are "No; a client can not write to a server", and "No; a server can not write to a client". But there is no answer to "can a client write to a client with JavaScript?"
Use case:
I'm building a webapp (website? JS app?) as a college project for a stock management tool that will be locally hosted and never connect to the internet. Sure, I could knock one together in python in a couple hours, but I wouldn't learn anything. I need to create an access a txt file containing an array of the current stock of all the items so that when the application is loaded, the user doesn't have to manually enter anything but the changes to stock levels.
Honestly, I'm a beginner at JS and JQ and I'm only going off of what makes sense based on a mix of HTML and Python that I know.
Maybe PHP would be the better option for this particular option, or maybe JS will work well enough.
You still won't be doing client-to-client, your browser will just act as though the local file system is the server using the file:// protocol which means the same rules about a "client" (the browser) cannot write to a "server" (your local file system) apply.
If you wan't to be able to write an application that can interface directly with the filesystem, then look into something like Electron which is essentially an augmented website that gives you APIs to interact with the actual computer the app is being run on, including filesystem stuff.
I develop an angular-php web application which I have it running online, for different users, on 5 different subdomains, such us:
sub1.mydomain.com
sub2.mydomain.com
sub3.mydomain.com
sub4.mydomain.com
sub5.mydomain.com
Problem:
My problem is that I still develop the web-app local and whenever I change files(php, js,tpl.html,css or when add new ones) I have to upload them on each subdomain.
Question:
Is there a way/library/API whatever that I can use to make something like package (with the updated or new files) and just call it from each subdomain url , and make the appropriate updates?
Or should I just copy them to each subdomain?
Do I make myself clear, in other words just like on cms systems that we press the update button and we update a component/module.
If anyone knows a way of doing that please enlight me. Thanks.
I tried to depict what i mean.
What you are describing is called deployment.
There are a lot of ways to create a deployment mechanism so there is not a single answer to your question. Depends of the tools that you are using, the servers where your app is hosted, etc.
If not, I advise you to use Git to make versions of your app (with Github or Gitlab) and automate the deployment process when you push a new piece of code.
You can make your own scripts to deploy or use online services (surely what you need because of "systems that we press the update button").
I can't advice you one particular service but you would find what you need in Googling "deployment automation github".
I would do it with config files. Considering the code for all my substations is the same. I would have config for each sub-domain and fetch the core files from the same location but serving different data If your structure allows it.
The title says it all. Is there a way to write macros in JavaScript to achieve a similar functionality to that of Autoit? I just would want to manipulate files on my own computer (offline) and could easily do it with autoit, but since I am currently learning JavaScript -- plan to develop in Node.js -- I figure it wouldn't hurt to get the extra practice.
Thanks guys!
Use an application which supports JavaScript as a shell scripting language, such as the following:
JsRoboKey
PowershellJS
PowerChakra
RemoteNodeJS
JScript + WSH
JavaScript Shell Scripting with JSC
QtScript: QScriptEngine
Part I: How to Choose a JavaScript Engine for iOS and Android Development - OpenAphid-Engine
nodejs has a module which do autoit things --
nodejs install autoit
var au = require('autoit');
au.Init();
au.Run("notepad.exe");
au.WinWait("[Class:Notepad]");
au.Send("Hello, autoit & nodejs!");
NodeJS is a very powerfull platform, it is extensible and opensource.
There is no problem to run local scripts to do everything you need using JavaScript (see standard FileSystem library docs). You can also try to look in NPM(NodeJS package manager).
Assuming you have AutoIt installed (say in folder C:\AU3) and this folder in the PATH, you can add
extension '.AU3' to the PATHEXT environment variable, and create an AutoIt script called, say,
hello.au3 with just a silly line:
MsgBox(0, "Warning", "Hello, World!")
Now, simply typing the command 'hello' will execute the script, displaying the silly message in a modal message box.
Next, create an equally silly Node.js script, say, MyWarn.js - in the same folder:
var oCP = require("child_process");
console.log("Starting...");
var oNP = oCP.execSync("hello");
console.log("Done.");
Assuming Node is also in the PATH, try this command:
node MyWarn
So ... we get the benefits of Node (for its jit), and the benefits of AutoIt (for its GUI handling.)
The problem is getting the two to communicate. Personally, I use a RamDisk to pass small files...
Javascript can't write to a file on your local machine remotely.. Its almost the same as HTML in a view model.
It can however perform some executions of other scripts via AJAX for example. But thats on server again.
It might be worth a look to read on server && client side differences.
im not 100% sure but node might offer another outlet on this but it would still be server side.. Not locally.
The Server - This party is responsible for serving pages and handling the logic | Code behind.
The Client - This party requests pages from the Server, and displays them to the user. On most cases, the client is a web browser.
The User - The user uses the Client in order to surf the web, fill in forms, watch videos online, etc.
I am trying to build a simple application for managing a database (most likely sqlite) of members of a society. The resulting app needs to be useable on windows and OSX and ideally be packaged as a single file.
My plan was to use a single HTML file that embeds all the javascript needed within the same file, which would be stored on the user's computer. The user could then simply double-click and open the page in their favourite browser, where the JS would be executed to handle the user interactions with the database and so on. On first running the sqlite database would be created on the user's machine which would persist the data and could also be backed up as needed.
My question is, how can I go about creating and modifying the database file from within the browser? Traditionally this has been a big no-no (for obvious security reasons) but looking into things like app.js and others I feel like there might be another option for achieving this simply. An option might be to have a "save/load" dialog if nothing else. The key factor is to avoid having the user install any extra dependencies like node.js etc, as this is a very simple tool.
You can create html and js desktop applications with AIR or XUL. AIR needs the AIR runtime and will be one file to install your application and XUL needs either xulrunner or Firefox to start it. You can deliver XUL applications as a zip file and run them with firefox --app application.ini.
There may be more options out there
Html5 supports both key/value and sqlite type persistence out of the box. Depending on your needs you may be to use either or both. They are mostly portable among most browsers now.
I have a javascript photo-organizer built on the YUI JS libs which can organize photos from many sites via REST api. I want to know if I can resuse any of this code to organize photos on the local filesystem.
I need a cross-browser (i.e. PC/Mac) solution to the following (in order of increasing privilege):
persistent file access to read/write local XML datafile (between sessions)
ability to manage large uploads of thumbnails to my server
FOLDER+file access to scan JPGs in a folder tree. permission granted by user via drag-drop
ability to execute local shell script to generate thumbnails
I've looked at the following and found some short-comings:
BrowserPlus - no way to save access to local FS between sessions
GoogleGears - local access to files via dialog box, only
Adobe Air - is this a possible solution??? can I reuse my javascript?
Can someone tell me if this is possible in Air, or if there are any other plugin options/strategies?
NOTE: I could live with a download and install solution like Adobe Air, as long as I don't have to write both PC/Mac versions. Does that make it NOT a security hole? Also, can I reuse my YUI/Javascript inside AdobeAir - or do I have to start from scratch?
tia, m.
Adobe Air is a standalone runtime. It will let you do what you want, but it does not run inside Browser, and will instead require users to install application to their desktop first (though it is cross browser and cross-platform).
Flash (or Flex) plugin inside Browser may be able to do some of the things you want, but I doubt it will let you free reign on the local file system for managing photos. You will be able to store some persistent data in local shared objects (kind of like Cookies), but very little amounts.