COMO VERIFICAR SE EXISTE UM DIRETÓRIO INNOSETUP
0
votar contra
favorita
Preciso verificar se existe a pasta C:\SISAUTO, C:\BASESISAUTO. Caso exista as pastas, criar uma nova por exemplo C:\SISAUTO2, C:\BASESISAUTO2
Segue codigo.
; Script generated by the Inno Setup Script Wizard. ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
define MyAppName [Ô]SISAUTO - SISTEMA DE AUTOMAÇÃO COMERCIAL[Ô]
define MyAppVersion [Ô]7.0.23[Ô]
define MyAppPublisher [Ô]SUPPORT INFORMÃTICA[Ô]
define MyAppURL [Ô]http://www.support-br.com.br[Ô]
define MyAppExeName [Ô]MyProg.exe[Ô]
[Setup] ; NOTE: The value of AppId uniquely identifies this application. ; Do not use the same AppId value in installers for other applications. ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) AppId={{0D0A707B-5DF4-4AF9-BC4C-133886E5E379} AppName={#MyAppName} AppVersion={#MyAppVersion} ;AppVerName={#MyAppName} {#MyAppVersion} AppPublisher={#MyAppPublisher} AppPublisherURL={#MyAppURL} AppSupportURL={#MyAppURL} AppUpdatesURL={#MyAppURL} CreateAppDir=no OutputDir=C:\Users\SERVER\Desktop\Arquivos para Executavel\Output OutputBaseFilename=INSTALADOR_SISAUTO_2017 SetupIconFile=C:\Users\SERVER\Desktop\Arquivos para Executavel\SISAUTO\install.ico Compression=lzma SolidCompression=yes
DisableWelcomePage=no DisableDirPage=yes DisableProgramGroupPage=yes DisableReadyMemo=yes DisableReadyPage=yes DisableStartupPrompt=yes DisableFinishedPage=no
[Languages] Name: brazilianportuguese; MessagesFile: compiler:Languages\BrazilianPortuguese.isl
[Tasks] Name: desktopicon; Description: Create a &desktop icon; GroupDescription: Additional icons:
[Dirs] Name: C:\SISAUTO Name: C:\BASESISAUTO Name: C:\BASESISAUTO\GERNFE2 Name: C:\BASESISAUTO\BASE1 Name: C:
otas Name: C:\ACBrMonitorPLUS Name: C:\Unimake Name: C:\Unimake\UniNFe Name: C:\Unimake\UniDANFE
[Files]
Source: C:\Users\SERVER\Desktop\Arquivos para Executavel\BASESISAUTO\GERNFE2*; DestDir: C:\BASESISAUTO\GERNFE2; Flags: recursesubdirs onlyifdoesntexist confirmoverwrite; Tasks: Source: C:\Users\SERVER\Desktop\Arquivos para Executavel\BASESISAUTO\BASE1*; DestDir: C:\BASESISAUTO\BASE1; Flags: recursesubdirs onlyifdoesntexist confirmoverwrite Source: C:\Users\SERVER\Desktop\Arquivos para Executavel\SISAUTO*; DestDir: C:\SISAUTO; Flags: recursesubdirs onlyifdoesntexist confirmoverwrite Source: C:\Users\SERVER\Desktop\Arquivos para Executavel\ACBrMonitorPLUS*; DestDir: C:\ACBrMonitorPLUS; Flags: recursesubdirs onlyifdoesntexist confirmoverwrite; Tasks: ; Languages: Source: C:\Users\SERVER\Desktop\Arquivos para Executavel\UniNFe*; DestDir: C:\Unimake\UniNFe; Flags: recursesubdirs onlyifdoesntexist confirmoverwrite Source: C:\Users\SERVER\Desktop\Arquivos para Executavel\UniDANFE*; DestDir: C:\Unimake\UniDANFE; Flags: recursesubdirs onlyifdoesntexist confirmoverwrite
[Icons] Name: {userdesktop}\SISAUTO; Filename: C:\SISAUTO\sisauto.exe; Tasks: desktopicon Name: {userdesktop}\GERNFE2; Filename: C:\BASESISAUTO\GERNFE2\gernfe2.exe; Tasks: desktopicon Name: {userdesktop}\ACBrMonitorPLUS; Filename: C:\ACBrMonitorPLUS\ACBrMonitor.exe; Tasks: desktopicon Name: {userdesktop}\UNINFE; Filename: C:\Unimake\UniNFe\uninfe.exe; Tasks: desktopicon Name: {userdesktop}\UNIDANFE; Filename: C:\Unimake\UniDANFE\unidanfe.exe; Tasks: desktopicon
Name: {commonstartup}\GERNFE2; Filename: C:\BASESISAUTO\GERNFE2\gernfe2.exe Name: {commonstartup}\ACBrMonitorPLUS; Filename: C:\ACBrMonitorPLUS\ACBrMonitor.exe Name: {commonstartup}\UniNFe; Filename: C:\Unimake\UniNFe\uninfe.exe
[_ISTool] UseAbsolutePaths=true ; NOTE: Don[ô]t use [Ô]Flags: ignoreversion[Ô] on any shared system files
[Run] Filename: C:\SISAUTO\InstalaDLL2.exe Filename: C:\ACBrMonitorPLUS\ACBrMonitor.exe; Flags: nowait runminimized hidewizard runhidden Filename: C:\Unimake\UniNFe\uninfe.exe; Flags: nowait runminimized hidewizard runhidden
votar contra
favorita
Preciso verificar se existe a pasta C:\SISAUTO, C:\BASESISAUTO. Caso exista as pastas, criar uma nova por exemplo C:\SISAUTO2, C:\BASESISAUTO2
Segue codigo.
; Script generated by the Inno Setup Script Wizard. ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
define MyAppName [Ô]SISAUTO - SISTEMA DE AUTOMAÇÃO COMERCIAL[Ô]
define MyAppVersion [Ô]7.0.23[Ô]
define MyAppPublisher [Ô]SUPPORT INFORMÃTICA[Ô]
define MyAppURL [Ô]http://www.support-br.com.br[Ô]
define MyAppExeName [Ô]MyProg.exe[Ô]
[Setup] ; NOTE: The value of AppId uniquely identifies this application. ; Do not use the same AppId value in installers for other applications. ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) AppId={{0D0A707B-5DF4-4AF9-BC4C-133886E5E379} AppName={#MyAppName} AppVersion={#MyAppVersion} ;AppVerName={#MyAppName} {#MyAppVersion} AppPublisher={#MyAppPublisher} AppPublisherURL={#MyAppURL} AppSupportURL={#MyAppURL} AppUpdatesURL={#MyAppURL} CreateAppDir=no OutputDir=C:\Users\SERVER\Desktop\Arquivos para Executavel\Output OutputBaseFilename=INSTALADOR_SISAUTO_2017 SetupIconFile=C:\Users\SERVER\Desktop\Arquivos para Executavel\SISAUTO\install.ico Compression=lzma SolidCompression=yes
DisableWelcomePage=no DisableDirPage=yes DisableProgramGroupPage=yes DisableReadyMemo=yes DisableReadyPage=yes DisableStartupPrompt=yes DisableFinishedPage=no
[Languages] Name: brazilianportuguese; MessagesFile: compiler:Languages\BrazilianPortuguese.isl
[Tasks] Name: desktopicon; Description: Create a &desktop icon; GroupDescription: Additional icons:
[Dirs] Name: C:\SISAUTO Name: C:\BASESISAUTO Name: C:\BASESISAUTO\GERNFE2 Name: C:\BASESISAUTO\BASE1 Name: C:
otas Name: C:\ACBrMonitorPLUS Name: C:\Unimake Name: C:\Unimake\UniNFe Name: C:\Unimake\UniDANFE
[Files]
Source: C:\Users\SERVER\Desktop\Arquivos para Executavel\BASESISAUTO\GERNFE2*; DestDir: C:\BASESISAUTO\GERNFE2; Flags: recursesubdirs onlyifdoesntexist confirmoverwrite; Tasks: Source: C:\Users\SERVER\Desktop\Arquivos para Executavel\BASESISAUTO\BASE1*; DestDir: C:\BASESISAUTO\BASE1; Flags: recursesubdirs onlyifdoesntexist confirmoverwrite Source: C:\Users\SERVER\Desktop\Arquivos para Executavel\SISAUTO*; DestDir: C:\SISAUTO; Flags: recursesubdirs onlyifdoesntexist confirmoverwrite Source: C:\Users\SERVER\Desktop\Arquivos para Executavel\ACBrMonitorPLUS*; DestDir: C:\ACBrMonitorPLUS; Flags: recursesubdirs onlyifdoesntexist confirmoverwrite; Tasks: ; Languages: Source: C:\Users\SERVER\Desktop\Arquivos para Executavel\UniNFe*; DestDir: C:\Unimake\UniNFe; Flags: recursesubdirs onlyifdoesntexist confirmoverwrite Source: C:\Users\SERVER\Desktop\Arquivos para Executavel\UniDANFE*; DestDir: C:\Unimake\UniDANFE; Flags: recursesubdirs onlyifdoesntexist confirmoverwrite
[Icons] Name: {userdesktop}\SISAUTO; Filename: C:\SISAUTO\sisauto.exe; Tasks: desktopicon Name: {userdesktop}\GERNFE2; Filename: C:\BASESISAUTO\GERNFE2\gernfe2.exe; Tasks: desktopicon Name: {userdesktop}\ACBrMonitorPLUS; Filename: C:\ACBrMonitorPLUS\ACBrMonitor.exe; Tasks: desktopicon Name: {userdesktop}\UNINFE; Filename: C:\Unimake\UniNFe\uninfe.exe; Tasks: desktopicon Name: {userdesktop}\UNIDANFE; Filename: C:\Unimake\UniDANFE\unidanfe.exe; Tasks: desktopicon
Name: {commonstartup}\GERNFE2; Filename: C:\BASESISAUTO\GERNFE2\gernfe2.exe Name: {commonstartup}\ACBrMonitorPLUS; Filename: C:\ACBrMonitorPLUS\ACBrMonitor.exe Name: {commonstartup}\UniNFe; Filename: C:\Unimake\UniNFe\uninfe.exe
[_ISTool] UseAbsolutePaths=true ; NOTE: Don[ô]t use [Ô]Flags: ignoreversion[Ô] on any shared system files
[Run] Filename: C:\SISAUTO\InstalaDLL2.exe Filename: C:\ACBrMonitorPLUS\ACBrMonitor.exe; Flags: nowait runminimized hidewizard runhidden Filename: C:\Unimake\UniNFe\uninfe.exe; Flags: nowait runminimized hidewizard runhidden
http://www.jrsoftware.org/ishelp/index.php?topic=isxfunc_direxists
estou tentando usar esta funcao
[Code]
function InitializeSetup():Boolean;
begin
if (DirExists([ô]C:\SISAUTO[ô])) then
begin
if (DirExists([ô]C:\BASESISAUTO\BASE1[ô])) then
begin
MsgBox([ô]Pasta SISAUTO E BASE1 JA EXISTE, SERA CRIADO, SISAUTO2 E BASE2[ô],mbError, MB_OK);
CreateDir([ô]C:\SISAUTO2[ô]);
CreateDir([ô]C:\BASESISAUTO\BASE2[ô]);
Result :=true;
end;
end;
end;
esta verificando se existe, se existir cria as duas novas pastas, só que precisaria que instalasse o sistema nessas duas pastas novas, estou com dificuldade nesta parte
[Code]
function InitializeSetup():Boolean;
begin
if (DirExists([ô]C:\SISAUTO[ô])) then
begin
if (DirExists([ô]C:\BASESISAUTO\BASE1[ô])) then
begin
MsgBox([ô]Pasta SISAUTO E BASE1 JA EXISTE, SERA CRIADO, SISAUTO2 E BASE2[ô],mbError, MB_OK);
CreateDir([ô]C:\SISAUTO2[ô]);
CreateDir([ô]C:\BASESISAUTO\BASE2[ô]);
Result :=true;
end;
end;
end;
esta verificando se existe, se existir cria as duas novas pastas, só que precisaria que instalasse o sistema nessas duas pastas novas, estou com dificuldade nesta parte
renomeando as pastas vai resolver pra mim
function InitializeSetup():Boolean;
begin
if (DirExists([ô]C:\SISAUTO[ô])) then
begin
if (DirExists([ô]C:\BASESISAUTO\BASE1[ô])) then
begin
if (DirExists([ô]C:\BASESISAUTO\GERNFE2[ô])) then
begin
MsgBox([ô]SISAUTO,BASE1 JA EXISTE, SERA RENOMEADO PARA SISAUTO2,BASE2[ô],mbInformation, MB_OK);
RenameFile([ô]C:\SISAUTO[ô], [ô]C:\SISAUTO2[ô]);
RenameFile([ô]C:\BASESISAUTO\BASE1[ô], [ô]C:\BASESISAUTO\BASE2[ô]);
RenameFile([ô]C:\BASESISAUTO\GERNFE2\gernfe.mdb[ô], [ô]C:\BASESISAUTO\GERNFE2\gernfe2.mdb[ô]);
end;
end;
end;
end;
só preciso saber porque ao dar OK na mensagem, esta saindo fora do instalador, só preciso continuar o instalador
pode me ajudar?
function InitializeSetup():Boolean;
begin
if (DirExists([ô]C:\SISAUTO[ô])) then
begin
if (DirExists([ô]C:\BASESISAUTO\BASE1[ô])) then
begin
if (DirExists([ô]C:\BASESISAUTO\GERNFE2[ô])) then
begin
MsgBox([ô]SISAUTO,BASE1 JA EXISTE, SERA RENOMEADO PARA SISAUTO2,BASE2[ô],mbInformation, MB_OK);
RenameFile([ô]C:\SISAUTO[ô], [ô]C:\SISAUTO2[ô]);
RenameFile([ô]C:\BASESISAUTO\BASE1[ô], [ô]C:\BASESISAUTO\BASE2[ô]);
RenameFile([ô]C:\BASESISAUTO\GERNFE2\gernfe.mdb[ô], [ô]C:\BASESISAUTO\GERNFE2\gernfe2.mdb[ô]);
end;
end;
end;
end;
só preciso saber porque ao dar OK na mensagem, esta saindo fora do instalador, só preciso continuar o instalador
pode me ajudar?
Abaixo do último Rename, você deve colocar:
Result := True;
InitializeSetup é uma função. Se ela retornar False é o mesmo que abortar a instalação.
Abraços!
Result := True;
InitializeSetup é uma função. Se ela retornar False é o mesmo que abortar a instalação.
Abraços!
Beleza deu certo aqui ! Obrigado!
DS2T pode me ajudar com mais uma coisa?
Como faco nessa linha RenameFile([ô]C:\SISAUTO[ô], [ô]C:\SISAUTO2[ô]);
No lugar de ser c:\sisauto2 ele fica
C:\sisauto20170228
Ele pegar a data do sistema ou também hora?
Como faco nessa linha RenameFile([ô]C:\SISAUTO[ô], [ô]C:\SISAUTO2[ô]);
No lugar de ser c:\sisauto2 ele fica
C:\sisauto20170228
Ele pegar a data do sistema ou também hora?
Seria algo do tipo:
[ô]C:\SISAUTO[ô] + GetDateTimeString([ô]yyyymmdd[ô], #0, #0);
Ou isso:
[ô]C:\SISAUTO[ô] +StringChangeEx(GetDateTimeString([ô]yyyy-mm-dd[ô], [ô]-[ô], [ô]:[ô]), [ô]-[ô], [ô][ô], True);
Depois dá uma olhada melhor na documentação dessas funções que posso ter errado parâmetro.
Abraços!
[ô]C:\SISAUTO[ô] + GetDateTimeString([ô]yyyymmdd[ô], #0, #0);
Ou isso:
[ô]C:\SISAUTO[ô] +StringChangeEx(GetDateTimeString([ô]yyyy-mm-dd[ô], [ô]-[ô], [ô]:[ô]), [ô]-[ô], [ô][ô], True);
Depois dá uma olhada melhor na documentação dessas funções que posso ter errado parâmetro.
Abraços!
Faça seu login para responder