I hope this hasn't been answered before, but I have not been able to find anything close. I have compiled a macro that creates a new encrypted document in format of "file.xyz" and transmits this file via ftp to a another client. That client has a compiled script that will decrypt the "file.xyz". Currently the client opens the compiled macro and does a file browse to the encrypted file. I would like to define the default program for the .xyz extension to be the compiled macro. If the default program for *.xyz is MyCompiledMacro.exe how can I receive the path and file name of the source file to use with the macro.
Many Thanks,
How to open with
Moderators: Dorian (MJT support), JRL
Make your compiled macro accept the path/filename as a variable which is passed on the commandline.how can I receive the path and file name of the source file to use with the macro.
i.e.
MyCompiledMacro.exe /MyEncryptedFile=xxxxxxxx
Then in the windows setup for defining a file to be associated with the specific *.xyz file you enter something like the following (this is from memory)
MyCompiledMacro.exe /MyEncryptedFile=%1
To confirm syntax, look at how notepad is associated with *.txt files. It launches them in a similar fashion.
That worked, thank you very much. I have defined the windows file association as
"C:\MyDir\MyCompiled.exe" "/source=%1"
But this has lead to another question. I was going to add RegistryReadKey to verify/create the appropriate entries. For some reason, I am unable to read the appropriate registry entries defined as (Default) but I can read any other entry.
I can read
RegistryReadKey>HKEY_CLASSES_ROOT,xyz_auto_file\shell\open\command,Test,registryresulta
but I cannot read
RegistryReadKey>HKEY_CLASSES_ROOT,xyz_auto_file\shell\open\command,(Default),registryresultb
The (default) returns an empty string.
"C:\MyDir\MyCompiled.exe" "/source=%1"
But this has lead to another question. I was going to add RegistryReadKey to verify/create the appropriate entries. For some reason, I am unable to read the appropriate registry entries defined as (Default) but I can read any other entry.
I can read
RegistryReadKey>HKEY_CLASSES_ROOT,xyz_auto_file\shell\open\command,Test,registryresulta
but I cannot read
RegistryReadKey>HKEY_CLASSES_ROOT,xyz_auto_file\shell\open\command,(Default),registryresultb
The (default) returns an empty string.