Ayuda con escrbir un *.ini

Pregunta Sin Miedo no te cortes cualquier cosa para empezar - Autoit se comienza facilmente.Para Ordenes o Comandos sueltos. Ver nota como preguntar.
Responder
wbueso
Aprendiz de Mago
Mensajes: 61
Registrado: 31 Dic 2013, 01:02

Ayuda con escrbir un *.ini

Mensaje por wbueso »

Estoy creando un pequeño programa para agregar programas desatendidos en un archivo ini donde se escribe esto.

[Apli0]
Nombre Archivo=SciTE
Ubicacion=\Program Files (x86)\AutoIt3\SciTE\SciTE.exe
Estado=Desactivado
Icono=\Program Files (x86)\AutoIt3\SciTE\SciTE.ico
Info=\Program Files (x86)\AutoIt3\SciTE\SciTE.txt

Va desde [Apli0] hasta [Apli19],dice Apli porque se trata de aplicaciones, pero podria ser [Edit0] de Editores o [Prog0] de Programacion.

Otro programa toma esta informacion y hace la instalacion de los programas a partir de esta informacion.
Mi problema es que he resuelto a medias y con el poco conocimiento que tengo, como detectar cuales secciones hay ya escritas en el archivo INI, por ejemplo agrego un programa y se escribe en el INI la seccion para ese programa [Apli0], pero si ya existe esa seccion, que escriba [Apli1] y si ya existe que escriba [Apli2] y asi hasta llegar a [Apli19].
Puedo detectar las secciones con IniReadSectionNames, lo que hice es que vaya creando archivos en la carpeta temp con el nombre de las secciones, de esta manera con la ayuda de FileExist detecto las secciones que ya existen.

Uso este codigo para hacer eso.
$result = IniReadSectionNames(@ScriptDir & "\Datos\IUCCG_V2.ini")
If @error Then
MsgBox(0,"Aviso","El archivo esta vacio",0)
Else
For $a = 1 To $result[0]
_FileCreate(@TempDir&"\["&$result[$a]&"]")
Next
EndIf

Mi problema es que no se como hacer para que al detectar una seccion por ejemplo: [Apli0] que cree una nueva seccion [Apli1] y si ya existe, que cree [Apli3].
Con lo que tengo funciona hasta sierto punto y despues de dos o tres secciones o deja de escribir las nuevas o salta asta la ultima.
He usado IF con ElseIf y me falla.

Ayudenme porfabor, les aseguro que solo le pido ayuda cuando ya estoy desesperado.
Les envio el codigo para que lo prueven y me den sus consejos.
#include <GUIConstants.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <File.au3>
Global $Ruta, $LeerIni, $Ready, $Conf[20], $Apli[20], $Ofic[20], $Repr[20], $Edit[20], $Prog[20], $Herr[20], $Comp[20], $Otro[20]
$font = "Time New Roman"
;**** Estilos *************************************************
Global $StyloGrp = $WS_CAPTION, $Line1 = $WS_BORDER, $Form2 = $WS_DLGFRAME&$SS_CENTER

Global $IzqBtn = 10, $ArbBtn = 30, $AncBtn = 100, $GruBtn = 15
Global $IzqRad = 10, $ArbRad = 50, $AncRad = 100, $GruRad = 25
;**** Colores *************************************************
Global $ClrBtn = 0x99CCFF
;**** Estilos *************************************************
Global $Form1 = $WS_DLGFRAME

$TtlGui = "Agregando Programas"
GUICreate($TtlGui,635,450,5,5)
GUICtrlCreatePic(@ScriptDir&"\Datos\Fondo.jpg",1,1,905,518,$SS_BITMAP)

$LblIni = GUICtrlCreateLabel(@CRLF&" "&$TtlGui,$IzqBtn-3,$ArbBtn-25,$AncBtn+522,$GruBtn+40,$Line1)
GUICtrlSetBkColor($LblIni, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetFont($LblIni, 12, 800, 0, $font)

#**** Boton EXAMINAR **********************************************************************************#
$BtnBscr = GUICtrlCreateButton("Examinar",$IzqBtn+555,$ArbBtn+60,$AncBtn-40,$GruBtn+10)
GUICtrlSetBkColor(-1,$ClrBtn)

#**** Input Ruta del archivo **************************************************************************#
GUICtrlCreateLabel("Ruta del Archivo",$IzqBtn+5,$ArbBtn+40,$AncBtn,$GruBtn)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$InpRuta = GUICtrlCreateInput("",$IzqBtn,$ArbBtn+60,$AncBtn+450,$GruBtn+10)
GUICtrlSetBkColor(-1,$ClrBtn)

#**** Input Nombre del archivo ************************************************************************#
GUICtrlCreateLabel("Nombre del Programa",$IzqBtn+3,$ArbBtn+100,$AncBtn+20,$GruBtn)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$InpNomb = GUICtrlCreateInput("",$IzqBtn,$ArbBtn+125,$AncBtn+200,$GruBtn+10)
GUICtrlSetBkColor(-1,$ClrBtn)

#**** Combo Tipo de archivo ***************************************************************************#
GUICtrlCreateLabel("Tipo de Programa",$IzqBtn+315,$ArbBtn+100,$AncBtn,$GruBtn)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$ComTipo = GUICtrlCreateCombo("", $IzqBtn+310, $ArbBtn+125,150,30) ; crea el primer item
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetData(-1, "Configuracion|Aplicacion|Oficina|Reproductor|Editor|Programacion|Herramienta|Complemento|Otro", "Aplicacion") ; adiciona otros item

#**** Combo Estado del archivo ************************************************************************#
GUICtrlCreateLabel("Estado",$IzqBtn+475,$ArbBtn+100,$AncBtn-50,$GruBtn)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$ComEsta = GUICtrlCreateCombo("", $IzqBtn+470, $ArbBtn+125,150,30) ; crea el primer item
GUICtrlSetData(-1, "Por Defecto|Desactivado", "Desactivado") ; adiciona otros item

$InfArch = GUICtrlCreateLabel("",$IzqBtn,$ArbBtn+190,$AncBtn+517,$GruBtn+170,$Line1)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)

#**** Boton Salir *************************************************************************************#
$BtnSlr = GUICtrlCreateButton("Salir",$IzqBtn+515,$ArbBtn+380,$AncBtn,$GruBtn+10)
GUICtrlSetBkColor(-1,$ClrBtn)

$BtnGuar = GUICtrlCreateButton("Guardar",$IzqBtn,$ArbBtn+380,$AncBtn,$GruBtn+10)
GUICtrlSetBkColor(-1,$ClrBtn)

GUISetState(@SW_SHOW)

While 1

$nMsg = GUIGetMsg()


Switch $nMsg

Case $BtnGuar
_Ini()

Case $BtnBscr
_Add()

Case $BtnSlr
ExitLoop

Case $GUI_EVENT_CLOSE
Exit


EndSwitch
WEnd


Func _Add()

Global $Ruta
$Ruta = FileOpenDialog("Seleccione un Ejecutable", @ScriptDir&"\Datos\Programas\", "Ejecutables (*.exe;*.bat;*.com;*.cmd)", 1)
GUICtrlSetData($InpRuta,$Ruta)
If @error or $Ruta = "" Then
$iMsgBoxAnswer = MsgBox(36, "Seleccione un Ejecutable", "Desea cancelar la selección del fichero?")
Select
Case $iMsgBoxAnswer = 6 ;Yes

Case $iMsgBoxAnswer = 7 ;No
_Add()
EndSelect
Else
;$IsSelect = 1
$sFile = FileFindFirstFile($Ruta) ; Busqueda para saber el nombre del ejecutable
$nFile = FileFindNextFile($sFile) ; Esto es nada mas para que te muestre un nombre por default en el input
$Arreglo1 = StringTrimRight($nFile,4)

GUICtrlSetData($InfArch,@CRLF&" Usted selecciono el siguiente programa:..... "&$Arreglo1& @CRLF& @CRLF & _
" Su ubicacion es:....."&$Ruta& @CRLF& @CRLF &" El tipo de programas es:...."&GUICtrlRead($ComTipo)& @CRLF& @CRLF & _
" El estado del programa es:...."&GUICtrlRead($ComEsta))
GUICtrlSetData($InpNomb,$Arreglo1) ;Input Mandatory


If $InpNomb = "" Then
MsgBox(0, "Error", "Ha cancelado la operación")
EndIf
EndIf
EndFunc

Func _Ini()
$result = IniReadSectionNames(@ScriptDir & "\Datos\IUCCG_V2.ini")
If @error Then
MsgBox(0,"Aviso","El archivo esta vacio",0)
Else
For $a = 1 To $result[0]
_FileCreate(@TempDir&"\["&$result[$a]&"]")
Next
EndIf
;****** esta seccion reduce los nombres para despues usarlos para escribir las secciones *****************************************
If GUICtrlRead($ComTipo) = "Configuracion" Then
$Tipo = "Conf"
ElseIf GUICtrlRead($ComTipo) = "Aplicacion" Then
$Tipo = "Apli"
ElseIf GUICtrlRead($ComTipo) = "Oficina" Then
$Tipo = "Ofic"
ElseIf GUICtrlRead($ComTipo) = "Reproductor" Then
$Tipo = "Repr"
ElseIf GUICtrlRead($ComTipo) = "Editor" Then
$Tipo = "Edit"
ElseIf GUICtrlRead($ComTipo) = "Programacion" Then
$Tipo = "Prog"
ElseIf GUICtrlRead($ComTipo) = "Herramienta" Then
$Tipo = "Herr"
ElseIf GUICtrlRead($ComTipo) = "Complemento" Then
$Tipo = "Comp"
ElseIf GUICtrlRead($ComTipo) = "Otro" Then
$Tipo = "Otro"
EndIf
;******* Aqui detecta la seccion y si no existe en el INI la escribe o si existe la escribe con el siguiente numero ****************

; Aqui es mi problema

If FileExists(@TempDir&"\["&$Tipo&"0]") = 0 and FileExists(@TempDir&"\["&$Tipo&"1]") = 0 or FileExists(@TempDir&"\["&$Tipo&"1]") = 1 Then
$Ready = $Tipo&"0"
EndIf
If FileExists(@TempDir&"\["&$Tipo&"0]") = 1 and FileExists(@TempDir&"\["&$Tipo&"1]") = 0 and FileExists(@TempDir&"\["&$Tipo&"2]") = 0 or FileExists(@TempDir&"\["&$Tipo&"2]") = 1 Then
$Ready = $Tipo&"1"
EndIf
If FileExists(@TempDir&"\["&$Tipo&"1]") = 1 and FileExists(@TempDir&"\["&$Tipo&"2]") = 0 and FileExists(@TempDir&"\["&$Tipo&"3]") = 0 or FileExists(@TempDir&"\["&$Tipo&"3]") = 1 Then
$Ready = $Tipo&"2"
EndIf
If FileExists(@TempDir&"\["&$Tipo&"2]") = 1 and FileExists(@TempDir&"\["&$Tipo&"3]") = 0 and FileExists(@TempDir&"\["&$Tipo&"4]") = 0 or FileExists(@TempDir&"\["&$Tipo&"4]") = 1 Then
$Ready = $Tipo&"3"
EndIf
If FileExists(@TempDir&"\["&$Tipo&"3]") = 1 and FileExists(@TempDir&"\["&$Tipo&"4]") = 0 and FileExists(@TempDir&"\["&$Tipo&"5]") = 0 or FileExists(@TempDir&"\["&$Tipo&"5]") = 1 Then
$Ready = $Tipo&"4"
EndIf
If FileExists(@TempDir&"\["&$Tipo&"4]") = 1 and FileExists(@TempDir&"\["&$Tipo&"5]") = 0 and FileExists(@TempDir&"\["&$Tipo&"6]") = 0 or FileExists(@TempDir&"\["&$Tipo&"6]") = 1 Then
$Ready = $Tipo&"5"
EndIf
If FileExists(@TempDir&"\["&$Tipo&"5]") = 1 and FileExists(@TempDir&"\["&$Tipo&"6]") = 0 and FileExists(@TempDir&"\["&$Tipo&"7]") = 0 or FileExists(@TempDir&"\["&$Tipo&"7]") = 1 Then
$Ready = $Tipo&"6"
EndIf
If FileExists(@TempDir&"\["&$Tipo&"6]") = 1 and FileExists(@TempDir&"\["&$Tipo&"7]") = 0 and FileExists(@TempDir&"\["&$Tipo&"8]") = 0 or FileExists(@TempDir&"\["&$Tipo&"8]") = 1 Then
$Ready = $Tipo&"7"
EndIf
If FileExists(@TempDir&"\["&$Tipo&"7]") = 1 and FileExists(@TempDir&"\["&$Tipo&"8]") = 0 and FileExists(@TempDir&"\["&$Tipo&"9]") = 0 or FileExists(@TempDir&"\["&$Tipo&"9]") = 1 Then
$Ready = $Tipo&"8"
EndIf
If FileExists(@TempDir&"\["&$Tipo&"8]") = 1 and FileExists(@TempDir&"\["&$Tipo&"9]") = 0 and FileExists(@TempDir&"\["&$Tipo&"10]") = 0 or FileExists(@TempDir&"\["&$Tipo&"10]") = 1 Then
$Ready = $Tipo&"9"
EndIf
If FileExists(@TempDir&"\["&$Tipo&"9]") = 1 and FileExists(@TempDir&"\["&$Tipo&"10]") = 0 and FileExists(@TempDir&"\["&$Tipo&"11]") = 0 or FileExists(@TempDir&"\["&$Tipo&"11]") = 1 Then
$Ready = $Tipo&"10"
EndIf
If FileExists(@TempDir&"\["&$Tipo&"10]") = 1 and FileExists(@TempDir&"\["&$Tipo&"11]") = 0 and FileExists(@TempDir&"\["&$Tipo&"12]") = 0 or FileExists(@TempDir&"\["&$Tipo&"12]") = 1 Then
$Ready = $Tipo&"11"
EndIf
If FileExists(@TempDir&"\["&$Tipo&"11]") = 1 and FileExists(@TempDir&"\["&$Tipo&"12]") = 0 and FileExists(@TempDir&"\["&$Tipo&"13]") = 0 or FileExists(@TempDir&"\["&$Tipo&"13]") = 1 Then
$Ready = $Tipo&"12"
EndIf
If FileExists(@TempDir&"\["&$Tipo&"12]") = 1 and FileExists(@TempDir&"\["&$Tipo&"13]") = 0 and FileExists(@TempDir&"\["&$Tipo&"14]") = 0 or FileExists(@TempDir&"\["&$Tipo&"14]") = 1 Then
$Ready = $Tipo&"13"
EndIf
If FileExists(@TempDir&"\["&$Tipo&"13]") = 1 and FileExists(@TempDir&"\["&$Tipo&"14]") = 0 and FileExists(@TempDir&"\["&$Tipo&"15]") = 0 or FileExists(@TempDir&"\["&$Tipo&"15]") = 1 Then
$Ready = $Tipo&"14"
EndIf
If FileExists(@TempDir&"\["&$Tipo&"14]") = 1 and FileExists(@TempDir&"\["&$Tipo&"15]") = 0 and FileExists(@TempDir&"\["&$Tipo&"16]") = 0 or FileExists(@TempDir&"\["&$Tipo&"16]") = 1 Then
$Ready = $Tipo&"15"
EndIf
If FileExists(@TempDir&"\["&$Tipo&"15]") = 1 and FileExists(@TempDir&"\["&$Tipo&"16]") = 0 and FileExists(@TempDir&"\["&$Tipo&"17]") = 0 or FileExists(@TempDir&"\["&$Tipo&"17]") = 1 Then
$Ready = $Tipo&"16"
EndIf
If FileExists(@TempDir&"\["&$Tipo&"16]") = 1 and FileExists(@TempDir&"\["&$Tipo&"17]") = 0 and FileExists(@TempDir&"\["&$Tipo&"18]") = 0 or FileExists(@TempDir&"\["&$Tipo&"18]") = 1 Then
$Ready = $Tipo&"17"
EndIf
If FileExists(@TempDir&"\["&$Tipo&"17]") = 1 and FileExists(@TempDir&"\["&$Tipo&"18]") = 0 and FileExists(@TempDir&"\["&$Tipo&"19]") = 0 or FileExists(@TempDir&"\["&$Tipo&"19]") = 1 Then
$Ready = $Tipo&"18"
EndIf
If FileExists(@TempDir&"\["&$Tipo&"18]") = 1 and FileExists(@TempDir&"\["&$Tipo&"19]") = 0 Then
$Ready = $Tipo&"19"
EndIf
If FileExists(@TempDir&"\["&$Tipo&"18]") = 1 and FileExists(@TempDir&"\["&$Tipo&"19]") = 1 Then
MsgBox(0,"Aviso","La lista ya esta llena, agrege el programa en otra pestaña",5)
EndIf
; ****** esta seccion escribe el archivo INI ************************************************************
$Arreglo2 = StringTrimLeft($Ruta,2)
$Arreglo3 = StringTrimLeft($Ruta,2)
$Arreglo4 = StringTrimRight($Arreglo3,4)
IniWrite(@ScriptDir & "\Datos\IUCCG_V2.ini",$Ready, "Nombre Archivo",GUICtrlRead($InpNomb))
IniWrite(@ScriptDir & "\Datos\IUCCG_V2.ini",$Ready, "Ubicacion", $Arreglo2)
IniWrite(@ScriptDir & "\Datos\IUCCG_V2.ini",$Ready, "Estado", GUICtrlRead($ComEsta))
IniWrite(@ScriptDir & "\Datos\IUCCG_V2.ini",$Ready, "Icono", $Arreglo4&".ico")
IniWrite(@ScriptDir & "\Datos\IUCCG_V2.ini",$Ready, "Info", $Arreglo4&".txt")
ShellExecute(@ScriptDir & "\Datos\Refrescar Memoria\4GB.vbe") ; Libera la memoria de informacion basura
WinClose($TtlGui) ;Cierra la GUI para luego volverla a ejecutar
Sleep(10000)
FileDelete(@TempDir&"\[*]") ; Elimina los archivos creados en la carpeta temporal
ShellExecute(@ScriptDir & "\Add.exe") ; ejecuta de nuevo la GUI
EndFunc
Avatar de Usuario
Dany
Profesional del Autoit
Mensajes: 651
Registrado: 28 Mar 2012, 22:49

Re: Ayuda con escrbir un *.ini

Mensaje por Dany »

Hola. Puedes usar IniReadSecionNames y verificar con un contador cuanto existen. Algo así.

Código: Seleccionar todo

Local $sFilePath="TestFile.ini"
Local $sSectionName = _IniNextIndex($sFilePath, "Apli");Generar el primer o proximo nombre con el indice que corresponde en este caso Apli0 si no existe ningun Apli(N) en el .ini
IniWrite($sFilePath, $sSectionName, "Title", "AutoIt");Si no existe Apli0 en el .ini lo escribirá
ConsoleWrite($sSectionName & @CRLF) ;Debug

$sSectionName = _IniNextIndex($sFilePath, "Apli");Luego generamos el proximo nombre de la seccion con el indice (en este caso va a crear Apli(1)
IniWrite($sFilePath, $sSectionName, "Title", "AutoIt") ;Si  existe Apli0 en el .ini escribirá Apli1
ConsoleWrite($sSectionName & @CRLF) ;Debug


Func _IniNextIndex($sFilePath, $sSectionName)
	Local $aSections = IniReadSectionNames($sFilePath) 
	Local $sNextIndex = 0
	If IsArray($aSections) Then
		For $i = 1 To $aSections[0]
			If StringInStr($aSections[$i], $sSectionName) Then $sNextIndex += 1
		Next
	EndIf
	Return $sSectionName & $sNextIndex
EndFunc   ;==>_IniNextIndex

Saludos :smt027
  • ............................................Imagen
    ......................................Imagen
wbueso
Aprendiz de Mago
Mensajes: 61
Registrado: 31 Dic 2013, 01:02

Re: Ayuda con escrbir un *.ini

Mensaje por wbueso »

Dany escribió:Hola. Puedes usar IniReadSecionNames y verificar con un contador cuanto existen. Algo así.

Código: Seleccionar todo

Local $sFilePath="TestFile.ini"
Local $sSectionName = _IniNextIndex($sFilePath, "Apli");Generar el primer o proximo nombre con el indice que corresponde en este caso Apli0 si no existe ningun Apli(N) en el .ini
IniWrite($sFilePath, $sSectionName, "Title", "AutoIt");Si no existe Apli0 en el .ini lo escribirá
ConsoleWrite($sSectionName & @CRLF) ;Debug

$sSectionName = _IniNextIndex($sFilePath, "Apli");Luego generamos el proximo nombre de la seccion con el indice (en este caso va a crear Apli(1)
IniWrite($sFilePath, $sSectionName, "Title", "AutoIt") ;Si  existe Apli0 en el .ini escribirá Apli1
ConsoleWrite($sSectionName & @CRLF) ;Debug


Func _IniNextIndex($sFilePath, $sSectionName)
	Local $aSections = IniReadSectionNames($sFilePath) 
	Local $sNextIndex = 0
	If IsArray($aSections) Then
		For $i = 1 To $aSections[0]
			If StringInStr($aSections[$i], $sSectionName) Then $sNextIndex += 1
		Next
	EndIf
	Return $sSectionName & $sNextIndex
EndFunc   ;==>_IniNextIndex

Saludos :smt027
Lo prove y lo ejecute varias veces hasta apli10, cambie la seccion apli0 para ver si la volvia a crear, pero no lo hiso, entonces cambie secciones al asar para ver si las creaba nuevamente, pero no reponia las secciones faltantes.
El programa que utiliza este ini puede eliminar programas de la lista, por lo tanto puede borrar secciones del ini, por lo tanto puede existir apli desde apli0 hasta apli19 que es el maximo que puedo agregar, pero al borrar una seccion puede ser aleatotia a sea apli0, apli1, apli3, apli6, apli7, apli8 y asi, no puedo hacer que me agrege la nueva seccion en uno de los que falta y que solo llegue hasta 19.
Me gustaria que haga una lectura del ini desde apli0 hasta apli19, si hay uno que haga falta, que sea ahi donde lo escriba, ejemplo apli0, apli1, apli2, apli4, apli5, en este falta apli3, pues que lo escriba como apli3, cuando va escrito en orden funciona, pero al estar las secciones en orden aleatorio, falla, y mas si existe apli19 que es el ultimo, tambien hace esto, apli1, apli2, apli3, apli6, apli7, apli8, apl10, apli12, al ejecutarlo no escribe en los faltantes, sino que escribe despues del ultimo, me estoy volviendo loco con esto, pero a la ves estoy fascinado.
Grasias por la ayuda, me gusta las funciones que usaste porque no las conocia y eso me ayuda mucho en mi aprendizaje.
Avatar de Usuario
Dany
Profesional del Autoit
Mensajes: 651
Registrado: 28 Mar 2012, 22:49

Re: Ayuda con escrbir un *.ini

Mensaje por Dany »

Hola. mm ya entiendo un poco mas lo que quieres.

lo que puedes hacer es modificar la función que ya te mostré.

Básicamente mi código verifica el cuanto campos "Apli" existen y agrega un numero mas.

Para que funcione como quieres tendrías que ordenar las secciones basándote en los indices (los numero 0 , 1, etc...) luego verificas cuales están faltando y agregarlos.


Saludos :smt027
  • ............................................Imagen
    ......................................Imagen
wbueso
Aprendiz de Mago
Mensajes: 61
Registrado: 31 Dic 2013, 01:02

Re: Ayuda con escrbir un *.ini

Mensaje por wbueso »

Dany escribió:Hola. mm ya entiendo un poco mas lo que quieres.

lo que puedes hacer es modificar la función que ya te mostré.

Básicamente mi código verifica el cuanto campos "Apli" existen y agrega un numero mas.

Para que funcione como quieres tendrías que ordenar las secciones basándote en los indices (los numero 0 , 1, etc...) luego verificas cuales están faltando y agregarlos.


Saludos :smt027
Podrias mostrarme como, porfabor, de tanto intentarlo como que ya me bloquie, y me siento mas torpe.

Grasias.
wbueso
Aprendiz de Mago
Mensajes: 61
Registrado: 31 Dic 2013, 01:02

Re: Ayuda con escrbir un *.ini

Mensaje por wbueso »

Código: Seleccionar todo

If FileExists(@TempDir&"\["&$Tipo&"0]") = 0 Then
	  $Ready = $Tipo&"0"
	  _Escr()
   Else
   If FileExists(@TempDir&"\["&$Tipo&"1]") = 0 Then
	  $Ready = $Tipo&"1"
	  _Escr()
   Else
   If FileExists(@TempDir&"\["&$Tipo&"2]") = 0 Then
	  $Ready = $Tipo&"2"
	  _Escr()
   Else
   If FileExists(@TempDir&"\["&$Tipo&"3]") = 0 Then
	  $Ready = $Tipo&"3"
	  _Escr()
   Else
   If FileExists(@TempDir&"\["&$Tipo&"4]") = 0 Then
	  $Ready = $Tipo&"4"
	  _Escr()
   Else
   If FileExists(@TempDir&"\["&$Tipo&"5]") = 0 Then
	  $Ready = $Tipo&"5"
	  _Escr()
   Else
   If FileExists(@TempDir&"\["&$Tipo&"6]") = 0 Then
	  $Ready = $Tipo&"6"
	  _Escr()
   Else
   If FileExists(@TempDir&"\["&$Tipo&"7]") = 0 Then
	  $Ready = $Tipo&"7"
	  _Escr()
   Else
   If FileExists(@TempDir&"\["&$Tipo&"8]") = 0 Then
	  $Ready = $Tipo&"8"
	  _Escr()
   Else
   If FileExists(@TempDir&"\["&$Tipo&"9]") = 0 Then
	  $Ready = $Tipo&"9"
	  _Escr()
   Else
   If FileExists(@TempDir&"\["&$Tipo&"10]") = 0 Then
	  $Ready = $Tipo&"10"
   Else
   If FileExists(@TempDir&"\["&$Tipo&"11]") = 0 Then
	  $Ready = $Tipo&"11"
	  _Escr()
   Else
   If FileExists(@TempDir&"\["&$Tipo&"12]") = 0 Then
	  $Ready = $Tipo&"12"
	  _Escr()
   Else
   If FileExists(@TempDir&"\["&$Tipo&"13]") = 0 Then
	  $Ready = $Tipo&"13"
	  _Escr()
   Else
   If FileExists(@TempDir&"\["&$Tipo&"14]") = 0 Then
	  $Ready = $Tipo&"14"
	  _Escr()
   Else
   If FileExists(@TempDir&"\["&$Tipo&"15]") = 0 Then
	  $Ready = $Tipo&"15"
	  _Escr()
   Else
   If FileExists(@TempDir&"\["&$Tipo&"16]") = 0 Then
	  $Ready = $Tipo&"16"
	  _Escr()
   Else
   If FileExists(@TempDir&"\["&$Tipo&"17]") = 0 Then
	  $Ready = $Tipo&"17"
	  _Escr()
   Else
   If FileExists(@TempDir&"\["&$Tipo&"18]") = 0 Then
	  $Ready = $Tipo&"18"
	  _Escr()
   Else
   If FileExists(@TempDir&"\["&$Tipo&"19]") = 0 Then
	  $Ready = $Tipo&"19"
	  _Escr()
   Else
   If FileExists(@TempDir&"\["&$Tipo&"19]") = 1 Then
	  MsgBox(0,"Aviso","La lista ya esta llena"&@CRLF&@CRLF&"Agrege el programa en otro TIPO DE PROGRAMA",5)
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
De esta forma lo he resuelto.

Grasias por impulsarme para aprender, Dios los bendiga.
Responder