Jump to content
Sign in to follow this  
Skorm92

[Q] Launch application from browser

Recommended Posts

Skorm92

Hello AutoIT community!

I've been studying autoit script for a month or so now, and I was wondering if auto it can support the launch of its compiled script through (any) browser,

Like for example:

520ec721d55c7.jpg

Would launch the compiled script called "myapp"

I couldn't find any related info on this or I haven't been searching that good.

Either case, I'd like some help on this one! =)

Thanks in advance!

Edited by Skorm92

Share this post


Link to post
Share on other sites
FireFox

Hi,

Welcome to the autoit forum :)

What you're looking for is called URL Protocol, it's not related to autoit but to Windows.

If you launch an autoit script through this kind of address, you will have the address in the $CmdLine (command line) array.

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
Skorm92

Thank you for your reply!

So what would be (in a non pro soft dev way) the easiest way to let the application simply launch only? So just execute the application without further tasks once it opened.

I hope I don't go out of my league asking this since I don't know if this a merely hard thing to accomplish.

Edited by Skorm92

Share this post


Link to post
Share on other sites
FireFox

You want to link the url protocol to your application right?


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
Skorm92

Yeah it just simply has to launch,

I wanna write the application in a way that it can be only launched from the website, if this isn't possible then just simply open it through a link button or launch from desktop/working dir

Share this post


Link to post
Share on other sites
FireFox

I made this for a project, so here is the code to add the URL protocol :

Local $sMyProgram = @ScriptFullPath, $sProgName = "My Program"

Local $aURLProtocol[5] = ["HKCR", _
        "HKLM\SOFTWARE\Classes", _
        "HKCR\Wow6432Node", _
        "HKLM\SOFTWARE\Classes\Wow6432Node", _
        "HKLM\SOFTWARE\Wow6432Node\Classes"]
 
For $i = 0 To UBound($aURLProtocol) - 1
    If $i = 2 And @OSArch = "X86" Then ExitLoop
 
    RegWrite($aURLProtocol[$i] & "\" & $sProgName)
    RegWrite($aURLProtocol[$i] & "\" & $sProgName, "", "REG_SZ", "URL:" & $sProgName)
    RegWrite($aURLProtocol[$i] & "\" & $sProgName, "URL Protocol", "REG_SZ")
    RegWrite($aURLProtocol[$i] & "\" & $sProgName & "\DefaultIcon")
    RegWrite($aURLProtocol[$i] & "\" & $sProgName & "\DefaultIcon", "", "REG_SZ", StringRegExpReplace($sMyProgram, "^.*\\", ""))
    RegWrite($aURLProtocol[$i] & "\" & $sProgName & "\Shell")
    RegWrite($aURLProtocol[$i] & "\" & $sProgName & "\Shell\Open")
    RegWrite($aURLProtocol[$i] & "\" & $sProgName & "\Shell\Open\Command")
    RegWrite($aURLProtocol[$i] & "\" & $sProgName & "\Shell\Open\Command", "", "REG_SZ", '"' & $sMyProgram & '" "%1"')
Next
And to restrict the launch by the URL protocol :

See attachment, I can't post it...

Br, FireFox.

example.au3

Edited by FireFox

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
Skorm92

Thank you alot! Once I get home from work i'll check it straight away.

As I look at it now, it'll probably take a while for me to understand what the script exactly does and how it functions :P

I think I can sort it out,

If not than I'll post back here,

Thank you for the (amazingly fast) reply's and help!

Share this post


Link to post
Share on other sites
FireFox

I realized that I let the program name in the code... please check the review.

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
FireFox

As I look at it now, it'll probably take a while for me to understand what the script exactly does and how it functions :P

There's nothing really important to understand, just note that it registers the URL protocol in the registry (at different places) so that some applications can handle it (like the web browsers).

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
lionfaggot

alright i dont get how this is complicated at all. ShellExecute() is more than enough for what you need here. i was able for instance to launch skypes web api features using ShellExecute()

Edited by lionfaggot

Share this post


Link to post
Share on other sites
FireFox

It's not applicable if he wants to launch his application through an url on the same computer.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
lionfaggot

ah, forget what i said then. carry on

Share this post


Link to post
Share on other sites
FireFox

I said "If" basing on the first post, maybe it's not the case, we'll see.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
Skorm92

Yes I want my script to execute through a browser,

I.E. Clicking on a "play" button on my website should execute my application.

So clicking on a link with my URL protocol should execute the program,

I tried your script, the URL Protocol script that writes in the reg,

And chrome asks me if I am sure of executing the program,

but the app simply doesn't open. even when I give permission.

 

EDIT:

I made a minor change to your script to make it work,

RegWrite($aURLProtocol[$i] & "\" & $sProgName, "", "REG_SZ", "URL: " & $sProgName & " " & "Protocol")
    RegWrite($aURLProtocol[$i] & "\" & $sProgName, "URL Protocol", "REG_SZ", "")

did the trick,

Although it opens now, It also immediately closes.

Any solutions for that perhaps?

Edited by Skorm92

Share this post


Link to post
Share on other sites
FireFox

Although it opens now, It also immediately closes.

Any solutions for that perhaps?

And without the script I told you to insert in your application?

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
Skorm92

And without the script I told you to insert in your application?

The exact same thing happens, The script works like a charm!

Only thing is I can only use myapp: and not myapp: with "//"

But that's not a big deal,

Share this post


Link to post
Share on other sites
FireFox

Huh? I don't understand what's the problem with the double slashes.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
Skorm92

If i add the double slashes to my href. and to the script you provided. then the application doesn't open.

If I only use myapp: (both my href and in the script) it successfully executes,

But it's not a major thing that I have to start it with myapp:,

The problem is that the application closes immediately after launch.

Whilst it runs fluently when I open the exe manually or use "Go" in SciTE editor. 

Share this post


Link to post
Share on other sites
FireFox

Can you debug your application with MsgBoxes to see where it closes?


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
Skorm92

That got me a little further,

It seems that the executable can't load any resources (jpg files from "content" dir)

I placed MsgBoxes between every image that it has to load and there are no images showing up.

While if I run the application directly it loads every image one by one (after each MsgBox)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×