This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Automation DeleteSubFolder DeleteShortcut issue
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 13, 2016
08:21 AM
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 🙂
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 🙂
(5) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 13, 2016
01:45 PM
The syntax for the DeleteSubFolder and DeleteShortcut methods of the ISWiFolder automation interface are documented incorrectly. They actually take an ISWiFolder and ISWiShortcut object respectively as follows:
So your script should be changed like this:
[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]
Hope that helps.
- DeleteSubFolder (pSubFolderAs ISWiFolder ) As Long
- DeleteShortcut (pShortcut As ISWiShortcut ) As Long
So your script should be changed like this:
[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]
Hope that helps.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 14, 2016
08:49 AM
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
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
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 14, 2016
12:48 PM
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:
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
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 15, 2016
07:39 AM
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...
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...
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 15, 2016
11:29 AM
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.