Code: Select all
if( (doubleclick on %file%) and (%file%.ftype = ".my_ext"))
run "C:\MyScripts\my_extension_handler.ahk %file%"
I wrote a script "C:\MyScripts\my_extension_handler.ahk" that displays content of the file given as first parameter
Script works as expected when I run it in a terminal using
Code: Select all
C:\MyScripts\my_extension_handler.ahk C:\1\myfile.my_ext"
I associated this script with ".my_ext" : properties -> Open with -> C:\extension_handler.ahk
When I doubleclick "myfile.my_ext" I get "This app can't run on your PC error message".
How to associate double click with Windows launching this script and passing full file path as a parameter?
---------------------------------
Update:
---------------------------------
I've ran this code in cmd as an admin:
Code: Select all
assoc .my_ext=myownext
ftype myownext="C:\MyScripts\my_extension_handler.ahk" "%1"
regsvr32 /i shell32.dll
Code: Select all
Loop, %0% ; For each parameter:
{
if (! param){
global param := []
global index := 0
}
index := index + 1
param[index] := %A_Index%
}
strElements := ""
for index, element in param ; Recommended approach in most cases.
{
strElements := strElements . "Element number " . index . " is " . element . "`r`n"
}
MsgBox % strElements
str := ""
source := param[1]
MsgBox % "Source is " . source
Loop, read, %source% ; should read selectedfile
str := str . "`r`n" . A_LoopReadLine
MsgBox % str