...

View Full Version : Linking to a program so it opens instead of prompts to be saved



kgpbeyond
03-16-2003, 06:44 PM
Hiya, I'm currently playing with the idea of making a website for my computer (in other words, it'll be a more attractive interface than the typical desktop and will only be used for my computer). Now what I want to do is kinda do what a *.lnk file does in Windows. I want to be able to click a link to... let's say Paint Shop Pro, and have it open Paint Shop Pro automatically (rather than prompting to save or open the file). So basically, what I'm wondering is if there is any special code which will over-ride that prompt for a specific link so that I can just click and open. Ideally, I'd like my website to work in Opera (since it has a much more attractive full-screen mode than IE does) but if I have to, I'll settle for IE. But if anyone could help me out with this, I'd much appreciate it, thanks.

krycek
03-16-2003, 07:42 PM
um... why not simply set your desktop wallpaper to be the webpage you are making...? (hence avoiding using a "browser" as such) and stick your normal desktop icons over the top.

works for me! :p

::] krycek [::

kgpbeyond
03-16-2003, 08:33 PM
well I actually thought of that a few minutes. :oP But naw, I don't like the icons. I kinda want to do like a flash/shockwave site so I can have hiding toolbars and stuff (I wanna go all out with this so it makes a dramatic improvement over the desktop). But because of this, I just wanted to know if maybe there was a javascript or flash script or something that would open a local program or something.

l3vi
03-16-2003, 08:52 PM
go 2 www.stardock.com There is a program 4 around $40 that lets you completely customize everything. or you can download them one by one 4 free but lose a few features!

scroots
03-16-2003, 09:28 PM
unless you build your own browser or find a major hole in a browser and don't install a patch i doubt you can do it as browsers where made for the internet and websites.


scroots

krycek
03-16-2003, 10:33 PM
Originally posted by l3vi
go 2 www.stardock.com There is a program 4 around $40 that lets you completely customize everything. or you can download them one by one 4 free but lose a few features!

I wouldn't recommend you use stardock stuff. The appeal tends to wane once you use their software and it grabs all your system resource! (And I am on a VERY powerful system)

::] krycek [::

kgpbeyond
03-17-2003, 12:04 AM
yeah, no kidding. Stardock stuff was really great, but that **** took my system down real fast. I couldn't stand the amount of resources it swallowed up, which is exactly why I've chosen not to use them anymore. And the thing with IE/the desktop is I figured the flash thing would work properly seeing as it is designed for both web and local use (IE and Explorer being essentially the same thing as it switches its own functions freely). So there's gotta be something that'd work, right? Now I've not tried this yet... but if I made a link to a *.lnk file, would IE/Desktop/Explorer prompt to save the file or would it just use the *.lnk file like it was local? Anyway... I'm thinking you all kinda get my basic idea by now, so if anyone has any ideas that would remove the nuisance of that save/open prompt when a file link is local, that'd be great.

oracleguy
03-17-2003, 12:53 AM
I doubt you can. Mainly because if you could, then spyware and viruses could easily get onto your system. Its the same reason why you can't set a default value for the file upload form object.

F.N.G.
03-17-2003, 01:00 AM
This (http://www.codingforums.com/showthread.php?threadid=13317&highlight=clientside+application) thread might be of interest to you...

kgpbeyond
03-17-2003, 01:16 AM
yes, that thread does a great job. I can probably tweak it a smidge to make it run exactly like I need it to. However, it requires DOS-Names and I've got Windows XP and when I do that properties thing for folders or files, there's no mention of a DOS name.... so where might I find the DOS name? File Manager had it, I think, but I can't find that program on WinXP (what's the file name for File Manager so I can do a search?) Anyway, thanks for that thread, 'cause that should work perfectly for what I need with a little tweaking. And if anyone knows where File Manager is or how to find the dos names of stuff, lemme know, thanks.

F.N.G.
03-17-2003, 02:05 AM
I have XP, and was able to open shortcuts with no problem, using an .hta...

Here's what I did:

1. create a folder for your shortcuts, such as "C:\shortcuts"

2. right click, drag, and copy whatever shortcuts you want from your desktop into the "C:\shortcuts" folder

3. create links to the shorcuts... for example: if my shorcut name was "paint", my link would be:

<option value="C:\shortcuts\paint">paint</option>


This is a test .hta that I used, with the code from the aforementioned thread:


<html>
<HEAD>
<TITLE>t e s t</TITLE>
<HTA:APPLICATION ID="oMyApp"
APPLICATIONNAME="test"
ICON="blankicon.ico"
SYSMENU="yes"
MAXIMIZEBUTTON="yes"
MINIMIZEBUTTON="yes"
WINDOWSTATE="normal"
NAVIGABLE="yes"
SCROLLFLAT="yes"/>


<script type="text/javascript">

fso = new ActiveXObject("Scripting.FileSystemObject");

function RunProgram(Program_Path) {
Default_Value = Program_Path.match(new RegExp("Default", "i"))
if (Default_Value) {
} else {
new ActiveXObject("WScript.Shell").Run(Program_Path,3,false)
}}
</script>
</head>
<body>

<select onchange="RunProgram(this.value)">
<option value="Default" selected>Launch Program</option>
<option value="C:\shortcuts\notepad">notepad</option>
<option value="C:\shortcuts\word">word</option>
<option value="C:\shortcuts\paint">paint</option>
</select>

</body>
</html>

kgpbeyond
03-17-2003, 02:20 AM
heh, I suppose that'd work, huh? :P And here I was tryin' to link straight to the program itself. Well that works, thanks a bunch :D Now I can begin working on my sexy-*** new desktop :P Thanks again, everyone, you've been tremendous help :)

F.N.G.
03-18-2003, 04:28 AM
LaunchinIE (http://www.whirlywiryweb.com/q/launchinie.asp) appears to be a nice alternative to using an html-application, just to avoid the security alert.

I don't think there's any way to set an .hta as the desktop background...

Graeme Hackston
03-18-2003, 05:05 AM
Just noticed this thread. I haven't used XP and was describing Win98. Glad you got it working. Here's an hta resource.

http://msdn.microsoft.com/workshop/author/hta/reference/objects/hta.asp

Graeme Hackston
03-18-2003, 05:13 AM
And here is the possible opening properties (though I've only gotten a few of them to work)

/*

0 Hides the window and activates another window.
1 Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when displaying the window for the first time.
2 Activates the window and displays it as a minimized window.
3 Activates the window and displays it as a maximized window.
4 Displays a window in its most recent size and position. The active window remains active.
5 Activates the window and displays it in its current size and position.
6 Minimizes the specified window and activates the next top-level window in the Z order.
7 Displays the window as a minimized window. The active window remains active.
8 Displays the window in its current state. The active window remains active.
9 Activates and displays the window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when restoring a minimized window.
10 Sets the show-state based on the state of the program that started the application.

*/

<edit>

they go here:

new ActiveXObject("WScript.Shell").Run(Program_Path,3,false)

</edit>

F.N.G.
03-18-2003, 06:12 AM
Here's (http://www.vbwm.com/articles/2002/abarfield/hta01) an article about HTA's...

F.N.G.
03-18-2003, 06:17 AM
-my offline tinkering-

This may be common knowledge, but here's a method for making the desktop page "seamless", so to speak...

<!--
all this really does is take away the automatic browser bar (or whatever its called) that drops down when a page is set on the desktop via the "web" tab.
-->

Instead of using the "Web" tab, in the 'desktop items' menu, you can do this:

1. From the "desktop" tab, in the 'display properties' menu, click the browse button, and navigate to whatever folder your html page is in--then select that page & click "open".

---------
notes
---------

a. setting an image as the desktop background defaults the "browse" button to whatever folder that image is in... (this just makes it easier to navigate to your html pages from the 'desktop properties' menu)

b. This page will only behave like a website if its loaded into an iframe... (otherwise, frames pages won't work, & every link will open in a new window).

c. Make your iframe the size of your desktop--minus the height of the taskbar.
By doing this, you can still access the 'display properties' menu by selecting "auto-hide the taskbar" & right-clicking below the iframe... (otherwise you'll just get the properties of the html page on your desktop).

---------

krycek
03-18-2003, 01:31 PM
Originally posted by F.N.G.
-my offline tinkering-

This may be common knowledge, but here's a method for making the desktop page "seamless", so to speak...

<!--
all this really does is take away the automatic browser bar (or whatever its called) that drops down when a page is set on the desktop via the "web" tab.
-->

Instead of using the "Web" tab, in the 'desktop items' menu, you can do this:

1. From the "desktop" tab, in the 'display properties' menu, click the browse button, and navigate to whatever folder your html page is in--then select that page & click "open".
---------

erm, didn't I say that? :confused:


Originally posted by krycek
um... why not simply set your desktop wallpaper to be the webpage you are making...? (hence avoiding using a "browser" as such) and stick your normal desktop icons over the top.

works for me! :p

::] krycek [::

...although in less words ;)

::] krycek [::

F.N.G.
03-18-2003, 03:44 PM
:rolleyes:
Yes, your explanation was more efficient, while mine was long-winded, boring & redundant...

namely, what I was trying to convey was that the "html wallpaper" needs to be in an iframe in order to behave like a website.

krycek
03-18-2003, 10:31 PM
Originally posted by F.N.G.
:rolleyes:
Yes, your explanation was more efficient, while mine was long-winded, boring & redundant...

namely, what I was trying to convey was that the "html wallpaper" needs to be in an iframe in order to behave like a website.

that's the thing... it does not have to be

simply use some css, set the BODY or a DIV to be scrollable, and hey presto! ...you can use moouse wheel or cursor keys to scroll if no scrollbar appears

::] krycek [::

F.N.G.
03-19-2003, 01:47 AM
Maybe its just me (my computer), but as I explained: when using framesets, or linking to other pages, the iframe is necessary.

On the other hand, if you just want a single page, & don't mind if links open in explorer windows, there's no need for it.

F.N.G.
03-24-2003, 02:26 PM
If anyone's interested,

"sendkeys" provides another way to
open local programs via shortcuts...

+-----------------------------------------------------------+

1. Assign a hotkey to a shortcut:

Right-click one of your shortcuts, select
"properties", and from the "shortcut" tab,
enter a character in the textbox labeled
"Shortcut key:", & click the "OK" button.
+-----------------------------------------------------------+

2. Use sendkeys to simulate pressing this hotkey
when you click on a link;

for example:

if your shortcut was for Notepad, & you assigned
the "N" key to it, the hotkey sequence would be
Ctrl+Alt+N, which translates to SendKeys("^%{n}")

where ^ = Ctrl, and % = Alt

I also found this to work: SendKeys("^%n")

( more info. about sendkeys is here (http://msdn.microsoft.com/library/en-us/vjref98/html/com.ms.wfc.app.SendKeys_sendKeys.asp) )
+---------------------------------------+

So, in the .html or .hta, you could do something like:




<html>
<head>
<title>Shortcut-Sendkeys</title>

<script type="text/javascript">
var x;
function Launch_Notepad()
{
x = new ActiveXObject("WScript.Shell")
x.SendKeys("^%{n}");
}
</script>

</head>
<body>
<center>
Obviously, for this example to work,
the "Shortcut key" needs to be assigned, first.
<br />
<br />

<a href="java
script:void(null)" onclick="Launch_Notepad();">Notepad</a>

<br />
<br />
or
<br />
<br />

<input type="button" value="Notepad"
onclick="Launch_Notepad();" />

<br />
<br />
or...

</center>
</body>
</html>


Sendkeys can also be useful for implementing Internet Explorer shortcuts (http://www.bitzenbytes.com/101/r106-ie-hotkeys.htm)
& other keyboard operations in your custom .hta's or desktop.html.

+-----------------------------------------------------------+

I'm no guru, so don't assume this is the ideal method... but specific information on this topic can be elusive; therefore, its worth sharing.:thumbsup:

Graeme Hackston
04-15-2003, 01:47 AM
Thanks for the SendKeys tip F.N.G. I didn't know about that.

Just to add to this thread you can keep tabs on the running state of an unscriptable app.


objApp = false

function Open_App() {
var objWS
if (!objApp) {
objApp = true
objWS = new ActiveXObject("WScript.Shell")
objApp = objWS.Run('C:\\SOME.EXE',3,true)
}

// this function is now frozen, anything here fires when the app closed

objWS = null
}

objApp is true when running, 0 (false) when closed.

Skyzyx
04-15-2003, 09:15 AM
Another suggestion, if you have the money, is Macromedia Director. It's extremely powerful, and has some file system access. You can export a Director project as a ShockWave file, ans you should be able to embed it into a background webpage.

F.N.G.
04-20-2003, 09:25 AM
you can keep tabs on the running state of an unscriptable app.

Can you give me a scenario for using that script?
I wasn't able to comprehend its purpose from your explanation.

BTW, here are a couple of sites w/desktop scripting info.

Active Desktop Tutorial (http://innovations.madmatt.net/hosting/ntfs/tutorials/activedesktop.php)

Active Desktop Page (http://www.active-desktop.de.vu/)

Graeme Hackston
04-20-2003, 05:58 PM
No problem F.N.G. Change C:\\SOME.EXE to something you can run.


<html>
<head>
<title></title>
<script>
objApp = false
objWS = new ActiveXObject("WScript.Shell")

function Open_App() {
if (!objApp) {
objApp = true
objApp = objWS.Run('C:\\SOME.EXE',3,true)
}

if (!objApp) {
alert('app closed')
} else {
alert('app running')
}
}

</script>
</head>
<body>
<input type="button" value="run app" onmousedown="Open_App()">
<input type="button" value="check app state" onmousedown="alert(objApp)">
</body>
</html>


0 == false but you can look for either.

MS programs and a few others can be scripted remotely from an hta. You create the app object and you have complete control over it.

If you need to run an unscriptable app this will allow you to detect its running state and have the option to allow only single instances.

Graeme Hackston
04-20-2003, 06:13 PM
MS programs and a few others

a few others in incorrect, the only other I know for sure is PhotoShop. I'm assuming other big names like autocad are but I could be wrong.

<edit> actually, I believe most Adobe products are scriptable</edit>

F.N.G.
04-21-2003, 03:49 AM
Sounds good; ;) I think I halfway understand it now, thanks.

Graeme Hackston
04-21-2003, 04:13 AM
I can see why you don't completely understand it. Reading it doesn't make alot of sense.

What's happening is objApp is set to true before it is changed to an app object in the next line. Because the last parameter in Run() is set to true, it freezes that instance of the function on that line making objApp not an object as it should be but still set to true.

When the app closes the instance of the function continues running and objApp returns 0 (again because the last paramenter is set to true)

F.N.G.
04-22-2003, 08:06 AM
That's cool, thanks for explaining further.:thumbsup:

I still can't help but wonder what it means to "keep tabs on the running state of an unscriptable app."... the concept, that is--not the code.

I'm a little slow...:D

Graeme Hackston
04-23-2003, 01:43 AM
Sorry, that might be my slag

keep tabs == monitor

Your app can use other apps and monitor there running state. The app closing creates an opportunity/event that you can act on.

Graeme Hackston
05-17-2003, 10:28 PM
I think I've found a way to get DOS paths (atleast on win98). If you could, let me know if it works on other operating systems.

Browse to your exe and it should print the DOS path with the necessary escapes added.


<html>
<head>
<title></title>
<script>

fso = new ActiveXObject("Scripting.FileSystemObject");

function DOS_Path(browse_path) {
var f = fso.GetFile(browse_path)
document.getElementById('output').innerHTML = f.ShortPath.replace(/\\/g,'\\\\')
}

</script>
</head>
<body>
<input type="file" onchange="DOS_Path(this.value)">
<p></p>
<div id="output"></div>
</body>
</html>


<edit>
Just noticed the forum isn't displaying the code as I pasted it. You need to add 1 more back slash to the last parameter in replace (it should be 4 back slashes)
</edit>

swmr
05-18-2003, 12:59 AM
:) Yeah, that works on XP... nice! :thumbsup:

Thanks

Graeme Hackston
05-18-2003, 01:11 AM
Thanks swmr :D



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum