Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2008
    Posts
    7

    Grin Loop through folder to unregister ActiveX controls

    Hi,

    I have an app that doesn't uninstall activex controls in a folder.
    In my setup, I need to check if that folder exists and if it does, I need to unregister every ActiveX control in that folder.
    Then I need to delete the folder and it's contents.
    I found how to check for a folder and your sample on unregister activex controls. I just can't figure out how to loop through all the controls when I don't know how many there are.


    bresult = Folder.DoesExist("%CommonFilesFolder%\SMS");

    if bresult then
    Loop through folder and unregister all activex controls in folder
    When all controls have been unregistered...
    Delete folder and contents.

    end

    Thanks for your help,

    Sheri

  2. #2
    Join Date
    Oct 2008
    Posts
    7

    Grin

    I have tried to put something together... Is this correct?

    bresult = Folder.DoesExist(SessionVar.Expand("%CommonFilesFo lder%\SMS"));

    if bresult then
    -- A while loop

    while File.Find(SessionVar.Expand("%CommonFilesFolder%\S MS"), "*.ocx", false, false, nil, nil) do
    -- Do something here\
    sPath =SessionVar.Expand("%CommonFilesFolder%\SMS")
    sFolder = String.SplitPath("sPath");
    sFile = sFolder.Filename;
    sExt = sFolder.Extension;
    -- get and set name of control

    tFind = File.Find("C:\\", "sName", true, false, nil);
    iCount = tFind.Count
    -- check to see if another instance of the file exists. If it does, don't unregister or delete.
    if iCount <= 1 then
    System.UnregisterActiveX("sPath" .. "\\sName");
    File.Delete("sFolder".."\\sName", false, false, false, nil);
    end


    end

    Folder.Delete(SessionVar.Expand("%CommonFilesFolde r%\SMS"));


    end

    Thanks

  3. #3
    Join Date
    Oct 2008
    Posts
    7

    Please Help! with Loop

    I have a customer that has installed an application of mine and one of the packages installs an activex that causes an out of memory error.
    I couldn't figure out what control is causing the problem but it is one that is in a specific folder.
    I unregistered and deleted all controls in a test machine and then installed again with a new setup and I no longer get the error.
    What I need to do, is create a setup that will unregister and delete all the controls in that folder, so I can do a fresh install.

    Please help... it is urgent! Thank you


    I have tried to put something together... Is this correct?

    bresult = Folder.DoesExist(SessionVar.Expand("%CommonFilesFo lder%\SMS"));

    if bresult then
    -- A while loop

    while File.Find(SessionVar.Expand("%CommonFilesFolder%\S MS"), "*.ocx", false, false, nil, nil) do
    -- Do something here\
    sPath =SessionVar.Expand("%CommonFilesFolder%\SMS")
    sFolder = String.SplitPath("sPath");
    sFile = sFolder.Filename;
    sExt = sFolder.Extension;
    -- get and set name of control

    tFind = File.Find("C:\\", "sName", true, false, nil);
    iCount = tFind.Count
    -- check to see if another instance of the file exists. If it does, don't unregister or delete.
    if iCount <= 1 then
    System.UnregisterActiveX("sPath" .. "\\sName");
    File.Delete("sFolder".."\\sName", false, false, false, nil);
    end

  4. #4
    Join Date
    Apr 2005
    Location
    São Paulo, Brazil
    Posts
    2,539
    Hello,

    this should be all you need.

    Code:
    -- check if folder exists
    if Folder.DoesExist(SessionVar.Expand("%CommonFilesFolder%\\SMS")) then
        -- find all OCX in folder and retrieve them in a table
        tFiles = File.Find(SessionVar.Expand("%CommonFilesFolder%\\SMS"), "*.ocx");
        -- process each element in the table
        for i, file in tFiles do
            -- unregister
            SetupData.WriteToLogFile("Info\tUnregistering ".. file .. "\r\n", true);
            System.UnregisterActiveX(file);
            -- delete
            SetupData.WriteToLogFile("Info\tDeleting ".. file .. "\r\n", true);
            File.Delete(file);
        end
        -- cleanup
        Folder.DeleteTree(SessionVar.Expand("%CommonFilesFolder%\\SMS"));
    else
        SetupData.WriteToLogFile("Info\t" .. SessionVar.Expand("%CommonFilesFolder%\\SMS") .. " does not exist\r\n", true);
    end
    Ulrich

Tags for this Thread

Posting Permissions

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