Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

NewBy


7 replies to this topic

rosario100

rosario100
  • Members
  • 15 posts

Posted 16 February 2006 - 23:07

Hi guys

I have this problem. Once I have set the [INSTALLDIR] for my projects, most of my components have their destination there, but one is not, this component must be dynamic.

I mean at some point of the installation the user will be asked to set a "DynamicSystem" and this "DynamicSystem" will be a subfolder of [INSTALLDIR], I mean the destination for this component will be:

[INSTALLDIR]"DynamicSystem"

I know how to do that with an InstallScript project (where I have script-defined folder or also other way) but I don't have any idea how to do that in Basic MSI.

Have I to use a property or a directory from the custom action? I have no idea.

Could you tell me some tips?

Another issue is, can I have InstallShield dialogs in a CA? If not, why? And how to have custom dialogs? I need to ask to the user which one is the "DynamicSystem".

Last question, how I can force programmatically, for certain conditions to go back in the sequence dialogs?

I know I expose too many questions but I have started to study MSI applications with InstallShield just few days ago, I am struggling to understand, sorry so much.

Regards

Rosario

rosario100

rosario100
  • Members
  • 15 posts

Posted 17 February 2006 - 14:28

Hi guys

I find an horrible way but works.

1) First of all I created a Directory property and I called "SYSTEMDIR" as custom action.
2) I Assigned to my component a new destination dir as [SYSTEMDIR]
3) Then I wrote a custom action like that:
export prototype SetSystemDir(HWND);

function SetSystemDir(hMSI)
STRING szBuffer[256];
NUMBER nSize;
begin
nSize = 256;
MsiGetProperty(ISMSI_HANDLE, "SYSTEMNAME", szBuffer, nSize);
MsiSetProperty(hMSI, "SYSTEMDIR",INSTALLDIR + szBuffer);
end;
4) Then I created a new custom dialog where the user can type the "System" (subfolder) name. This dialog as an OK button where I added an event "DoAction" with argument SetSystemDir.

When I run the application the user is asked to set the primary destination path which will be INSTALLDIR, then he has to type the "System" (subfolder) and after that the installation start, the subforlder is created and the file copied.

Obviously this is quite rudimental but essentially work, I think there must be a better way but it is only few days I am working with this technology and I find it quite confusing and with a lack of documentation.

What I don't know now is how to force the user to write something in the dialog, I mean theoretically the user could clean the field and in that case I am in the trouble.

Thanks

Rosario



Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 18 February 2006 - 11:15

Find out what the directory identifier is that InstallShield has assigned to the component that should go to the DynamicSystem folder. You can then set this property to the desired value. Do I understand correctly that the default should be [INSTALLDIR]DynamicSystem but users should be able to select some other location, like E:\Whatever\MyFolder ? You could use a browse dialog for that. Look at the DatabaseFolder dialog for a sample. You could use this dialog and just replace the DATABASEFOLDER property with DYNAMICSYSTEM or whatever the directory identifier is.

rosario100

rosario100
  • Members
  • 15 posts

Posted 23 February 2006 - 10:13

Thanks Stefan

for the solution but a new dialog is appropriate as the users have to first choose what is the main folder where most of the files will be copied and after that they have to type a string which will be a subfolder of the main one, always, adding a new dialog I risk the user can select a folder which is not a subfolder of the main one and can be located somewhere else in the system and that is not what I want.

I am quite happy for the solution above.

Thank you a lot anyway.

Rosario

sjimmerson

sjimmerson
  • Members
  • 36 posts

Posted 10 March 2006 - 01:54

Along the line of Stefan's suggestion, you could make custom copies of the DestinationFolder and the InstallChangeFolder dialogs for the DynamicSystem folder. In the custom InstallChangeFolder dialog you could then disable the DirectoryCombo, Up PushButton and Tail PathEdit controls which would keep your users from being able to change directories. The only thing they would be able to do in this situation is make several subfolders and/or subfolders of subfolders. You could disable the DirectoryList control as well, but then you would be giving your users only one shot to enter the correct folder name using the NewFolder PushButton.

If you don't mind me asking, why does the user need to enter this DynamicSystem folder? Is there something else you could key off of to set the DynamicSystem folder without user interaction?

sanjoygr

sanjoygr
  • Full Members
  • 76 posts

Posted 13 March 2006 - 13:29

Hi,
I want the user to choose drive of his liking. But not the folder.
So I have made the directory list in InstallChangeFolder visible =false.
User can now only choose Drive from Directory Combo.

(I tried to use VolumeSelectCombo, I cannot bring the drive list. i dont know what setting have to be done.)

However in my application the folder name is fixed.
So after choosing the drive as per user liking the fullpath should become Drive:\"MyFixedFolderName\".

How to add this fixed folder name in the Tail PathEditControl value along with the selected drive.

eg selected drive=d:\, then my installation folder should become "d:\MyfixedFolderName".

Please let me know what is the possible solution.

Thanks
sanjoy_gr@yahoo.co.in

Edited by sanjoygr, 13 March 2006 - 13:58.


sjimmerson

sjimmerson
  • Members
  • 36 posts

Posted 13 March 2006 - 17:16

When the user clicks the next button on the DestinationFolder dialog you can set the control event to call:

Event: SetTargetPath
Argument: [_BrowseProperty]FixedFolder
Condition: 1

[_BrowseProperty] should already be set when the user clicks OK on the InstallChangeFolder dialog. If not you may need to change the Argument above.



sanjoygr

sanjoygr
  • Full Members
  • 76 posts

Posted 16 March 2006 - 14:46

Dear sjimmerson,
In your method there will be a problem. Error Code 2872 if the user goes for default setting or select some other folder.
In both the cases I have manually created myFixedFolder in the selected drive and tested. I also tested without creating the MyFixedFolder in the drive manually.

In general without any of your setting When I give a drive + Folder name in InstallChangeDestination dalog in PATHEDIT BOX (TAIL) EVEN IF THE FOLDER IS NOT PRESENT IT IS CREATED AND INSTALLDIR changes as per the value of PATHEDITBOX.

To solve my problem of installing in correct folder under the selected drive I have to manupulate the value of this PathEdit box or erite some custom action. called from OK Buttom DOACTION event.
I have done folling but there is a litle error.



Process followed:

Created an Custom Action CAChangeInstallDir
Following attributes for CA.
1.VBScript Fie name: MyFxiedFolder.vbs
2.ReturnProcessing:Asynchronous (Waits for exist code)
3.In-script execution:Immediate Execution
4.Execution Scheduling:Execute Only Once

The CA is called from the dialog box InstalledChangeFolder ControlName: OK - Type - Push Button
Event Name - Argument - Condition
DoAction - CAChangeInstallDir - 1
SetTargetPath - [_BrowseProperty] - 1
EndDialog - Return - 1

Coding in MyFxiedFolder.vbs

Option Explicit

Dim MyFixFolder,InstallDefaultPath,InstallDefaultFolder,StrCmpFolder
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")

MyFixFolder="THRTE_4.7.5\"

InstallDefaultPath =Session.Property("INSTALLDIR")
Msgbox InstallDefaultPath

If len(InstallDefaultPath)>3 Then
InstallDefaultFolder=left(InstallDefaultPath,3)
StrCmpFolder = StrComp(MyFixFolder,InstallDefaultFolder)
If StrCmpFolder <> 0 Then
Session.Property("INSTALLDIR")=Right(InstallDefaultPath,3) & MyFixFolder
End If
Elseif len(InstallDefaultPath)=3 then
Session.Property("INSTALLDIR")=InstallDefaultPath & MyFixFolder
End if

'Change the _BrowseProperty to new value
InstallDefaultPath =Session.Property(_BrowseProperty) &"\"
If len(InstallDefaultPath)>3 Then
InstallDefaultFolder=left(InstallDefaultPath,3)
StrCmpFolder = StrComp(MyFixFolder,InstallDefaultFolder)
If StrCmpFolder <> 0 Then
Session.Property(_BrowseProperty)=Right(InstallDefaultPath,3) & MyFixFolder
End If
Elseif len(InstallDefaultPath)=3 then
Session.Property(_BrowseProperty)=InstallDefaultPath & MyFixFolder
End if

MsgBox Session.Property(_BrowseProperty)
MsgBox Session.TargetPath("TARGETPATH")
MsgBox Session.TargetPath("INSTALLDIR")
WshShell.Quit


Run Time Errors:
2872 - DestinationFolder - When going for default Location. (In DestinationDialog)
2343 - Internal Error - When clicking the Change button in Destination Dialog at the time of installation
.

Please let me know here is the fault or what I am missing.


Thanks
Sanjoy

Edited by sanjoygr, 20 March 2006 - 07:25.