RE:EDITAR Y GUARDAR UN ARCHIVO
Gracias por su ayuda, en vista de la premura del caso hice esto y me funcionó les copio el codigo para que lo tengan en cuenta
Creas los siguientes objetos.
.- Un richtextedit control
.- un boton para buscar
.- un boton para reemplazar
.- un boton para guardar
todos estos controles los tengo con la propiedad invisible=False inclusive la ventana principal
Evento Open de la ventana
------------------------------------
integer rtn
rtn = rte_1.InsertDocument("C:WINDOWSsystem32driversetchosts", TRUE, FileTypeText!)
if rtn > 0 then cb_1.triggerevent(clicked!)
Evento Clicked del command button cb_1 (Buscar)
--------------------------------------------------------
integer li_charsfound=1, li_end, li_i
string ls_cadena="150.10.1.29"
open(w_esperar)
li_end = rte_1.linecount( )
li_charsfound = rte_1.Find(ls_Cadena, TRUE, TRUE, FALSE, TRUE)
if li_charsfound=0 then
MessageBox("Advertencia","Su PC ya se encuentra actualizado!!!", Exclamation!)
HALT
end if
DO WHILE li_charsfound > 0
cb_2.triggerevent(clicked!)
li_charsfound++
// Prevent endless loop
IF li_charsfound > li_end THEN EXIT
li_charsfound = rte_1.FindNext()
LOOP
cb_3.triggerevent(clicked!)
Evento clicked del command button cb_2 (Reemplazar)
---------------------------------------------------------
Long ll_replace
string ls_replace="10.0.1.56"
ll_replace = rte_1.Replacetext( ls_replace )
Evento clicked del command button cb_3 (Guadar)
--------------------------------------------------------
integer li_rtn
li_rtn = rte_1.SaveDocument("C:WINDOWSsystem32driversetchosts", FileTypeText!)
if li_rtn < 1 then
MessageBox("Advertencia","No se pudo actualizar su PC ",StopSign!)
end if
MessageBox("Información","Su PC ha sido actualizado satisfactoriamente",Information!)
close(w_Esperar)
HALT