milanche
Posts: 14
Joined: Mon Sep 10, 2012 5:41 pm

VBS script for getting filename from path

Hello

i have exe installer, and i'm trying to get installer filename.
I'm using custom action "Launch attached file" and i created and attached the script.

Code: Select all

Dim folderName
folderName = Session.Property("AI_SETUPEXEPATH")

Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")

Dim objFile
Set objFile = fso.GetFile(folderName)

Dim sName
Set sName = objFile.Name

Session.Property("val1") = sName
val1 is my environment varialble, so i can write filename to registry.

Problem is that i can't execute this script, installer will end because of error, but i can't find the reason.
As i can say issue is with this command: Session.Property("val1") = sName

Any ideas?

Thanks.
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: VBS script for getting filename from path

Hi,

I tested your custom action and it seems that the problem appears at the following line: Set sName = objFile.Name.

Can you try to remove the "Set" statement and see if the behavior persist. Also, make sure that your custom action is set to run as immediate.

Let us know if this helped.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
milanche
Posts: 14
Joined: Mon Sep 10, 2012 5:41 pm

Re: VBS script for getting filename from path

Hello

yes it helped. That's it, one small change.

Thanks
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: VBS script for getting filename from path

You're welcome. I'm glad you got this working.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”