Ver Mensaje Individual
  #5  
Antiguo 05-01-2005
Avatar de alt126
alt126 alt126 is offline
Miembro
 
Registrado: dic 2004
Posts: 171
Reputación: 20
alt126 Va por buen camino
La respuesta es un poco complicada...

Vamos a ver...mas que con el IsTool, lo que yo he hecho fue con el "Inno Setup Form Designer 1.1.2c", que te permite hacer formularios para incluirlos en la instalacion. Asi que lo que hice fue, crear un formulario donde preguntaba si la instalacion era local o remota. Si era local el alias lo instalaba con un path y si era remota con otro.

Asi que la respuesta se puede dividir en varias partes:

- primero como hacer para seleccionar entre local o remoto -> yo use ese programa.

- segundo como crear el alias -> se hace creando unas entradas al registro desde el inno setup.

Como no se si todo esto te aclara algo o no...te dejo aki el codigo...(un poco largo y lioso, te lo advierto!!!).

Si te aclara algo, mira concretamente las partes del registro y del codigo, pero ojo, la mayor parte del codigo de la parte codigo la genera el programa ese para crear forms.

Aqui tienes:

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
[Setup]
AppName=Facturas 1.0
AppVerName=Facturas 1.0
DefaultDirName={pf}\Facturas
DisableDirPage=yes
DefaultGroupName=Facturas
DisableProgramGroupPage=yes
[Tasks]
; NOTE: The following entry contains English phrases ("Create a desktop icon" and "Additional icons"). You are free to translate them into another language if required.
Name: "desktopicon"; Description: "Crear un acceso en el escritorio"; GroupDescription: " "; Flags: unchecked
[Files]
Source: "C:\a\Facturacion.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\a\Manual de usuario.doc"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\a\ayuda.ico"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\a\Manual de instalacion.doc"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\a\vclx35.bpl"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\a\borlndmm.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\a\cp3240mt.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\a\qrpt35.bpl"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\a\vcl35.bpl"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\a\vcldb35.bpl"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\a\MiniReg.exe"; DestDir: "{app}"; Flags: deleteafterinstall
Source: "C:\a\BdeInst.dll"; DestDir: "{app}"; Flags: deleteafterinstall
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: "{group}\Manual de Usuario"; Filename: "{app}\Manual de Usuario.doc"; IconFilename: "{app}\ayuda.ico"
Name: "{group}\Manual de Instalación"; Filename: "{app}\Manual de Instalacion.doc"; IconFilename: "{app}\ayuda.ico"
Name: "{group}\Facturas"; Filename: "{app}\Facturacion.exe";
; NOTE: The following entry contains an English phrase ("Uninstall"). You are free to translate it into another language if required.
Name: "{group}\Desinstalar Facturas"; Filename: "{uninstallexe}"
Name: "{userdesktop}\Facturas"; Filename: "{app}\Facturacion.exe"; Tasks: desktopicon
[Run]
; NOTE: The following entry contains an English phrase ("Launch"). You are free to translate it into another language if required.
Filename: "{app}\MiniReg.exe"; Parameters: """{app}\BdeInst.dll"""
Filename: "{app}\Facturacion.exe"; Description: "Ejecutar Facturas"; Flags: nowait postinstall skipifsilent
[Registry]
Root: HKCU; SubKey: Software\ODBC\ODBC.INI\ODBC Data Sources; ValueType: string; ValueName: BaseDatosFacturas; ValueData: Microsoft Access Driver (*.mdb); Flags: createvalueifdoesntexist uninsdeletevalue
Root: HKCU; SubKey: Software\ODBC\ODBC.INI\BaseDatosFacturas; Flags: createvalueifdoesntexist uninsdeletevalue; ValueName: Driver; ValueType: string; ValueData: C:\WINDOWS\System32\odbcjt32.dll
Root: HKCU; SubKey: Software\ODBC\ODBC.INI\BaseDatosFacturas; Flags: createvalueifdoesntexist uninsdeletevalue; ValueName: DBQ; ValueType: string; ValueData: "{code:RutaAlias|a}"
Root: HKCU; SubKey: Software\ODBC\ODBC.INI\BaseDatosFacturas; Flags: createvalueifdoesntexist uninsdeletevalue; ValueName: DriverId; ValueType: dword; ValueData: 25
Root: HKCU; SubKey: Software\ODBC\ODBC.INI\BaseDatosFacturas; Flags: createvalueifdoesntexist uninsdeletevalue; ValueName: FIL; ValueType: string; ValueData: MS Access
Root: HKCU; SubKey: Software\ODBC\ODBC.INI\BaseDatosFacturas; Flags: createvalueifdoesntexist uninsdeletevalue; ValueName: SafeTransactions; ValueType: dword; ValueData: 0
Root: HKCU; SubKey: Software\ODBC\ODBC.INI\BaseDatosFacturas; Flags: createvalueifdoesntexist uninsdeletevalue; ValueName: UID; ValueType: string; ValueData:
Root: HKCU; SubKey: Software\ODBC\ODBC.INI\BaseDatosFacturas\Engines\Jet; Flags: createvalueifdoesntexist uninsdeletevalue; ValueName: ImplicitCommitSync; ValueType: string; ValueData:
Root: HKCU; SubKey: Software\ODBC\ODBC.INI\BaseDatosFacturas\Engines\Jet; Flags: createvalueifdoesntexist uninsdeletevalue; ValueName: MaxBufferSize; ValueType: dword; ValueData: 2048
Root: HKCU; SubKey: Software\ODBC\ODBC.INI\BaseDatosFacturas\Engines\Jet; Flags: createvalueifdoesntexist uninsdeletevalue; ValueName: PageTimeout; ValueType: dword; ValueData: 5
Root: HKCU; SubKey: Software\ODBC\ODBC.INI\BaseDatosFacturas\Engines\Jet; Flags: createvalueifdoesntexist uninsdeletevalue; ValueName: Threads; ValueType: dword; ValueData: 3
Root: HKCU; SubKey: Software\ODBC\ODBC.INI\BaseDatosFacturas\Engines\Jet; Flags: createvalueifdoesntexist uninsdeletevalue; ValueName: UserCommitSync; ValueType: string; ValueData: no


[code]
var
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
Label1: TLabel;
FolderTreeView1: TFolderTreeView;
ruta: String;
function InitializeSetup(): Boolean;
var
Acc97Path: String;

begin
Result := true;
//Solo si access existe.
if(not RegKeyExists(HKLM,'SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\MSACCESS.EXE')) then
begin
Result := False;
MsgBox('Se requiere que Microsoft Access este instalado' #13#13 'La instalación no puede continuar', mbError, MB_OK);
end;
if(not RegKeyExists(HKLM,'SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Excel.EXE')) then
begin
Result := False;
MsgBox('Se requiere que Microsoft Excel este instalado' #13#13 'La instalación no puede continuar', mbError, MB_OK);
end;
if(RegQueryStringValue(HKEY_LOCAL_MACHINE,'SOFTWARE\Microsoft\Office\8.0','', Acc97Path)) then
begin
Result := False;
MsgBox('Se requiere una version de Microsoft Access 2000 o superior' #13#13 'La instalación no puede continuar', mbError, MB_OK);
end;
end;
procedure LocalOnClick(Sender: TObject);
begin
ruta:='c:\BaseDatos.mdb';
end;
procedure NuevaRutaOnClick(Sender: TObject);
begin
ruta:=FolderTreeView1.Directory + 'BaseDatos.mdb';
end;
procedure RemotoOnClick(Sender: TObject);
begin
RadioButton1.Visible:=false;
RadioButton2.Visible:=false;
ScriptDlgPageSetCaption('Instalación en Red');
ScriptDlgPageSetSubCaption1('Seleccione donde esta ubicada la base de datos');
ScriptDlgPageSetSubCaption2('');
{ Label1 }
Label1 := TLabel.Create(WizardForm.ScriptDlgPanel);
with Label1 do
begin
Parent := WizardForm.ScriptDlgPanel;
Left := 10;
Top := 10;
Width := 182;
Height := 13;
Caption := 'Seleccione la ruta a la base de datos:';
end;
{ FolderTreeView1 }
FolderTreeView1 := TFolderTreeView.Create(WizardForm.ScriptDlgPanel);
with FolderTreeView1 do
begin
Parent := WizardForm.ScriptDlgPanel;
Left := 30;
Top := 30;
Width := 350;
Height := 180;
Cursor := crArrow;
TabOrder := 0;
OnChange := @NuevaRutaOnClick;
end;
end;

function ScriptDlgPages(CurPage: Integer; BackClicked: Boolean): Boolean;
var
Next, NextOK: Boolean;
CurSubPage: Integer;
begin
{ place subpages between 'Welcome'- and 'SelectDir' page }
if (not BackClicked and (CurPage = wpWelcome)) or (BackClicked and (CurPage = wpSelectDir)) then
begin
{ find startpage }
if not BackClicked then
CurSubPage := 0
else
CurSubPage := 1;
{ iterate through all subpages }
while (CurSubPage >= 0) and (CurSubPage <= 1) and not Terminated do
begin
ScriptDlgPageOpen();
ScriptDlgPageClearCustom();
{ insert subpage }
case CurSubPage of
0: // custompage 1
begin
ScriptDlgPageSetCaption('Tipo de Instalación');
ScriptDlgPageSetSubCaption1('Seleccione donde esta ubicada la base de datos');
ScriptDlgPageSetSubCaption2('');
{ RadioButton1 }
RadioButton1 := TRadioButton.Create(WizardForm.ScriptDlgPanel);
with RadioButton1 do
begin
Parent := WizardForm.ScriptDlgPanel;
Left := 32;
Top := 56;
Width := 369;
Height := 17;
Caption := 'Instalación Local (La base de datos esta en este ordenador)';
TabOrder := 0;
OnClick := @LocalOnClick;
end;
{ RadioButton2 }
RadioButton2 := TRadioButton.Create(WizardForm.ScriptDlgPanel);
with RadioButton2 do
begin
Parent := WizardForm.ScriptDlgPanel;
Left := 32;
Top := 80;
Width := 369;
Height := 17;
Caption := 'Instalación Remota (La base de datos esta en otro ordenador)';
TabOrder := 1;
OnClick := @RemotoOnClick;
end;

Next := ScriptDlgPageProcessCustom();
NextOK := True;
end;
1: // custompage n
begin
end;
end;
{ check sub-page navigation }
if Next then
begin
if NextOK then
CurSubPage := CurSubPage + 1;
end
else
CurSubPage := CurSubPage - 1;
end;
{ check main-page navigation }
if not BackClicked then
Result := Next
else
Result := not Next;
ScriptDlgPageClose(not Result);
end
{ return default }
else
Result := True;
end;
{ NextButtonClick }
function NextButtonClick(CurPage: Integer): Boolean;
begin
Result := ScriptDlgPages(CurPage, False);
end;
{ BackButtonClick }
function BackButtonClick(CurPage: Integer): Boolean;
begin
Result := ScriptDlgPages(CurPage, True);
end;

function RutaAlias(S: String): String;
begin
Result := ruta;
end;
Responder Con Cita