Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 15 of 18
  1. #1
    Join Date
    Apr 2009
    Posts
    7

    Nedd Help ! Create file association - registry set problem ..

    I read FAQ - Create file association from > http://www.indigorose.com/forums/showthread.php?t=23670 and I try to make file association but I can do this ,syntax is wrong ... ( line from faq ) :

    Registry.SetValue(HKEY_CLASSES_ROOT, "KQXEditor\\\\shell\\\\open\\\\command", "", SessionVar.Expand("%AppFolder%\\\\MyProgram.exe \\"%1\\"") , REG_SZ);

    : Syntax Error
    line=1: `)` expected near '%'


    Is a wrong syntax in faq or Setup Factory bug ? , I tried to import from registry but then I click ok or check syntax it return the same error ...

    what to do ???

    sorry for my english ..
    Last edited by ruslanx; 07-18-2009 at 11:55 AM.

  2. #2
    Join Date
    Apr 2009
    Posts
    7
    I found a solution :

    Registry.SetValue(HKEY_CLASSES_ROOT, ".jpeg", "", "jpegviewer", REG_SZ);
    Registry.SetValue(HKEY_CLASSES_ROOT, "jpegviewer\\\shell\\\\open\\\\command", "", SessionVar.Expand("%AppFolder%\\PhotoViewer.exe\\\ "%1\""), REG_SZ);
    Registry.SetValue(HKEY_CLASSES_ROOT, "jpegviewer\\\\DefaultIcon", "", SessionVar.Expand("%AppFolder%\\jpeg.ico ,0\\"), REG_SZ);

    this is working for me ... FAQ must corrected on this example ..
    Last edited by ruslanx; 07-18-2009 at 01:49 PM.

  3. #3
    Join Date
    Apr 2009
    Posts
    7
    I found a solution :

    Registry.SetValue(HKEY_CLASSES_ROOT, ".jpeg", "", "jpegviewer", REG_SZ);
    Registry.SetValue(HKEY_CLASSES_ROOT, "jpegviewer\\\shell\\\\open\\\\command", "", SessionVar.Expand("%AppFolder%\\PhotoViewer.exe\\\ "%1\""), REG_SZ);
    Registry.SetValue(HKEY_CLASSES_ROOT, "jpegviewer\\\\DefaultIcon", "", SessionVar.Expand("%AppFolder%\\jpeg.ico ,0\\"), REG_SZ);

    this is working for me ... FAQ must corrected on this example ..

  4. #4
    Join Date
    Apr 2009
    Posts
    7
    warnig : > remove the space ... "%AppFolder%\\PhotoViewer.exe\\\*"%1\""), ... then you copy from web page

  5. #5
    Join Date
    Apr 2007
    Posts
    16

    File association in registry and looking up Program path

    My problem is thus.

    I'm wanting to create an association with our unique files (Extention .ptv) with a specific program. The problem is that I first need to create a registry get value string that locates the folder that the program is located on the computer.
    In the registry there is no listing of the folder path by itself. The value in the registry includes the executable in the paths
    Example: C:\Program Files\FLV Player\FLVPlayer.exe

    What code do I use to capture just the folder path without the filename.exe at the end.

    Then how do I associating our .ptv files to this executable.

    Also is the coding the same in Autoplay Media Studio

  6. #6
    Join Date
    Jan 2001
    Location
    Anderson Island, WA, USA
    Posts
    2,863
    Quote Originally Posted by BigDeveloper View Post
    Example: C:\Program Files\FLV Player\FLVPlayer.exe

    What code do I use to capture just the folder path without the filename.exe at the end.
    Have a look at String.SplitPath()

    Quote Originally Posted by BigDeveloper View Post
    Then how do I associating our .ptv files to this executable.
    Did you search the forums, I know I've posted this code before...
    Code:
    function File.SetAssocation(cExt, cExe, cIcon, cShort,cLong)
      -- Set the file association for the given file.
    	Registry.CreateKey(HKEY_CLASSES_ROOT, cExt);
    	Registry.SetValue(HKEY_CLASSES_ROOT, cExt,"",cShort,REG_SZ);
    
    	Registry.CreateKey(HKEY_CLASSES_ROOT, cShort);
    	Registry.SetValue(HKEY_CLASSES_ROOT, cShort,"","School Check IN Data File",REG_SZ);
    
    	Registry.CreateKey(HKEY_CLASSES_ROOT, cShort.."\\shell");
    	Registry.CreateKey(HKEY_CLASSES_ROOT, cShort.."\\shell\\open");
    	Registry.CreateKey(HKEY_CLASSES_ROOT, cShort.."\\shell\\open\\command");
    	Registry.SetValue(HKEY_CLASSES_ROOT, cShort.."\\shell\\open\\command","",cExe.." %1",REG_SZ);
    
    	if not cIcon or not File.DoesExist( cIcon ) then
    	  cIcon = cExe
    	end
    	Registry.SetValue(HKEY_CLASSES_ROOT, cShort.."\\DefaultIcon","",File.GetShortName(cIcon)..",0");
    end
    A call to it would be something like this:
    Code:
    File.SetAssocation(".PTV",SessionVar.Expand("%AppFolder%\\FLVPlayer.exe"), SessionVar.Expand("%AppFolder%\\FLVPlayer.ico"), "FLV Player File","FLV Player File/Movie");
    Quote Originally Posted by BigDeveloper View Post
    Also is the coding the same in Autoplay Media Studio
    Most code writen in one app will work fine in another. What you need to be sure of is that the object exists in the other platform. eg: SetupData. does not exist in anything except SUF.


    (Click here to contact me)
    Providing Independent Professional Consulting Services for
    IndigoRose products, World Wide.
    Located in -8:00 (-7:00 DST) GMT Timezone (Western United States)

  7. #7
    Join Date
    Apr 2007
    Posts
    16

    Splitting the code

    I don't know what I'm doing wrong on this. I'm a novice. The Key name in the Registry is:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Curr entVersion\App Paths\FLVPlayer.exe

    and the code I have for spliting it and then running the program is:



    RegVar = Registry.GetValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\ \App Paths\\FLVPlayer.exe", "(Default)")
    Split = String.SplitPath(RegVar);
    NewRegVar = Split.Drive..Split.Folder;
    File.Run(FLVPlayer.exe, "", NewRegVar, SW_MAXIMIZE, false);

    It isn't working. it gives and error message that the FLVPlayer.exe is nil.

  8. #8
    Join Date
    Jan 2001
    Location
    Anderson Island, WA, USA
    Posts
    2,863
    did you create that entry?
    do you test the results to be sure it contains a path?

    This doesn't seem to be the same issue as before; but perhaps posting your project file & enumerating the problem clearly would be a good way to go.


    (Click here to contact me)
    Providing Independent Professional Consulting Services for
    IndigoRose products, World Wide.
    Located in -8:00 (-7:00 DST) GMT Timezone (Western United States)

  9. #9
    Join Date
    Apr 2007
    Posts
    16
    The key in the registry was created with the install of the FLVPlayer which is a Flash player. I'm trying to create a button in Autoplay studio that will look at the registry and find the location of the Flash player. and then run a flash video using that player.

    Also, I was going to change the extension of our Flash Videos to be a unique extension and then associate that extension with this Flash player.

    Right now I'm trying to tackle only one thing at a time and currenly I'm trying to simply program the button to run the flash player.

    I have attached a zip file that includes the autoplay file and the registry file.

    The More Perfect Union button is the one that has the code I'm working on. This is code that was given my by Adam Kapilik a long time ago. Maybe it's out of date.

    Once I get this working I can begin on getting the file association to work.
    Attached Files

  10. #10
    Join Date
    Apr 2007
    Posts
    16
    One more thing...
    Maybe the File association ought to be set in the Setup factory install instead of the the Autoplay menu. Not sure if this matters.

  11. #11
    Join Date
    Apr 2007
    Posts
    16
    Also, here's some code I'm trying to use for checking.

    RegVar = Registry.GetValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\ \App Paths\\FLVPlayer.exe", "(Default)")
    Split = String.SplitPath(RegVar);
    if (Split ~= "") then
    filename = Split .. "\\FLVPlayer.exe";
    if File.DoesExist(filename) then
    File.Run(filename, "", Split, SW_MAXIMIZE, false);
    else
    Dialog.Message("Error", "Could not find " .. filename, MB_OK, MB_ICONEXCLAMATION);
    end
    else
    Dialog.Message("Error", "Could not locate expected value in the registry.", MB_OK, MB_ICONEXCLAMATION); end

  12. #12
    Join Date
    Apr 2007
    Posts
    16
    From trial and error, I just got it to work using the following code. I now need to modify line 7 to include the actual flash video that I want to play. This flash video will be located in the \\Autoplay\\Videos folder.

    I would like the code to open this specific player and play the specific video.

    I would also like to create an association between our unique extension and this player also


    RegVar = Registry.GetValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\ \App Paths\\FLVPlayer.exe", "")
    Split = String.SplitPath(RegVar);
    NewRegVar = Split.Drive..Split.Folder;
    if (NewRegVar ~= "") then
    filename = NewRegVar .. "\\FLVPlayer.exe";
    if File.DoesExist(filename) then
    File.Run(filename, "", NewRegVar, SW_MAXIMIZE, false);
    else
    Dialog.Message("Error", "Could not find " .. filename, MB_OK, MB_ICONEXCLAMATION);
    end
    else
    Dialog.Message("Error", "Could not locate expected value in the registry.", MB_OK, MB_ICONEXCLAMATION); end

  13. #13
    Join Date
    Apr 2007
    Posts
    16
    So from your prior code you give on the file association, is there anything I would need to replace in there for my .ptv files or do I leave it like it is.

    Also do place the first set of code in the Pre Install and the last in the Post install?

    Pre Install code:
    function File.SetAssocation(cExt, cExe, cIcon, cShort,cLong)
    -- Set the file association for the given file.
    Registry.CreateKey(HKEY_CLASSES_ROOT, cExt);
    Registry.SetValue(HKEY_CLASSES_ROOT, cExt,"",cShort,REG_SZ);

    Registry.CreateKey(HKEY_CLASSES_ROOT, cShort);
    Registry.SetValue(HKEY_CLASSES_ROOT, cShort,"","School Check IN Data File",REG_SZ);

    Registry.CreateKey(HKEY_CLASSES_ROOT, cShort.."\\shell");
    Registry.CreateKey(HKEY_CLASSES_ROOT, cShort.."\\shell\\open");
    Registry.CreateKey(HKEY_CLASSES_ROOT, cShort.."\\shell\\open\\command");
    Registry.SetValue(HKEY_CLASSES_ROOT, cShort.."\\shell\\open\\command","",cExe.." %1",REG_SZ);

    if not cIcon or not File.DoesExist( cIcon ) then
    cIcon = cExe
    end
    Registry.SetValue(HKEY_CLASSES_ROOT, cShort.."\\DefaultIcon","",File.GetShortName(cIcon )..",0");
    end




    Post install Code:
    File.SetAssocation(".PTV",SessionVar.Expand("%AppF older%\\FLVPlayer.exe"), SessionVar.Expand("%AppFolder%\\FLVPlayer.ico"), "FLV Player File","FLV Player File/Movie");

  14. #14
    Join Date
    Jan 2001
    Location
    Anderson Island, WA, USA
    Posts
    2,863
    You would put the function delcaration in "global functions" or an external script file (that you then need to include in your project) and call it in post-install.


    (Click here to contact me)
    Providing Independent Professional Consulting Services for
    IndigoRose products, World Wide.
    Located in -8:00 (-7:00 DST) GMT Timezone (Western United States)

  15. #15
    Join Date
    Apr 2007
    Posts
    16
    I'm if I'm such a pain on this. but I think I'm close to the resolution.
    I am using this in Setup Factory.

    Since the installation of the FLVPlayer is separate from my Main install, I need to get the path to the FLVPlayer.exe from the registry. The following is what I have in the Post Install of my program along with your File.Association code.

    RegVar = Registry.GetValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\ \App Paths\\FLVPlayer.exe", "")
    Split = String.SplitPath(RegVar);
    NewRegVar = Split.Drive..Split.Folder;
    File.SetAssocation(".PTV",SessionVar.Expand("%NewR egVar%\\FLVPlayer.exe"), SessionVar.Expand("%NewRegVar%\\FLVPlayer.exe"), "FLV Player File","FLV Player File/Movie");


    This adds a key to the registry but when I then double click on one of my .PTV files it give me and 'Access Denied' error.

    The Regestry.GetValue codes line and the following 2 line after worked in Autoplay but I'm not sure if it is correct for Setup Factory.




    I have the following code in the global functions:


    **********
    function File.SetAssocation(cExt, cExe, cIcon, cShort,cLong)
    -- Set the file association for the given file.
    Registry.CreateKey(HKEY_CLASSES_ROOT, cExt);
    Registry.SetValue(HKEY_CLASSES_ROOT, cExt,"",cShort,REG_SZ);

    Registry.CreateKey(HKEY_CLASSES_ROOT, cShort);
    Registry.SetValue(HKEY_CLASSES_ROOT, cShort,"","School Check IN Data File",REG_SZ);

    Registry.CreateKey(HKEY_CLASSES_ROOT, cShort.."\\shell");
    Registry.CreateKey(HKEY_CLASSES_ROOT, cShort.."\\shell\\open");
    Registry.CreateKey(HKEY_CLASSES_ROOT, cShort.."\\shell\\open\\command");
    Registry.SetValue(HKEY_CLASSES_ROOT, cShort.."\\shell\\open\\command","",cExe.." %1",REG_SZ);

    if not cIcon or not File.DoesExist( cIcon ) then
    cIcon = cExe
    end
    Registry.SetValue(HKEY_CLASSES_ROOT, cShort.."\\DefaultIcon","",File.GetShortName(cIcon )..",0");
    end

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts