"launch Attached file" action help not helpful :) - Advanced Installer Community
Fulgan
Posts: 101
Joined: Mon Feb 27, 2012 10:42 am

"launch Attached file" action help not helpful :)

I'm trying to solve the same issue as in my previous messages: makes sure that the application can actually be installed because the installer will be unable to find out if the files in the destination folder are locked or not.

Since AI doesn't support selecting in which order the files are deployed, I'm going for a fallback solution: checking if some of the files are locked directly.

I have first tried writing a small Dll that would do this. unfortunately, there seems to be no way to properly define the dll's signature and what parameters to pass to it. So, I switched to and executable that takes a parameter at the command-line.

And there I'm stuck: the help file description is obviously for a different version of the action (it mentions running a dll which is not available) and does not mention the option I'm interested in at all: "fail installation if custom action returns an error".

So: how could you please describe how an executable could:

- Take the destination path ([APPPATH]) as parameter
- Returns either success or error
- Do that after the user has selected a destination but before the installer has started copying files.
- In case of errror, fails with a custom message (ideally, it should be a "try again/cancel" message but I'll settle for failing with an error)

All that using AI 13.7 with a "pro" project.

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

Re: "launch Attached file" action help not helpful :)

Hello Stephane,

The "Launch attach file" custom action can run more types of files, so the help describes all the options for that custom action here.

The "Fail installation if custom action returns an error" option is common to all the custom action types and it means that if the execution of the custom action fails, the installation of the package also fails and it is interrupted.
- Take the destination path ([APPPATH]) as parameter
To achieve this you can send the "APPDIR" property through command line to the EXE file that is executed by the custom action (in the "Command Line" field of the custom action).
- Returns either success or error
Custom actions that are executable files must return a value of 0 for success. The installer interprets any other return value as failure. You can see more details in the "Custom Action Return Values" article.
- Do that after the user has selected a destination but before the installer has started copying files.
To achieve this you can place the custom action at any point between the "Paths Resolution" and "Add Resources" action groups from the "Custom Actions" page.
- In case of errror, fails with a custom message (ideally, it should be a "try again/cancel" message but I'll settle for failing with an error)
This can be done in the code of your custom action. In case it fails you can display a message to inform the user about this and you can also let him choose to try again or cancel it. In case a return value different than 0 has been sent to the installer, the custom action cannot be executed again.

Just let me know if you have other questions.

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

Return to “Common Problems”