Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include-once
- ; #INDEX# =======================================================================================================================
- ; Title .........: Custom URL Protocol
- ; UDF Version....: 1.0.0
- ; AutoIt Version : 3.3.14.2
- ; Description ...: Register custom protocol for your AutoIt application
- ; Author(s) .....: Juno_okyo
- ; ===============================================================================================================================
- Func setDefaultValue(ByRef $fileName)
- If $fileName = Default Or Not FileExists($fileName) Then $fileName = @ScriptFullPath
- EndFunc ;==>setDefaultValue
- Func registerProtocol($protocolName, $iconFileName = Default, $execFileName = Default, $override = False)
- setDefaultValue($iconFileName)
- setDefaultValue($execFileName)
- Local $key = 'HKEY_CLASSES_ROOT\' & $protocolName
- Local $test = RegRead($key, '')
- ; Not registed yet
- If @error Or $override Then
- If RegWrite($key, '', 'REG_SZ', 'URL:' & $protocolName & ' Protocol') Then
- RegWrite($key, 'URL Protocol', 'REG_SZ', '')
- RegWrite($key & '\DefaultIcon', '', 'REG_SZ', $iconFileName)
- RegWrite($key & '\shell\open\command', '', 'REG_SZ', '"' & $execFileName & '" "%1"')
- Return True
- EndIf
- EndIf
- Return False
- EndFunc ;==>registerProtocol
- Func unregisterProtocol($protocolName)
- Return RegDelete('HKEY_CLASSES_ROOT\' & $protocolName)
- EndFunc ;==>unregisterProtocol
- Func getParams()
- If $CmdLine[0] = 0 Then Return SetError(1, 0, False)
- Local $params = StringSplit($CmdLine[1], ':', 3)
- Return @error ? SetError(2, 0, False) : $params[1]
- EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement