Active Desktop Website to Open Programs? - html

I have always thought that replacing the normal windows desktop icons with an "active desktop" html page which can launch my programs, as well as open directories and files through links. This would be a really cool way to customize one's desktop.
Using the "file://" protocal was my first approach but this does not work correctly. In another SO Post I found this link but its a little over my head. Is this the correct approach?
I can't imagine that I am the first one to consider this; it seems like a good idea (no?). What do you all think?

I like the idea of active desktop for a desktop customization. What you can do is register your own schema
Add a Registry entry.
Here is the first example I worked with.
Add This to a .reg file and Import into the registry.
Change "myschema" and the location of the executable to match your own needs
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\myschema]
#="URL:My Schema Protocol"
"URL Protocol"=""
[HKEY_CLASSES_ROOT\myschema\DefaultIcon]
#="C:\\Program Files\\MySchemaProgram\\MySchema.exe,1"
[HKEY_CLASSES_ROOT\myschema\shell]
[HKEY_CLASSES_ROOT\myschema\shell\open]
[HKEY_CLASSES_ROOT\myschema\shell\open\command]
#="\"C:\\Program Files\\MySchemaProgram\\MySchema.exe\" \"%1\""
Now if you create a hyperlink
<a href="myschema://Whatever+i+want" >Click Here</a>
Your computer will open your MySchema Application with the href in the command line.
just be mindful because Ervironment.CommandLine will be UTF Decoded therefore
//This Link
Click Here
//Will Result in This Command Line Execution.
"C:\Program Files\MySchemaProgram\MySchema.exe" myschema://Something Here
You can also use this schema in the ShellExecute commands as well as the Run Dialog.
Here is the example program I used to get started with. You should be able to get the idea pretty quick
using System;
using System.Collections.Generic;
using System.Text;
namespace Alert
{
class Program
{
static string ProcessInput(string s)
{
// TODO Verify and validate the input
// string as appropriate for your application.
return s;
}
static void Main(string[] args)
{
Console.WriteLine("Alert.exe invoked with the following parameters.\r\n");
Console.WriteLine("Raw command-line: \n\t" + Environment.CommandLine);
Console.WriteLine("\n\nArguments:\n");
foreach (string s in args)
{
Console.WriteLine("\t" + ProcessInput(s));
}
Console.WriteLine("\nPress any key to continue...");
Console.ReadKey();
}
}
}
best of luck with your application. I would be eager to see it when it is complete.
EDIT: I am adding some matching strings for this as it is a cool feature and more people may want to use this technique for something they wanted to do.. These are the things i looked for it under, (unsuccessfully) Let me know if anyone thinks of any more.
custom url/uri handler
custom schema program
registry web address program
handle web link
launch app from url

I've looked into what you've asked a while back and never found anything that worked well.
Ultimately if the goal is full customization of your desktop, I think you can get a similar result by researching something like this: http://rainmeter.net/RainCMS/ and http://kaelri.deviantart.com/art/Enigma-103823591 Lifehacker has tons of links/tutorials on how to get it all running. I was able to get a desktop running that far exceeded my goals with using HTML on the desktop.

One way I got some really interesting results (though I haven't tried it for years and can't confirm right now that it still works on a modern OS and modern flash player) was to use an active desktop page running a flash swf file that contained a user interface I had created and (at the time I was using it) could launch programs from within the swf.

I ran a setup in a cyber cafe where each desktop was controlled via active desktop running a flash app. Launching and shutdown operations were handled with a mini webserver written in python. The OS was XP.
My experience was that Active Desktop is unreliable. It leaks memory terribly and regularly crashes. They might have fixed it in later versions but since hardly anyway uses it I doubt much effort has gone into fixing its obvious flakiness.

Related

Simple html to pdf conversion commandline tool for automated file creation

I have a system that automatically creates and saves documents as html. For further storage they ought to be pdfs though.
I want to avoid having to do it manually so my preferred solution would be a small executable that I can call via command line, feed it with a source and output path (and ideally further parameters) and then let it do its magic. Something in concept like this:
exampleConverter.exe "C:\source\document1.html" "C:\convertedPDFs\document1.pdf"
No UI whatsoever, no human input, no popping up and closing console.
I looked through several options, but common problems I encountered were
the software not being free for commercial use
It just being a library of code, not a ready-to-go executable / code-base you just need to compile into one
The tool needing to get installed instead of being 'portable'
I'd like to avoid having to implement any modern libraries myself, partially for simple time concearns, partially because internally our code runs in a less than modern IE & VBS context so I for see compatibility problems.
Simply triggering a precompiled executable through a generic command line inerface that I can trigger from vbs seems like the perfect solution here.
Your Windows OS program code is almost there, why not reverse input and output (makes the task easier later), with a switch or two. you can embellish that with your for /? loop to run through the current working folder, just like any other program.
Your pseudo code
exampleConverter.exe --print-to-pdf="C:\convertedPDFs\document1.pdf" --headless "C:\source\document1.html"
Working Windows native code
"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" --print-to-pdf="%CD%\out\document1.pdf" --headless "%CD%\in\document1.html"
Other options are available
learn.microsoft.com suggest this working snippet to run edge with parameters
wscript vbsEdge.vbs
Dim shell
Set shell = WScript.CreateObject("WScript.Shell")
shell.Run "msedge https://www.google.com --hide-scrollbars --content-shell-hide-toolbar"
So just combine the program methods. However, you need to sort out your own arguments.
For greater control then you need to step-up to heavier custom isations https://blogs.windows.com/msedgedev/2015/07/23/bringing-automated-testing-to-microsoft-edge-through-webdriver/ etc.

Developer tool extension, attach an event to every function call

When debugging legacy code that is thousand of lines long, I found myself having the issue of trying to know what's the program is doing in very specific parts, so I've been trying to write my own developer tool extension that does what I need specifically; basically I need something that give me access to this or similar (example):
chrome.developer.v8.onFunctionCall = function(context, fn, arguments){
log(context.process);
log(context.id);
log(context.declaration.url);
log(fn.name);
log(arguments);
}
Basically I need something that can do it similarly, it doesn't have to be exactly that; I haven't found anything like it in chrome extensions developer documentation.

LibGDX: Gwt logging not working in my project

Don't worry, I'm not asking you to fix all my bugs, I just wanted to know common causes for gwt/html logging to not work.
Here is my project:
https://github.com/vedi0boy/Archipelo
I cannot get logging to work at all in html. I used this code in a brand new LibGDX project and it worked (inside the main class):
#Override
public void create () {
Gdx.App.setLogLevel(Application.LOG_DEBUG);
Gdx.app.log("Test", "Test log message.";
}
I just don't get it. Is there something common that could be making basic html/gwt functions not work? My libgdx is update to 1.9.2. I can't seem to figure out why it works on a new project but not mine.
What should I do? Should I attempt to copy all the code to a new project? Thanks.
P.S. I am also unable to use a networking library that I need, and it also works on a brand new project.
The solution was simple. I made a while loop that did not continue until a connection to the server was established. Since javascript is single threaded, it got caught in an infinite loop.
The reason this has to do with logging is because LibGDX only loads up the log box when create is finished being run and my infinite loop was in create so it never got around to rendering the logs.
Lesson: Don't treat JavaScript as a multi-threaded language when using GWT, because it isn't.
You don't need to copy all your code to a new project, if you have doubts about your LIBGDX version you can update your corruent project to a recent V of libgdx,
use the build.gradle like follow :
gdxVersion = "1.5.2" // your gdx version here
for more info read this topic in the official WIKI

How to setup limeJS in a totally offline workspace

I'm trying to setup limeJS, the issue is the Internet connection is a problem. I had closure library, box2d, closure compiler and closure templates downloaded separately as .rar files, but I can't find a guide anywhere to set it up like this, everyone just uses(and with reason!!!) the python bin/lime.py init command to get it working. I managed to figure out(yay!) how to setup box2d and closure library but what about the other two?
My laptop is running 64 bits Windows 7. Any help appreciated
All I need is an advice on directory structure, like where to drop the compiler.jar and soy templates .js files, so that when I run the update/create command it doesn't try to download the compiler or templates like it does right now.
I got it working, after taking a quick look at the lime.py file it told me everything I needed, for example both the SoyJs templates file and the compiler need to be in the /path/to/lime/bin/external folder and for example, the lime.py file was expecting a compiler file named compiler-dateOfLatestCompiler.jar instead of compiler.jar.
In general, If you have LimeJS built up in one machine using Python and all, you can just copy paste the whole package anywhere you want and use it just as ususal.
You don't need network once you have all the files/codes for Lime is downloaded.
Infact, you dont even need python for normal development tasks(Python is required to build your js file once you complete development though)

Protect Air application content

On Mac Os, I see that all content on my application can be readable (mxml and as files).
Indeed with right clic on application, you can see all application content and so all files.
So It's very dangerous for a company to distribute air application like that.
Is a solution exist to protect those files.
Thanks
It is not possible to protect 100% your code. After all, if the computer can run it, it can be decompiled, regardless of the language. However, you can make it more difficult.
One method is to encrypt the swf as stated in another answer. But all the "attacker" needs to do is find the key and then they can decrypt all your swfs.
Another method is to use obfuscators. Obfuscators don't depend on encryption, nor they prevent decompiling, they just make it harder to understand what gets decompiled.
For example if you had a method called saveInvoice() the obfuscator would rename it to aa1() or something like that, so it would make it diffucult to guess what that function does. It basically turns everything into spaguetti code.
You can use a decompiler to see what can be obtained from a SWF file (which is alot), and play with obfuscators to see if they meet your espectations.
An example of one is http://www.kindi.com/ which I'm not endorsing btw, it just shows up quickly on google.
Although there are loads of decompilers which can read all your code. There is one guy who came up with encryption solution it might worth a try. (It's for Desktop AIR applications)
Have a look at this post: http://forums.adobe.com/message/3510525#3510525
Quoted text (in case of page being erased)
The method I use will allow you encrpyt most of your source code using
a key that is unique to every computer. The initial download of my
software is a simple air app that does not contain the actual program.
It is more like a shell that first retreaves a list of the clients mac
addresses and the user entered activation code that is created at time
of purchase. This is sent to server and logged. The activation code
is saved to a file client side. At the server the mac address and
activation key are used to create the encryption key. The bulk of the
program code is then encrypted using that key, then divided into parts
and sent back to the client. The client puts the parts back together
and saves the encrypted file. At runtime the shell finds the mac
address list and the activation key, then using same method as server
gets the encryption key and decrypts the program file. Run simple
check to make sure it loaded. For encyption i found an aes method that
works in php and javascript.
Next I use this code to load the program
var loader = air.HTMLLoader.createRootWindow(true, options, true, windowBounds);
loader.cacheResponse=false;
loader.placeLoadStringContentInApplicationSandbox=true;
loader.loadString(page);
This method makes it very difficult to copy
to another computer although since I wrote it i know there are some
weeknesses in the security but to make it harder i obv. the shell
code. It at least keeps most from pirating. However there are issues
with this that I have found. First i was using networkInfo to get the
list of mac address but this failed in a test windows XP computer.
When the wireless was off it did not return the MAC. I was not able
to recreate this in VISTA or 7. Not sure if it could happen. Was not
tested on a mac computer. To fix this (at least for windows). I
wrote a simple bat file that gets the MAC list, then converted it to
an exe which is included. This does force you to create native
installers. call the exe with this
var nativeProcessStartupInfo = new air.NativeProcessStartupInfo();
var file = air.File.applicationDirectory.resolvePath("findmac.exe");
nativeProcessStartupInfo.executable = file;
process = new air.NativeProcess();
process.start(nativeProcessStartupInfo);
process.addEventListener(air.ProgressEvent.STANDARD_OUTPUT_DATA, onOutputData);
process.addEventListener(air.ProgressEvent.STANDARD_ERROR_DATA, onErrorData);
process.addEventListener(air.NativeProcessExitEvent.EXIT, onExit);
process.addEventListener(air.IOErrorEvent.STANDARD_OUTPUT_IO_ERROR, onIOError);
process.addEventListener(air.IOErrorEvent.STANDARD_ERROR_IO_ERROR, onIOError);
put the list together in the onOutputData event using array.push and
continue on the onExit event using the findmac.exe will return the
same info every time (that i know of) beware thought that using the
native install will break the standard application update process so
you will have to write your own. My updates are processed the same way
as above. This is contents of the .bat file to get the mac list
#Echo off
SETLOCAL SET MAC = SET Media = Connected
FOR /F "Tokens=1-2 Delims=:" %%a in ('ipconfig /all^| FIND "Physical Address"') do #echo %%b ENDLOCAL
using this method makes it simple to implement at try before you by
method. at runtime if no activation code get try me version from
server instead of full version.