Sign in to follow this  
Followers 0
adored

URL to start a program

8 posts in this topic

Hey,

i'd like to make a function that opend eg. a program if you type a url in your browser,

like this

scite://my_program1

starts SciTe en opens my_program1.au3

Great thnx, adored :D

Share this post


Link to post
Share on other sites



Hey,

i'd like to make a function that opend eg. a program if you type a url in your browser,

like this

scite://my_program1

starts SciTe en opens my_program1.au3

Great thnx, adored :D

Put the following in the address bar of IE:

file:///c:\My_Folder\My_Program1.au3

It opens in SciTE on my computer. Does not work in Firefox (probably considered a security risk).

:D


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Put the following in the address bar of IE:

file:///c:\My_Folder\My_Program1.au3

It opens in SciTE on my computer. Does not work in Firefox (probably considered a security risk).

:D

the scite thingy was only a example.

i want to place a link on my webpage like program://file

so it starts the program and opens the file

edit//

if you know skype

with skype you can do this skype://skype_name

the link starts skype and calls the skype name

Edited by adored

Share this post


Link to post
Share on other sites

the scite thingy was only a example.

i want to place a link on my webpage like program://file

so it starts the program and opens the file

edit//

if you know skype

with skype you can do this skype://skype_name

the link starts skype and calls the skype name

The answer is in MSDN: Registering an Application to a URL Protocol

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

from the original question.. not the link

Dim $File_location = FileGetShortName("C:\Program Files\AutoIt3\Examples\My Stuff\")

Opt("WinTitleMatchMode", 4)

HotKeySet("{F9}", "Run_it")

While 1
    Sleep(500)
WEnd
    
    
Func Run_it()
    If ProcessExists("iexplore.exe") Then 
        $FileName = ControlGetText("classname=IEFrame","", 41477)
        ToolTip($FileName, 0, 0)
        If StringLeft( $FileName, 5) =  "Scite" Then
            $result = StringSplit($FileName, "\\", 1)
           ;MsgBox(64,"test string", $File_location & $result[2])
            RunWait(@ComSpec & ' /c start ' & $File_location & $result[2], '', @SW_HIDE)
        EndIf   
    Else
        ToolTip("Internet Explorer was not running", 0, 0)
    EndIf
    Sleep(2000)
    ToolTip("")
EndFunc

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Here's a protocol handler routine to take care of a scite://whatever.au3 url.

;===============================================================================
;eltorro <steve@ocotillo.sytes.net>
;launch scite from browser with parameter
;
;compile and run from the cmdline to add protocol handler to registry
;    SciTeUrl.exe -reg 
;example scite://C:\Program Files\Autoit3\scripts\my_new_script.au3
;works with firefox 1.5.0.4, IE6
;===============================================================================
#region - Compiler directives section
;if you change the name of the OutFile
#Compiler_OutFile="C:\WINDOWS\SciTeUrl.exe"
#endregion
;then you need to change it here too.
Local $sciteurl = "C:\WINDOWS\SciTeUrl.exe"
;Put you path to scite here. This is default.
Local $scite = "C:\Program Files\AutoIt3\SciTe\SciTe.exe"
;===============================================================================
If $CmdLine[0] > 0 Then
    If $CmdLine[1] <> "-reg" Then
        Local $file = StringSplit(StringReplace($CmdLineRaw,chr(34),""), "://", 1)
        If Not @error Then
            While StringRight($file[2], 1) = "/" Or StringRight($file[2], 1) = Chr(34)
                $file[2] = StringTrimRight($file[2], 1)
            WEnd
;            MsgBox(266288, "URL:Protocol Handler", "Opening file in Scite...",3)
            Run('"' & $scite & '" "' & $file[2] & '"')
        EndIf
    Else
        RegWrite("HKCR\scite", "", "REG_SZ", '"URL:Scite Protocol"')
        RegWrite("HKCR\scite", "URL Protocol", "REG_SZ", '""')
        RegWrite("HKCR\scite\DefaultIcon", "", "REG_SZ", '"' & $scite & '"')
        RegWrite("HKCR\scite\shell\open\command", "", "REG_SZ", '"' & $sciteurl & '" "%1"')
        MsgBox(266288, "RegWrite", "Registry Entries Added." & @LF)
    EndIf
EndIf
;~ Windows Registry Editor Version 5.00

;~ [HKEY_CLASSES_ROOT\scite]
;~ @="URL:Scite Protocol"
;~ "URL Protocol"="\"\""

;~ [HKEY_CLASSES_ROOT\scite\DefaultIcon]
;~ @="\"C:\\Program Files\\AutoIt3\\SciTe\\SciTe.exe\""

;~ [HKEY_CLASSES_ROOT\scite\shell]

;~ [HKEY_CLASSES_ROOT\scite\shell\open]

;~ [HKEY_CLASSES_ROOT\scite\shell\open\command]
;~ @="\"C:\\Windows\\SciTeUrl.exe\" \"%1\""

Regards,

eltorro

Share this post


Link to post
Share on other sites

That's nice steve (eltorro)!


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

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  
Followers 0