Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 8 of 8
  1. #1
    Join Date
    Oct 2005
    Posts
    572

    code to open the program when click a file

    if i click *.doc the microsoft word open automatically.
    i have a code who work good but i need the program to know the file path thet belonging to the file who opend the program.

    i need an example thet insert the path file to a lable object or a variable.


    function CreateFileAssociation(strApplicationPath, strFileExtension, strAppShortName, strIconFile)

    Registry.SetValue(HKEY_CLASSES_ROOT, strFileExtension, "", strAppShortName);

    local strCommandLine = "\""..strApplicationPath.."\" \"%1\"";
    Registry.SetValue(HKEY_CLASSES_ROOT, strAppShortName.."\\shell\\open\\command", "", strCommandLine);

    if(File.DoesExist(strIconFile))then
    local strApp83path = File.GetShortName(strIconFile);
    Registry.SetValue(HKEY_CLASSES_ROOT, strAppShortName.."\\DefaultIcon", "", strApp83path..",0");
    end
    end

    local strApplication = "d:\\LND.exe"
    CreateFileAssociation(strApplication, ".rrr", "e:\\LND.exe", "e:\\1.ico",0) ;

  2. #2
    Join Date
    May 2006
    Posts
    5,380
    the file path will be passed as the last argument in the _CommandlineArgs tabel

    so to access the filepath sent to the exe, put this in page preload
    Code:
    if _CommandLineArgs[Table.Count(_CommandLineArgs)] then
    	strMyFilePath= _CommandLineArgs[Table.Count(_CommandLineArgs)]
    end
    Open your eyes to Narcissism, Don't let her destroy your life!!

  3. #3
    Join Date
    Oct 2005
    Posts
    572

    i get the program path and i need the file path

    i get the program path and i need the file path.


    example:
    if i click "c:\text.doc" i get "c:\programfiles\office\word.exe" but i need to get "c:\text.doc"

  4. #4
    Join Date
    May 2006
    Posts
    5,380
    in that case it would be the first item in the _CommandLineArgs tabel

    Code:
    if _CommandLineArgs[1] then
    	strMyFilePath= _CommandLineArgs[1]
    end
    Open your eyes to Narcissism, Don't let her destroy your life!!

  5. #5
    Join Date
    Oct 2005
    Posts
    572

    the code work good but

    if i choose 2 files the program open 2 times and i need to open the program 1 time and get in variable 2 values. i need only to know how to open the program 1 time because i know how to get in variable 2 values.

  6. #6
    Join Date
    May 2006
    Posts
    5,380
    huh....

    do you mean, if your app is already running and you click a file ?
    Open your eyes to Narcissism, Don't let her destroy your life!!

  7. #7
    Join Date
    Oct 2005
    Posts
    572

    yes

    if my app is already running and you click a file the file open a new app and i wont the file to go the old app.

  8. #8
    Join Date
    Oct 2005
    Posts
    572

    if i choice 2 or more files and click enter the program open...

    if i choice 2 or more files and click enter the program open more then 1 time and i need to open the program 1 time and get all the file list (more then 1 file)
    in the _CommandLineArgs[1] ther is a string but in the _CommandLineArgs[2] i get an errore way??? (and i choice 2 files)

    example
    if i choice 10 mp3 files and click enter the microsoft media player open and you get in in the media player a list for all the files.

Similar Threads

  1. Article: Using Authenticode Code Signing Certificates
    By Ted Sullivan in forum Setup Factory 8.0 Examples
    Replies: 4
    Last Post: 10-31-2007, 09:03 AM
  2. Open URL instead of file
    By hammerstein in forum AutoPlay Media Studio 5.0
    Replies: 4
    Last Post: 06-23-2005, 05:24 AM
  3. Audio.Play Action - two clicks to start file
    By CraigS in forum AutoPlay Media Studio 5.0
    Replies: 3
    Last Post: 04-20-2005, 01:56 AM
  4. Open file with on CD program.
    By Loki in forum AutoPlay Menu Studio 3.0
    Replies: 2
    Last Post: 04-06-2001, 10:39 PM
  5. Can search allow manual browse even if file is found?
    By RichardShaw in forum Setup Factory 5.0
    Replies: 2
    Last Post: 08-28-2000, 06:08 PM

Posting Permissions

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