File Associations?

Scott Morrow scott at elementarysoftware.com
Wed Mar 3 02:45:33 EST 2010


Hello Scott,

I'm not using Inno Installer but a custom installer application made with Rev.  Before trying to set the registry my installer has elevated itself to have administrative privileges (by adjusting the manifest with Resource Tuner as described by Trevor DeVore)

I believe this is all the pertinent code from my installer application and I'm sure you will recognize Ken's instructional outline as the foundation.  I've left in some code specific to my app and referenced custom properties that you would need to substitute your own data in for.

Hopefully this will shed a light of Ray.  (pun intended)

-Scott Morrow
Elementary Software
(Now with 20% less chalk dust!)
web       http://elementarysoftware.com/
email     scott at elementarysoftware.com


------------------------------------------------------------------------------------------------------------------------------
local lErrorLog

on SetWindowsRegistry
   put empty into lErrorLog
  
   put "Setting the registry" into fld "progressInfo" of cd "install" of stack "elsoInstaller"
   wait 1 sec
   set the customPropertySet of stack "elsoInstaller" to empty
   set the customPropertySet of stack "elsoInstallerLib" to empty
   -- tProgramFilesFolderPath  --> the path to the Programs folder -- < C:/Program Files >
   put fld "installPath" of cd "destination" of stack "elsoInstaller" into tProgramFilesFolderPath
   -- tAppFolder --> the name of OUR folder that contains the application we are installing -- < Report Card Pro >
   
   set the itemDel to "/"
   put item -1 of tProgramFilesFolderPath into tAppFolder
   --> put the uEnclosingFolderName of stack "elsoInstaller" into tAppFolder -- the user has control over this part of the path
   
   -- tAppName --> the name of the executable application we are installing -- < Report Card Pro >
   put the uAppName of stack "elsoInstaller" into tAppName
   -- tAppExecutablePath --> the fileName (Full Path) of the .exe
   put tProgramFilesFolderPath &"/"& tAppName into tAppExecutablePath
   -- save the full path in case we need to launch the app just before quiting this installer
   set the uLaunchPath  of stack "elsoInstaller" to tAppExecutablePath 
   replace "/" with "\" in tAppExecutablePath
   -- tDocExtension -- the "dot" extension that is associated with the application we are installing -- < .rcp >
   put the uFileExtention of stack "elsoInstaller" into tDocExtension
   if tDocExtension is empty then
      put "Ther was an error attempting to set the Registry because file extension information was missing" &cr after lErrorLog
      return "file extension missing"
      exit SetWindowsRegistry
   end if
   
   
   ------------------------------------------------------------------
   -- Set the Windows Registry if necessary --------
   ------------------------------------------------------------------
   -- Check to make sure the Windows Registry is set to associate the .rcp file extension with ReportCard_Pro
   if queryRegistry("HKEY_CLASSES_ROOT\"&tDocExtension&"\") <> tAppFolder then -- there is no Registry key for the file extension
      -- so let's set it up
      --1. Create a key in HKEY_CLASSES_ROOT for the extension, and use the default value to point to the name of the application
      -- get setRegistry("HKEY_CLASSES_ROOT\.tst\","TestApp")
      get setRegistry("HKEY_CLASSES_ROOT\"&tDocExtension&"\",tAppFolder)
      put the result into tResult
      if tResult is not empty then
         put "setRegistry error 1" && tResult &cr after lErrorLog -- Custom error reporting
         return tResult
      end if
      
      if lErrorLog is empty then
         --2. Create a key in HKCR for the application itself, using the default value to point to a descriptor of the kind of document used by the app 
         -- this will be used in list views to show the kind of file a document of TestApp is:
         -- get setRegistry("HKEY_CLASSES_ROOT\TestApp\","TestApp document")
         put tAppFolder && "document" into tAppDocAssoc
         get setRegistry("HKEY_CLASSES_ROOT\"&tAppFolder&"\",tAppDocAssoc)
         put the result into tResult
         if tResult is not empty then
            put "setRegistry error 2" && tResult &cr after lErrorLog -- Custom error reporting
            return tResult
         end if
      end if -- lErrorLog is empty
      
      if lErrorLog is empty then
         --3. Create a subkey of HKCR\TestApp to hold the default icon for the application. Rev document icons are in the first position
         -- get setRegistry("HKEY_CLASSES_ROOT\TestApp\DefaultIcon\","C:\Program Files\TestApp\TestApp.exe,1")
         put tAppExecutablePath & COMMA & "1" into tDefaultIconString
         get setRegistry("HKEY_CLASSES_ROOT\"&tAppFolder&"\DefaultIcon\",tDefaultIconString)
         put the result into tResult
         if tResult is not empty then
            put "setRegistry error 3" && tResult &cr after lErrorLog -- Custom error reporting
            return tResult
         end if
      end if -- lErrorLog is empty
      
      if lErrorLog is empty then
         --4. Create a subkey three layers deep in HKCR\ReportCard_Pro to hold the command to open the application when the document with the ".rcp" extension is launched. 
         -- The path to the document is defined in the registry as %1.
         -- get setRegistry("HKEY_CLASSES_ROOT\TestApp\shell\open\command\","C:\Program Files\TestApp\TestApp.exe %1")
         -- for my purposes the path will look like:
         -- C:/Program Files/Report Card Pro/ReportCard_Pro.exe
         put tAppExecutablePath&&"%1" into tSubKeyDblClickDocString
         get setRegistry("HKEY_CLASSES_ROOT\"&tAppFolder&"\shell\open\command\",tSubKeyDblClickDocString)
         put the result into tResult
         if tResult is not empty then
            put "setRegistry error 4" && tResult &cr after lErrorLog -- Custom error reporting
            return tResult
         end if -- tResult is not empty 
      end if -- lErrorLog is empty
   end if -- need to set the Windows registry
   ------------------------------------------------------------------
 
   return empty
 
end SetWindowsRegistry

-------------------------------------------------------------------------------------------------------------------------------




On Mar 2, 2010, at 10:48 PM, Scott Rossi wrote:

> Recently, I wrote:
> 
>>> For documents launching multiple instances see < relaunch >  in the
>>> dictionary 
>>> where there is a note to look at an example stack.
>> 
>> In my stack, the relaunch message is apparently not being called for some
>> reason.  I've tried placing it in the stack script and in a stack script
>> behavior, and still nothing is happening.  Still trying to figure out what's
>> going on.
> 
> Is it possible that the relaunch message is failing for me because I'm using
> a splash/data arrangement for my standalone?  My splash executable launches
> a data stack and then closes the launching stack.  Could this be why any
> subsequent launches of the EXE don't trigger the relaunch handler?
> 
> Regards,
> 
> Scott Rossi
> Creative Director
> Tactile Media, UX Design
> 
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list