Loading
Automation DeleteSubFolder DeleteShortcut issue
Hi,

 

im using the IS2015 automation Interface with vbs to automate some builds.

 

I have problems deleteting a folder and also deleting a shortcut in the start menu.

 

 

At the beginning my startmenu folder (System Configuration -> Shortcuts) structure looks like this:

 

Shortcuts -> [TaskBarFolder] -> [StartMenuFolder] -> ProgramMenuFolder -> ProgramMenuCompanyFolder -> ProgramMenuProductFolder -> NewShortcut1

 

 

I try to delete "NewShortcut1" and "ProgramMenuProductFolder ":

 

pProject.ISWiFeatures.Item("Hauptanwendung").ISWiComponents.Item("CMP_StartMenuShortcut").ISWiFolders.Item("[TaskBarFolder]").SubFolders("[StartMenuFolder]").SubFolders("[ProgramMenuFolder]").SubFolders("ProgramMenuCompanyFolder").SubFolders("ProgramMenuProductFolder").DeleteShortcut("NewShortcut1")

 

pProject.ISWiFeatures.Item("Hauptanwendung").ISWiComponents.Item("CMP_StartMenuShortcut").ISWiFolders.Item("[TaskBarFolder]").SubFolders("[StartMenuFolder]").SubFolders("[ProgramMenuFolder]").SubFolders("ProgramMenuCompanyFolder").DeleteSubFolder("ProgramMenuProductFolder")

 

 

But i always end up with a type missmatch error. What am i doing wrong?

 

Please help :)

  • Thanks, for your reply.

     

    I could delete the shortcut successfully with your code:

     

     

    [CODE]Set pFolder = pProject.ISWiFeatures.Item("Hauptanwendung").ISWiComponents.Item("CMP_StartMenuShortcut").ISWiFolders.Item("[TaskBarFolder]").SubFolders("[StartMenuFolder]").SubFolders("[ProgramMenuFolder]").SubFolders("ProgramMenuCompanyFolder").SubFolders("ProgramMenuProductFolder")

     

    If pFolder Is Not Nothing Then

     

    Set pShortcut = pFolder.ISWiShortcuts("NewShortcut1")

     

    If pShortcut Is Not Nothing Then

     

    pFolder.DeleteShortcut(pShortcut)

     

    EndIf

     

    EndIf[/CODE]

     

     

    But i could not delete a subfolder like this:

     

     

    [CODE]Set pFolder = pProject.ISWiFeatures.Item("Hauptanwendung").ISWiComponents.Item("CMP_StartMenuShortcut").ISWiFolders.Item("[TaskBarFolder]").SubFolders("[StartMenuFolder]").SubFolders("[ProgramMenuFolder]").SubFolders("ProgramMenuCompanyFolder")

     

    If pFolder Is Not Nothing Then

     

    Set pSubFolder = pFolder.SubFolders.Item("ProgramMenuProductFolder")

     

    If pSubFolder Is Not Nothing Then

     

    pFolder.DeleteSubFolder(pSubFolder)

     

    EndIf

     

    EndIf

     

    [/CODE]

     

    I get the following error message:

     

    ISWiAuto22: Invalid procedure call or argument

     

    > ISWiAutomation.ISWiFolder.DeleteSubFolder
    Expand Post
  • 0_H Yamanishi (Flexera Software)

    There is a bug with the ISWiFolder.DeleteSubFolder method. It currently does not work with subfolders containing a uppercase letter in the key names. The key names have to be all lowercase for the method to work. So I filed the work order IOJ-1764845 to address this issue for a future release.

     

    To get it workaround, try manually changing the Key Name property of the ProgramMenuProductFolder folder to programmenuproductfolder in the IDE, and changing your script as follows:

     

    If pFolder Is Not Nothing Then

     

    Set pSubFolder = pFolder.SubFolders("programmenuproductfolder")

     

    If pSubFolder Is Not Nothing Then

     

    pFolder.DeleteSubFolder pSubFolder

     

    EndIf

     

    EndIf
    Expand Post
  • Ok, now with all subfolder written in lowercase letters the method works fine. Thanks for that.

     

     

    Is there a possibility to copy an existing shortcut one subfolder level up?

     

    From:

     

    Shortcuts -> [TaskBarFolder] -> [StartMenuFolder] -> ProgramMenuFolder -> ProgramMenuCompanyFolder -> ProgramMenuProductFolder -> NewShortcut1

     

    To:

     

    Shortcuts -> [TaskBarFolder] -> [StartMenuFolder] -> ProgramMenuFolder -> ProgramMenuCompanyFolder -> NewShortcut1

     

     

    This way i doesn't have to add a completly new one with all its properties...
    Expand Post
  • 0_H Yamanishi (Flexera Software)

    Although the Shortcuts view in the IDE includes the right-click shortcut menu options that lets you copy an existing shortcut and paste it into another folder, the automation interface currently does not support the same functionality. You need to create a new shortcut and copy all properties one by one. So I submitted the enhancement work order ISDEV-37851 to take into consideration for a future release.
    Expand Post

Loading
Automation DeleteSubFolder DeleteShortcut issue