Página 2 de 2

Re: modificar codigo con programa

Publicado: 14 Mar 2010, 00:55
por iamchavo
jajaja tendre que acostumbrarme a los errores xD.
volvia porque me di cuenta que me falta hacer algo muy importante al programa,la vista previa , estoy armando esa parte para que la gente pueda posicionar la imagen de fondo y los colores de fondo a su gusto,lo que no puedo hacer es poner un cuadro atras de la imagen que cambie segun el color que eligio el usuario, por ejemplo como en estas fotos, ( la parte de atras de la imagen la agrege con el paint)

ImagenImagen

cuando intento poner el cuadro me tapa la imagen, como puedo hacer que sea como las imagenes de arriba? cual seria el comando para que lea los pixeles que cambian en el .swf de elegir colores y que si es verde fluor el color elegido , tambien ponga ese color arriba en el cuadro de la imagen.(para que la persona pueda ver como queda con ese color de fondo).

Código: Seleccionar todo

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <WindowsConstants.au3>
#include <IE.au3>

#Region ### START Koda GUI section ### Form=
$IeObj = _IECreateEmbedded ()
$Form1 = GUICreate("Crear Fondo", 380, 669, 267, -4)
$Checkbox1 = GUICtrlCreateCheckbox("Izquierda", 8, 573, 81, 17)
$Checkbox2 = GUICtrlCreateCheckbox("Arriba", 88, 573, 81, 17)
$Checkbox3 = GUICtrlCreateCheckbox("Centro", 168, 573, 81, 17)
$Checkbox4 = GUICtrlCreateCheckbox("Abajo", 248, 573, 71, 17)
$Checkbox5 = GUICtrlCreateCheckbox("Derecha", 318, 573, 81, 17)
$Button1 = GUICtrlCreateButton("Vista previa", 10, 607, 129, 49, 0)
$Button2 = GUICtrlCreateButton("Aceptar", 237, 608, 129, 49, 0)
$Pic1 = GUICtrlCreatePic("C:\Documents and Settings\LEONIC.WINLEONIC\Escritorio\imagenes\kaka-13.jpg", 28, 52, 324, 156, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUICtrlSetState(-1, $GUI_DISABLE)
$GUIActiveX = GUICtrlCreateObj($IeObj, -10, 260, 430, 260)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

_IENavigate ($IeObj, "http://rateonline.50webs.com/colores.html")


_ReplaceStringInFile(@scriptdir & "\" & "VistaPrevia.html","$ccolor",GUICtrlRead($ccolor))
_ReplaceStringInFile(@scriptdir & "\" & "VistaPrevia.html","$miniimagen",GUICtrlRead($pagina))
_ReplaceStringInFile(@scriptdir & "\" & "VistaPrevia.html","$positionx",GUICtrlRead($Checkbox1),GUICtrlRead($Checkbox2),GUICtrlRead($Checkbox3),GUICtrlRead($Checkbox4),GUICtrlRead($Checkbox5))


While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit
		case $Button1

			Fileopen(@ScriptDir &  "VistaPrevia.html")


	EndSwitch
WEnd

Re: modificar codigo con programa

Publicado: 14 Mar 2010, 20:47
por Chefito
Para poner un marco de un color puedes hacerlo de muchas formas. Yo crearía antes del pic un label un poco mayor, y con la función GUICtrlSetBkColor le cambias el color. Aunque también podrías hacerlo con un graphic......entre otras cosas.
Recuerda que autoit puede crear la ventana de colores por defecto de win gracias a la función _ChooseColor. Utilizando esto no te vas a complicar tanto la vida con ese programa flash cargado de internet.

Aaahhh, y otra cosa. Mira bien los estilos que le pones a los controles (estoy hablando del pic) que puede que te hagan cosas raras si no sabes bien que hacen :smt003 .

Saludos.

Re: modificar codigo con programa

Publicado: 16 Mar 2010, 00:12
por iamchavo
hola chefito ya pude solucionar el tema de elegir el color de fondo, te hice caso y puse el que viene con autoit, fue mucho mas simple.ahora le agrege unos checkbox para que el usuario elija la posicion del fondo.me funciona casi perfecto,pero ahi un problemilla.

sigo con la parte de la vista previa , le agrege unos checkbox para que la gente pueda elegir en que posicion poner el fondo . pero resulta que si selecciono un checkbox (por ejemplo el de center) este cambia la linia $center en un archivo html y le agrega esa posicion a la imagen, hasta aca todo perfecto. el problema es que cuando destildo ese checkbox el html sigue modificado con la posicion de imagen en center , que debo hacer para que cuando lo destilde me deje puesto el $center que tenia al principio?

Código: Seleccionar todo

   InetGet("http://img94.imageshack.us/img94/5972/dibujozbv.jpg",@TempDir&"\timage.jpg")
InetGet(GUICtrlRead($pagina),@TempDir&"\mini.jpg")

Opt('MustDeclareVars', 1)

_Color_Example()

Func _Color_Example()
	Local $GUI, $Btn_RGB, $iMemo, $vistax, $IeObj, $Checkbox_1, $Checkbox_2,$Checkbox_3,$Checkbox_4,$Checkbox_5,$ccolor,$aceptar

	$GUI = GUICreate("_ChooseColor() Example", 400, 410)
	$iMemo = GUICtrlCreateEdit("Copiar Codigo, cambiar (0x) por (#) : 0xFFFFFF", -1, 360, 400, 70)
	GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
	GUICtrlCreatePic(@TempDir&"\mini.jpg", 28, 160, 340, 180, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
    GUICtrlSetState(-1, $GUI_DISABLE)
   $aceptar = GUICtrlCreateButton("Aceptar", 38, 10, 100, 40, 0)
    GUICtrlSetCursor (-1, 0)
	$vistax = GUICtrlCreateButton("Vista Previa", 150, 10, 100, 40, 0)
    GUICtrlSetCursor (-1, 0)
	$Btn_RGB = GUICtrlCreateButton("Color de Fondo", 260, 10, 100, 40)
	GUISetState()
	$ccolor = GUICtrlCreateInput("Pegar Codigo de Color  Ej: #FFFFFF", 86, 90, 225, 21)
    GUICtrlSetCursor (-1, 5)
$Checkbox_3 = GUICtrlCreateCheckbox("Izquierda", -2, 120, 81, 17)
GUICtrlSetBkColor(-1, 0xffffff)
$Checkbox_2 = GUICtrlCreateCheckbox("Arriba", 78, 120, 81, 17)
GUICtrlSetBkColor(-1, 0xffffff)
$Checkbox_1 = GUICtrlCreateCheckbox("Centro", 158, 120, 91, 17)
GUICtrlSetBkColor(-1, 0xffffff)
$Checkbox_4 = GUICtrlCreateCheckbox("Abajo", 248, 120, 71, 17)
GUICtrlSetBkColor(-1, 0xffffff)
$Checkbox_5 = GUICtrlCreateCheckbox("Derecha", 318, 120, 90, 17)
GUICtrlSetBkColor(-1, 0xffffff)

GUICtrlCreatePic(@TempDir&"\timage.jpg", -8, -16, 430, 153,BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))

	While 1
		Switch GUIGetMsg()
			Case $GUI_EVENT_CLOSE
				Exit
		    Case $Checkbox_1 
		         _ReplaceStringInFile(@scriptdir & "\" & "VistaPrevia.html","$Checkbox_1","center")
			Case $Checkbox_2
		         _ReplaceStringInFile(@scriptdir & "\" & "VistaPrevia.html","$Checkbox_2","top")
			Case $Checkbox_3
		         _ReplaceStringInFile(@scriptdir & "\" & "VistaPrevia.html","$Checkbox_3","left")
			Case $Checkbox_4
		         _ReplaceStringInFile(@scriptdir & "\" & "VistaPrevia.html","$Checkbox_4","bottom")
			Case $Checkbox_5
		         _ReplaceStringInFile(@scriptdir & "\" & "VistaPrevia.html","$Checkbox_5","right")
		     Case $vistax
         _ReplaceStringInFile(@scriptdir & "\" & "VistaPrevia.html","$ccolor",GUICtrlRead($ccolor))
			Case $Btn_RGB
				_ShowChoice($GUI, $iMemo, 2, _ChooseColor(2, 0x0080C0, 2, $GUI), "Copiar Codigo, cambiar (0x) por (#) : ")
			
				
		EndSwitch
	WEnd
EndFunc   ;==>_Color_Example

Func _ShowChoice($GUI, $iMemo, $Type, $Choose, $sMessage)
	Local $cr
	If $Choose <> -1 Then
		
		If $Type = 0 Then ; convert COLORREF to RGB for this example
			$cr = Hex($Choose, 6)
			GUISetBkColor('' & StringMid($cr, 5, 2) & StringMid($cr, 3, 2) & StringMid($cr, 1, 2), $GUI)
		Else
			GUISetBkColor($Choose, $GUI)
		EndIf
		
		GUICtrlSetData($iMemo, $sMessage & $Choose & @CRLF, 1)

	Else
		GUICtrlSetData($iMemo, "User Canceled Selction" & @CRLF, 1)
	EndIf
	
EndFunc   ;==>_ShowChoice

While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit
		
		ExitLoop
	EndSwitch
WEnd
   
   

solo me falta esto que acabo de mensionar para terminarlo ,y si me podrias decir con que comando copio la url que este puesta en ie ,porque busque en la ayuda y no encontre :( . osea ahi una parte del programa que tiene que copiar la url que este puesta y despues pegarla en un .txt

_ReplaceStringInFile(@scriptdir & "\" & "post.txt","$ieurl",GUICtrlRead($url))


los estilos del control pic los puse porque si los sacaba no me aparecia la foto xD ,entonces preferi dejarlos puestos por las dudas , que hacen :O?

espero tu respuesta con ansias chefito jaja :)

quiero terminarlo de una veeez XD , saluudos :D

Re: modificar codigo con programa

Publicado: 16 Mar 2010, 00:21
por iamchavo
me estoy alegrando muchoo jajaja ya pude resolverlo , le agrege por ejemplo

Case $Checkbox_1
If GUICtrlRead($Checkbox_1) = 1 Then ;
_ReplaceStringInFile(@scriptdir & "\" & "VistaPrevia.html","$Checkbox_1","center")
Else
_ReplaceStringInFile(@scriptdir & "\" & "VistaPrevia.html","center","$Checkbox_1")
EndIf


solo me falta lo de copiar la url :D

y un detalle mas xD, cuando apreto el boton de vista previa no me abre el archivo VistaPrevia.html que se encuentra en la misma carpeta. Lo tengo puesto de esta manera.

Case $Vistap
Fileopen(@scriptdir & "\" & "VistaPrevia.html",1)

saludoos :)

Re: modificar codigo con programa

Publicado: 16 Mar 2010, 17:02
por Chefito
Me alegro de que vayais solucionando vosotros solos los problemas. Esto significa que os esforzais y que buscais más :smt023 .
Pero tu forma de tratar el problema del checkbox no es absolutamente correcta :smt003 . Tanquilo, yo también me equivoqué en esto. No tiene mucha importancia pero como yo digo (pero a lo mejor te falla en algún momento), las cosas bien hechas bien hechas están :smt002 . Mira este enlace de Ximorro donde el lo explica mejor que yo: http://www.emesn.com/autoitforum/viewto ... 1732#p5638

Una forma de capturar la url del ie es esta:

Código: Seleccionar todo

$url=_IEPropertyGet ($oIE, "locationurl")
Mira en la ayuda el primer ejemplo de la función _IEAttach y te aclarará más la duda.

FileOpen es para abrir un archivo en modo lectura o escritura. Digamos que es para trabajar con los datos que contiene el archivo. Yo creo que tu lo que quieres es mostrar una página web no?
Una forma puede ser esta:

Código: Seleccionar todo

run("explorer "& @scriptdir & "\getdate.htm")
Otra:

Código: Seleccionar todo

_IECreate(@scriptdir & "\getdate.htm")
Y muchas más :smt005 .

Saludos.

Re: modificar codigo con programa

Publicado: 17 Mar 2010, 05:21
por iamchavo
:D ya lo tengo andando , pero tengo un problema que me produce muchos errores cada sierto tiempo, y es con los checkbox, mire lo que me pasastes de ximorro pero no logre entender como adaptar lo que dice, a mi script.
me darias una mano con eso pliz.

Código: Seleccionar todo

Case $Checkbox_1
If GUICtrlRead($Checkbox_1) = 1 Then ;
_ReplaceStringInFile(@scriptdir & "\" & "VistaPrevia.html","$Checkbox_1","center")
Else
_ReplaceStringInFile(@scriptdir & "\" & "VistaPrevia.html","center","$Checkbox_1")
EndIf
como lo modifico al ejemplo de ximorro? :smt088

cuando estoy usando los checkbox muchas veces no cambia la linea o no vuelve a su estado anterior ,eso me trae muchisimos problemas

grax por ayudarme con este programa :D

saluuudos

Re: modificar codigo con programa

Publicado: 17 Mar 2010, 11:39
por Ximorro
Hola iamchavo, ¿has leído más abajo en aquél post la funcioncita que uso para hacerlo más cómodamente?

Añade esta función:

Código: Seleccionar todo

Func  _chkIsChecked($chk)
	Return BitAnd(GUICtrlRead($chk),$GUI_CHECKED) = $GUI_CHECKED
EndFunc
Ahora para comprobar si un checkbox está activo la usas directamente, cambia
If GUICtrlRead($Checkbox_1) = 1 Then
por
If _chkIsChecked($Checkbox_1) Then

Lo demás no lo he mirado, de web no programo mucho. Esto es exclusivamente la parte del checkbox, lo llevo usando tiempo y nunca me ha fallado.

Re: modificar codigo con programa

Publicado: 18 Mar 2010, 01:15
por iamchavo
hola ximorro grax por responder :) , intente lo que me dijistes pero algo estoy haciendo mal :(

cuando quiero probar me marca un error señalandome esta linea Func _chkIsChecked($chk)
en el script la parte de _chkIsChecked me aparece en negro, no en color como todas las demas palabras.
otra duda que tengo es:
vistes que me dijistes de sustituir

If GUICtrlRead($Checkbox_1) = 1 Then
por
If _chkIsChecked($Checkbox_1) Then

me tendria que quedar asi?

Func _chkIsChecked($chk)
Return BitAnd(GUICtrlRead($chk),$GUI_CHECKED) = $GUI_CHECKED
EndFunc


While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
Case $Checkbox_1

If _chkIsChecked($Checkbox_1) Then;
_ReplaceStringInFile(@scriptdir & "\" & "VistaPrevia.html","$Checkbox_1","center")
Else
_ReplaceStringInFile(@scriptdir & "\" & "VistaPrevia.html","center","$Checkbox_1")
EndIf

EndSwitch
WEnd
EndFunc

Re: modificar codigo con programa

Publicado: 18 Mar 2010, 09:30
por Ximorro
Si te da error en esa línea y no te la está coloreando bien, podría ser que hay algo que está mal antes, por eso el "coloreador" no se aclara.
La línea no tiene errores, vaya, yo uso esa función sin problemas y sólo he hecho copy-paste.
Otro problema sería que ya tengas una función que se llame así, pero no creo.

Si tu código es el que pones abajo, lo mejor será que pongas las funciones debajo del código principal, no antes ni en medio, quizás sea por eso.
Después del Then hay un ; que sobra (no creo que haga daño pues es un comentario vacío pero como sobra mejor lo quitas y menos cosas que puedan dar problemas).

¿Por qué hay un EndFunc al final? Si ese código forma parte de una función, definitivamente mi función tiene que estar fuera de ella, no se pueden anidad definiciones de funciones.
Si es el código principal y no se trata de ninguna función, quita ese EndFunc (y mi función la pones debajo de eso).

A ver cómo va...

Re: modificar codigo con programa

Publicado: 20 Mar 2010, 20:42
por iamchavo
muchisimas gracias por su ayuda , en este proyecto aprendi bastantes cosas neuvas :) , pude terminar el programa, ahi cosas que podria simplificarse muchisimo, pero como no las podia hacer andar me las tube que ingeniar de otra manera :smt005 . En fin , aca dejo como quedo el programilla terminado :)

Código: Seleccionar todo

#include <File.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <String.au3>
#include <IE.au3>
#include <StaticConstants.au3>
#include <Misc.au3>

InetGet("http://www.criteriondg.info/wordpress/wp-content/themes/criterion/images/walls/33.jpg",@TempDir&"\timage.jpg")

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("FBlook.com.ar", 433, 286, 193, 135)
$creador = GUICtrlCreateInput("Tu Nombre", 110, 24, 225, 21)
GUICtrlSetCursor (-1, 5)
$Nombre = GUICtrlCreateInput("Nombre de la imagen", 110, 56, 225, 21)
GUICtrlSetCursor (-1, 5)
$pagina = GUICtrlCreateInput("URL de la imagen ,Ej: http://wallpapers.com/imagen.jpg", 50, 100, 355, 21)
GUICtrlSetBkColor(-1, 0xF0F0F0)
GUICtrlSetCursor (-1, 5)
$desc = GUICtrlCreateEdit("Descripcion , cual es el tema de la imagen?", 50, 130, 355, 100)
GUICtrlSetBkColor(-1, 0xF0F0F0)
GUICtrlSetData(-1, "Descripcion , cual es el tema de la imagen?")
GUICtrlSetCursor (-1, 5)
$Button1 = GUICtrlCreateButton("Aceptar", 300, 242, 103, 37, 0)
GUICtrlSetCursor (-1, 0)
$wiki = GUICtrlCreateButton("Wikipedia", 50, 242, 103, 37, 0)
GUICtrlSetCursor (-1, 0)
$Pic1 = GUICtrlCreatePic(@TempDir&"\timage.jpg", -8, -16, 440, 303,BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

   FileDelete(@scriptdir & "\" & "/plugins/VistaPrevia.html")
FileDelete(@scriptdir & "\" & "/plugins/plantilla.txt")
FileDelete(@ScriptDir &  "/plugins/post.txt")
sleep(1000)

$files4 = FileRead(@ScriptDir &  "/plugins/vpo.chx")
   $final4 = _StringBetween($files4, "<html1>", "</html2>")
   
   FileWrite(@ScriptDir &  "/plugins/VistaPrevia.html", $final4[0])
;===================================
;Entrando a la cuenta de Userstyles
;===================================

$IeObj=_IECreate("http://userstyles.org/styles/new",1,0)
$ieform=_IEFormGetCollection($IeObj,1)
$InpUs=_IEGetObjByName($ieform, "login-existing")
$InpPass=_IEGetObjByName($ieform, "password")
_IeFormElementSetValue($InpUs, "xxxxx")
_IeFormElementSetValue($InpPass, "xxxxx")
_IeLoadWait($IeObj)
_IEFormSubmit($ieform)
_IeLoadWait($IeObj)
sleep(1000)

while 1
	
	$msg = GUIGetMsg()
	Select
		Case $msg = $GUI_EVENT_CLOSE
			Exit
		 Case $msg = $wiki
         _IECreate("http://es.wikipedia.org/")
		 
		 
        Case $msg = $Button1
         _ReplaceStringInFile(@scriptdir &  "/plugins/VistaPrevia.html","$miniimagen",GUICtrlRead($pagina))
		 GUISetState(@SW_HIDE)
		 exitloop
EndSelect
   wend
   

;===================================
;Programa vista previa
;===================================
   InetGet("http://img94.imageshack.us/img94/5972/dibujozbv.jpg",@TempDir&"\timage.jpg")
InetGet(GUICtrlRead($pagina),@TempDir&"\mini.jpg")


#Region ### START Koda GUI section ### Form=

	$GUI = GUICreate("Propiedades del fondo", 400, 410, 193, 135)
	$iMemo = GUICtrlCreateEdit("", -1, 360, 400, 70)
	GUICtrlSetFont($iMemo, 10, 400, 0, "Propiedades del fondo")
	GUICtrlCreatePic(@TempDir&"\mini.jpg", 28, 160, 340, 180, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
    GUICtrlSetState(-1, $GUI_DISABLE)
    $aceptar = GUICtrlCreateButton("Aceptar", 38, 10, 100, 40, 0)
    GUICtrlSetCursor (-1, 0)
	$vistax = GUICtrlCreateButton("Vista Previa", 150, 10, 100, 40, 0)
    GUICtrlSetCursor (-1, 0)
	$Btn_RGB = GUICtrlCreateButton("Color de Fondo", 260, 10, 100, 40)
	GUISetState()
	$Ccolor = GUICtrlCreateInput("Pega el Codigo de color aca Ej: #FFFFFF", 84, 60, 225, 21)
    GUICtrlSetCursor (-1, 5)
	GUISetState(@SW_SHOW)
	#EndRegion ### END Koda GUI section ###{
	


;===================================
;tabla de color
;===================================
	Func _ShowChoice($GUI, $iMemo, $Type, $Choose, $sMessage)
	Local $cr
	If $Choose <> -1 Then
		
		If $Type = 0 Then ; convert COLORREF to RGB for this example
			$cr = Hex($Choose, 6)
			GUISetBkColor('' & StringMid($cr, 5, 2) & StringMid($cr, 3, 2) & StringMid($cr, 1, 2), $GUI)
		Else
			GUISetBkColor($Choose, $GUI)
		EndIf
		
		GUICtrlSetData($iMemo, $sMessage & $Choose & @CRLF, 1)

	Else
		GUICtrlSetData($iMemo, "User Canceled Selction" & @CRLF, 1)
	EndIf
	
EndFunc   ;==>_ShowChoice


;===================================
;crear archivos
;===================================

 

$file1= FileRead(@ScriptDir &  "/plugins/po.chx")
   $final1 = _StringBetween($file1, "<html>", "</html>")
   
   FileWrite(@ScriptDir &  "/plugins/plantilla.txt", $final1[0])
   
     $file3= FileRead(@ScriptDir &  "/plugins/eo.chx")
   $final3 = _StringBetween($file3, "<html>", "</html>")
   
   FileWrite(@ScriptDir &  "/plugins/post.txt", $final3[0])
;===================================
;CheckBox
;===================================

_Color_Example()

Func _Color_Example()
	Local $IeObj, $Checkbox_1, $Checkbox_2,$Checkbox_3,$Checkbox_4,$Checkbox_5,$Checkbox_6,$Checkbox_7,$Checkbox_9,$Checkbox_10

$Checkbox_1 = GUICtrlCreateCheckbox("Centro", 150, 120, 88, 17)
GUICtrlSetBkColor(-1, 0xffffff)
$Checkbox_2 = GUICtrlCreateCheckbox("Arriba", 68, 120, 81, 17)
GUICtrlSetBkColor(-1, 0xffffff)
$Checkbox_3 = GUICtrlCreateCheckbox("Izquierda", -2, 120, 69, 17)
GUICtrlSetBkColor(-1, 0xffffff)
$Checkbox_4 = GUICtrlCreateCheckbox("Abajo", 240, 120, 77, 17)
GUICtrlSetBkColor(-1, 0xffffff)
$Checkbox_5 = GUICtrlCreateCheckbox("Derecha", 318, 120, 90, 17)
GUICtrlSetBkColor(-1, 0xffffff)
$Checkbox_6 = GUICtrlCreateCheckbox("Repetir en  X", 68, 90, 81, 17)
GUICtrlSetBkColor(-1, 0xffffff)
$Checkbox_7 = GUICtrlCreateCheckbox("Repetir en  Y",240, 90, 81, 17 )
GUICtrlSetBkColor(-1, 0xffffff)
$Checkbox_9 = GUICtrlCreateCheckbox("No repetir", 150, 90, 88, 17)
GUICtrlSetBkColor(-1, 0xffffff)
$Checkbox_10 = GUICtrlCreateCheckbox("Color", 315, 60, 44, 17)
GUICtrlSetBkColor(-1, 0xffffff)
GUICtrlCreatePic(@TempDir&"\timage.jpg", -8, -16, 430, 153,BitOR($SS_NOTIFY,$WS_CLIPSIBLINGS))




	While 1
		Switch GUIGetMsg()
			Case $GUI_EVENT_CLOSE
				Exit
		
			   
		    Case $Checkbox_1 
		
				 If GUICtrlRead($Checkbox_1) = 1 Then ;
		         _ReplaceStringInFile(@scriptdir & "\" & "/plugins/VistaPrevia.html","$Checkbox_1","center")
				  _ReplaceStringInFile(@scriptdir & "\" & "/plugins/plantilla.txt","$Checkbox_1","center")
			      Else
				 _ReplaceStringInFile(@scriptdir & "\" & "/plugins/VistaPrevia.html","center","$Checkbox_1")
				 _ReplaceStringInFile(@scriptdir & "\" & "/plugins/plantilla.txt","center","$Checkbox_1")
				 EndIf

			Case $Checkbox_2 
				 If GUICtrlRead($Checkbox_2) = 1 Then ;
		         _ReplaceStringInFile(@scriptdir & "\" & "/plugins/VistaPrevia.html","$Checkbox_2","top")
				  _ReplaceStringInFile(@scriptdir & "\" & "/plugins/plantilla.txt","$Checkbox_2","top")
			      Else
				 _ReplaceStringInFile(@scriptdir & "\" & "/plugins/VistaPrevia.html","top","$Checkbox_2")
				 _ReplaceStringInFile(@scriptdir & "\" & "/plugins/plantilla.txt","top","$Checkbox_2")
			     EndIf
			 
			Case $Checkbox_3
				 If GUICtrlRead($Checkbox_3) = 1 Then ;
		         _ReplaceStringInFile(@scriptdir & "\" & "/plugins/VistaPrevia.html","$Checkbox_3","left")
				 _ReplaceStringInFile(@scriptdir & "\" & "/plugins/plantilla.txt","$Checkbox_3","left")
			      Else
				 _ReplaceStringInFile(@scriptdir & "\" & "/plugins/VistaPrevia.html","left","$Checkbox_3")
				  _ReplaceStringInFile(@scriptdir & "\" & "/plugins/plantilla.txt","left","$Checkbox_3")
			 EndIf
			 
			Case $Checkbox_4
				 If GUICtrlRead($Checkbox_4) = 1 Then ;
		         _ReplaceStringInFile(@scriptdir & "\" & "/plugins/VistaPrevia.html","$Checkbox_4","bottom")
				 _ReplaceStringInFile(@scriptdir & "\" & "/plugins/plantilla.txt","$Checkbox_4","bottom")

			      Else
				 _ReplaceStringInFile(@scriptdir & "\" & "/plugins/VistaPrevia.html","bottom","$Checkbox_4")
				 _ReplaceStringInFile(@scriptdir & "\" & "/plugins/plantilla.txt","bottom","$Checkbox_4")
			 EndIf
			 
				Case $Checkbox_5
				 If GUICtrlRead($Checkbox_5) = 1 Then ;
		         _ReplaceStringInFile(@scriptdir & "\" & "/plugins/VistaPrevia.html","$Checkbox_5","right")
				 _ReplaceStringInFile(@scriptdir & "\" & "/plugins/plantilla.txt","$Checkbox_5","right")
			      Else
				 _ReplaceStringInFile(@scriptdir & "\" & "/plugins/VistaPrevia.html","right","$Checkbox_5")
				 _ReplaceStringInFile(@scriptdir & "\" & "/plugins/plantilla.txt","right","$Checkbox_5")
			 EndIf
			 
			Case $Checkbox_6
				 If GUICtrlRead($Checkbox_6) = 1 Then ;
		         _ReplaceStringInFile(@scriptdir & "\" & "/plugins/VistaPrevia.html","$Checkbox_6","repeat-x")
				 _ReplaceStringInFile(@scriptdir & "\" & "/plugins/plantilla.txt","$Checkbox_6","repeat-x")
			      Else
				 _ReplaceStringInFile(@scriptdir & "\" & "/plugins/VistaPrevia.html","repeat-x","$Checkbox_6")
				_ReplaceStringInFile(@scriptdir & "\" & "/plugins/plantilla.txt","repeat-x","$Checkbox_6")
			 EndIf
			 
			 Case $Checkbox_7
				 If GUICtrlRead($Checkbox_7) = 1 Then ;
		         _ReplaceStringInFile(@scriptdir & "\" & "/plugins/VistaPrevia.html","$Checkbox_7","repeat-y")
				 _ReplaceStringInFile(@scriptdir & "\" & "/plugins/plantilla.txt","$Checkbox_7","repeat-y")
			      Else
				 _ReplaceStringInFile(@scriptdir & "\" & "/plugins/VistaPrevia.html","repeat-y","$Checkbox_7")
				  _ReplaceStringInFile(@scriptdir & "\" & "/plugins/plantilla.txt","repeat-y","$Checkbox_7")
			 EndIf
			 
			 Case $Checkbox_9
				 If GUICtrlRead($Checkbox_9) = 1 Then ;
		         _ReplaceStringInFile(@scriptdir & "\" & "/plugins/VistaPrevia.html","$Checkbox_9","no-repeat")
				  _ReplaceStringInFile(@scriptdir & "\" & "/plugins/plantilla.txt","$Checkbox_9","no-repeat")
			      Else
				 _ReplaceStringInFile(@scriptdir & "\" & "/plugins/VistaPrevia.html","no-repeat","$Checkbox_9")
				 _ReplaceStringInFile(@scriptdir & "\" & "/plugins/plantilla.txt","no-repeat","$Checkbox_9")
			 EndIf
			 
			 Case $Checkbox_10
				 If GUICtrlRead($Checkbox_10) = 1 Then ;
		         _ReplaceStringInFile(@scriptdir & "\" & "/plugins/VistaPrevia.html","$Checkbox_10",GUICtrlRead($Ccolor))
			      Else
				 _ReplaceStringInFile(@scriptdir & "\" & "/plugins/VistaPrevia.html",GUICtrlRead($Ccolor),"$Checkbox_10")
			 EndIf
			 
			 	Case $Btn_RGB
				_ShowChoice($GUI, $iMemo, 2, _ChooseColor(2, 0x0080C0, 2, $GUI), "Copiar el Codigo Arriba, cambia (0x) por (#) :  ")
				
				Case $vistax
		       _IECreate(@scriptdir & "/plugins/VistaPrevia.html")
			  
		  Case $aceptar
			  GUISetState(@SW_HIDE)
		       exitloop
		EndSwitch
	WEnd
EndFunc   ;==>_Color_Example


;===================================
;loading cuadro
;===================================

#Region ### START Koda GUI section ### Form=
$IeObjj = _IECreateEmbedded ()
$Form2 = GUICreate("Subiendo Fondo", 225, 90, 300, 305)
GUISetBkColor(0xFFFFFF)
$Label2 = GUICtrlCreateLabel(" CARGANDO....", 56, 70, 274, 16)
GUICtrlSetFont(-1, 8, 400, 0, "WST_Swed")
GUICtrlSetColor(-1, 0x99B4D1)
$GUIActiveX = GUICtrlCreateObj($IeObjj, -10, 10, 400, 50)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

_IENavigate ($IeObjj, "http://img100.imageshack.us/img100/2134/ajaxloader.gif")


;===================================
;modificando  y subiendo script
;===================================


$Inpshort=_IEGetObjByid($IeObj, "style_short_description")
$Inplong=_IEGetObjByName($IeObj, "style_long_description")
$Inpcss=_IEGetObjByid($IeObj, "css")

 _ReplaceStringInFile(@scriptdir & "\" & "/plugins/Plantilla.txt","$Ccolor",GUICtrlRead($Ccolor))
sleep(200)
_ReplaceStringInFile(@scriptdir & "\" & "/plugins/Plantilla.txt","xxx",GUICtrlRead($pagina))
sleep(200)
_ReplaceStringInFile(@scriptdir & "\" & "/plugins/Plantilla.txt","$Checkbox_1"," ")
sleep(200)
_ReplaceStringInFile(@scriptdir & "\" & "/plugins/Plantilla.txt","$Checkbox_2"," ")
sleep(200)
_ReplaceStringInFile(@scriptdir & "\" & "/plugins/Plantilla.txt","$Checkbox_3"," ")
sleep(200)
_ReplaceStringInFile(@scriptdir & "\" & "/plugins/Plantilla.txt","$Checkbox_4"," ")
sleep(200)
_ReplaceStringInFile(@scriptdir & "\" & "/plugins/Plantilla.txt","$Checkbox_5"," ")
sleep(200)
_ReplaceStringInFile(@scriptdir & "\" & "/plugins/Plantilla.txt","$Checkbox_6"," ")
sleep(200)
_ReplaceStringInFile(@scriptdir & "\" & "/plugins/Plantilla.txt","$Checkbox_7"," ")
sleep(200)
_ReplaceStringInFile(@scriptdir & "\" & "/plugins/Plantilla.txt","$Checkbox_9"," ")
sleep(200)
_ReplaceStringInFile(@scriptdir & "\" & "/plugins/Plantilla.txt","$Checkbox_10"," ")
sleep(200)
  $file = FileRead(@ScriptDir &  "/plugins//plantilla.txt")
   $final = _StringBetween($file, "<html1>", "</html2>")
  sleep(2000)
  
  $LowerLimit = 1

$UpperLimit = 99

$RandomNumber = Random($LowerLimit,$UpperLimit,1)

_IeFormElementSetValue($Inpshort, "Facebook - " & GUICtrlRead($Nombre) &  " - FBlook.com.ar - "& $RandomNumber)
_IeFormElementSetValue($Inplong, "Fondo subido por: "& GUICtrlRead($creador) & " - Administrador :Chavo Toledo")
_IeFormElementSetValue($Inpcss,$final[0])
sleep(5000)

$edicion=_IEGetObjByname($IeObj,"commit")
$edicion.click
_IeLoadWait($IeObj)
sleep(1000)

 $s_Dir = _IEPropertyGet($IeObj,"locationurl")
      ConsoleWrite($s_Dir & @CRLF)
	  
While 1
$urlX = "http://userstyles.org/styles/create"

   If $urlX=$s_Dir Then 
   
   MsgBox(0,"Atencion", "Se produjo un error ,intenta devuelta") 
  Else
   exitloop
  EndIf
   wend

sleep(1000)

$urlx =_IEPropertyGet ($IeObj, "locationurl")

sleep(1000)
;===================================
;Entrando a blogger
;===================================
_IENavigate ($IeObj, "http://www.blogger.com/post-create.g?blogID=2604389951685807523&pli=1")
$ieform=_IEFormGetCollection($IeObj,1)
$InpUs=_IEGetObjByName($ieform, "Email")
$InpPass=_IEGetObjByName($ieform, "Passwd")
_IeFormElementSetValue($InpUs, "xxxxx")
_IeFormElementSetValue($InpPass, "xxxxx")
_IeLoadWait($IeObj)
_IEFormSubmit($ieform)
_IeLoadWait($IeObj)

;===================================
;Posteando
;===================================

$edicion=_IEGetObjById($IeObj,"ShowSourceEditor")
$edicion.click

  sleep(10000)
  
  $titlee=_IEGetObjByName($IeObj, "title")
   $labels=_IEGetObjByName($IeObj, "post-labels")
_IeFormElementSetValue($titlee, "Fondo para Facebook - " & GUICtrlRead($Nombre) & " -")
_IeFormElementSetValue($labels, "Creados por los usuarios")

_ReplaceStringInFile(@scriptdir & "\" & "/plugins/post.txt","$descripcion",GUICtrlRead($desc))
_ReplaceStringInFile(@scriptdir & "\" & "/plugins/post.txt","$miniimagen",GUICtrlRead($pagina))
_ReplaceStringInFile(@scriptdir & "\" & "/plugins/post.txt","$script",$urlx)

$file2 = FileRead(@ScriptDir &  "/plugins/post.txt")
   $final2 = _StringBetween($file2, "<brr1>", "<brr2>")
   sleep(500)
   $postbodyx=_IEGetObjByid($IeObj, "textarea")
_IeFormElementSetValue($postbodyx,$final2[0])
   sleep(1000)
$edicion=_IEGetObjById($IeObj,"publishButton")
$edicion.click
_IeLoadWait($IeObj)
;===================================
;Restaurando 
;===================================

  WinClose("Subiendo Fondo", "")
WinClose("Blogger: Fondos para Facebook - Estado de publicación - Windows Internet Explorer", "")

MsgBox(0,"Afirmativo", "Fondo subido con exito :D")

   FileClose($Form2)
   FileDelete(@scriptdir & "\" & "/plugins/VistaPrevia.html")
FileDelete(@scriptdir & "\" & "/plugins/plantilla.txt")
FileDelete(@scriptdir & "\" & "/plugins/post.txt")



While 1

	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit

EndSwitch

WEnd


Una pregunta , tengo que copiar todo lo que este entre href= y >[Edit] de una pagina .

en el html la linea seria asi <a class="edit-link" href="/styles/24072/edit">[Edit]</a> , lo que quiero es copiar todos los /styles/24072/edit que se repiten en el html.pero teniendo en cuenta que en cada uno el numero 24072 cambia , arme un script .

Código: Seleccionar todo

$IeObj=_IECreate("http://userstyles.org/users/37514",1,1)
$ieform=_IEFormGetCollection($IeObj,1)
$InpUs=_IEGetObjByName($ieform, "login-existing")
$InpPass=_IEGetObjByName($ieform, "password")
_IeFormElementSetValue($InpUs, "xxxxxx")
_IeFormElementSetValue($InpPass, "xxxxxx")
_IeLoadWait($IeObj)
_IEFormSubmit($ieform)
_IeLoadWait($IeObj)
sleep(2000)

$sHTM = _IEDocReadHTML ($IeObj)

 $final = _StringBetween($sHTM, "href=", ">[Edit]")
 
 
   FileWrite("editscript.txt", $final[0])

pero me aparece esto :

Imagen


cual seria el problema?



saluuudooos :D

Re: modificar codigo con programa

Publicado: 22 Mar 2010, 00:43
por Chefito
El primer problema es que el código html de la página con la que trabajas no tiene el texto ">[Edit]", por eso el array está vacia. No encuentra nada.
Y otra cosa, debes recorrer todo el array para sacar todos los elementos encontrados. Así solo tendrás el elemento 0.

Pero lo estás enfocando mal. Para sacar links de una página, tienes que utilizar la función _IELinkGetCollection. Con la propiedad href del objeto link obtienes el url del link. Mira el ejemplo en la ayuda que es casi lo que necesitas. Si quieres condicionar que un link tenga que tener algún texto en concreto para que sea válido, puedes utilizar una condición (if...then) y la función stringinstr para ver si contiene ese trozo de texto.

Saludos.

Re: modificar codigo con programa

Publicado: 22 Mar 2010, 03:17
por iamchavo
ya lo solucione medio a lo indio :P , consegui guardar todos los links en un bloc de notas pero estaban todos uno al lado del otro y los necesitaba uno debajo del otro ,entonces copie la parte "http://" de la url y puse remplazar todo por " " ( espacios) y me quedaron alineados xD jajaja