Seleccionar Categoria en pagina web
Publicado: 21 Abr 2015, 20:53
Hola buen dia, estuve buscando en el foro pero no encontre lo que necesito. Aqui va la consulta.
Arme un programa para subir wallpapers a mi web, ya funciona perfecto, ahora me gustaria agregarle un selector de categorias.
En mi web el cuadro de categorias es el siguiente:
se me habia ocurrido algo asi:
Pero me parece que _IEGetObjByValue no es valido.
Como podria adaptar mi programa para que si seleccionan la categoria: Movies (48)
Cuando llegue el proceso de subir el wallpapers a mi web seleccione dicha categoria.
Aca el script de mi programa:
PD: la seccion donde sube el wallpapers a mi web es a partir de :
;===================================
;Subiendo Script a Tolch
;===================================
Arme un programa para subir wallpapers a mi web, ya funciona perfecto, ahora me gustaria agregarle un selector de categorias.
En mi web el cuadro de categorias es el siguiente:
Código: Seleccionar todo
<select class="agregar required" tabindex="5" size="9" style="width:300px;" name="cid">
<option value="" selected="selected" style="color: #000; font-weight: bold; padding: 3px; background:none;">Elegir una categoria</option>
<option value="1" style="background-image:url(http://tolchx.com/themes/AZ-Theme/images/icons/cat/flash.png)">Arquitectura</option>
<option value="2" style="background-image:url(http://tolchx.com/themes/AZ-Theme/images/icons/cat/report.png)">Animales</option>
<option value="34" style="background-image:url(http://tolchx.com/themes/AZ-Theme/images/icons/cat/car.png)">Blanco y Negro</option>
<option value="35" style="background-image:url(http://tolchx.com/themes/AZ-Theme/images/icons/cat/car.png)">Cartoons</option>
<option value="36" style="background-image:url(http://tolchx.com/themes/AZ-Theme/images/icons/cat/car.png)">Celebrities</option>
<option value="37" style="background-image:url(http://tolchx.com/themes/AZ-Theme/images/icons/cat/car.png)">City</option>
<option value="38" style="background-image:url(http://tolchx.com/themes/AZ-Theme/images/icons/cat/car.png)">Computers</option>
<option value="39" style="background-image:url(http://tolchx.com/themes/AZ-Theme/images/icons/cat/car.png)">Cute</option>
<option value="40" style="background-image:url(http://tolchx.com/themes/AZ-Theme/images/icons/cat/car.png)">Elements</option>
<option value="41" style="background-image:url(http://tolchx.com/themes/AZ-Theme/images/icons/cat/car.png)">Food and Drink</option>
<option value="42" style="background-image:url(http://tolchx.com/themes/AZ-Theme/images/icons/cat/car.png)">Funny</option>
<option value="43" style="background-image:url(http://tolchx.com/themes/AZ-Theme/images/icons/cat/car.png)">Games</option>
<option value="44" style="background-image:url(http://tolchx.com/themes/AZ-Theme/images/icons/cat/car.png)">Girls</option>
<option value="45" style="background-image:url(http://tolchx.com/themes/AZ-Theme/images/icons/cat/car.png)">Holidays</option>
<option value="46" style="background-image:url(http://tolchx.com/themes/AZ-Theme/images/icons/cat/car.png)">Love</option>
<option value="47" style="background-image:url(http://tolchx.com/themes/AZ-Theme/images/icons/cat/car.png)">Motors</option>
<option value="48" style="background-image:url(http://tolchx.com/themes/AZ-Theme/images/icons/cat/car.png)">Movies</option>
<option value="49" style="background-image:url(http://tolchx.com/themes/AZ-Theme/images/icons/cat/car.png)">Music</option>
<option value="50" style="background-image:url(http://tolchx.com/themes/AZ-Theme/images/icons/cat/car.png)">Nature</option>
<option value="51" style="background-image:url(http://tolchx.com/themes/AZ-Theme/images/icons/cat/car.png)">Seasons</option>
<option value="52" style="background-image:url(http://tolchx.com/themes/AZ-Theme/images/icons/cat/car.png)">Space</option>
<option value="53" style="background-image:url(http://tolchx.com/themes/AZ-Theme/images/icons/cat/car.png)">Sports</option>
<option value="54" style="background-image:url(http://tolchx.com/themes/AZ-Theme/images/icons/cat/car.png)">Travel</option>
<option value="55" style="background-image:url(http://tolchx.com/themes/AZ-Theme/images/icons/cat/car.png)">Vintage</option>
<option value="56" style="background-image:url(http://tolchx.com/themes/AZ-Theme/images/icons/cat/car.png)">3D</option>
<option value="57" style="background-image:url(http://tolchx.com/themes/AZ-Theme/images/icons/cat/car.png)">Anime</option>
<option value="58" style="background-image:url(http://tolchx.com/themes/AZ-Theme/images/icons/cat/car.png)">Fantasy</option>
<option value="59" style="background-image:url(http://tolchx.com/themes/AZ-Theme/images/icons/cat/car.png)">Motorcycle</option>
<option value="60" style="background-image:url(http://tolchx.com/themes/AZ-Theme/images/icons/cat/car.png)">Meme</option>
<option value="61" style="background-image:url(http://tolchx.com/themes/AZ-Theme/images/icons/cat/car.png)">Beach</option>
<option value="62" style="background-image:url(http://tolchx.com/themes/AZ-Theme/images/icons/cat/car.png)">Others</option>
<option value="63" style="background-image:url(http://tolchx.com/themes/AZ-Theme/images/icons/cat/car.png)">Flowers</option>
</select>
se me habia ocurrido algo asi:
Código: Seleccionar todo
$oSubmit = _IEGetObjByValue($oIE, "6")
_IEAction ($oSubmit, "click")
Como podria adaptar mi programa para que si seleccionan la categoria: Movies (48)
Cuando llegue el proceso de subir el wallpapers a mi web seleccione dicha categoria.
Aca el script de mi programa:
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>
;===================================
;Formulario
;===================================
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("Tolchx.com", 433, 276, 193, 125)
$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", 50, 100, 355, 21)
GUICtrlSetCursor(-1, 5)
$Button1 = GUICtrlCreateButton("Aceptar", 140, 152, 153, 57, 0)
GUICtrlSetCursor(-1, 0)
$Pic1 = GUICtrlCreatePic(@TempDir & "\timage.jpg", -8, -16, 440, 303, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS))
GUISetState(@SW_SHOW)
$Checkbox5 = GUICtrlCreateCheckbox("Derecha", 464, 200, 81, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
;===================================
;Login
;===================================
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
Exit
Case $msg = $Button1
_createtheme()
EndSelect
WEnd
;===================================
;Cuadro Loading
;===================================
#Region ### START Koda GUI section ### Form=
$IeObj = _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($IeObj, -10, 10, 400, 50)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
_IENavigate ($IeObj, "http://www.tolchx.com/img/ajaxloader.gif")
Func _createtheme()
$IeObj = _IECreate("http://userstyles.org/logout", 0, 0)
_IENavigate($IeObj, "http://userstyles.org/login/?view=password", 0x1000)
_IELoadWait($IeObj)
$ieform = _IEFormGetCollection($IeObj, 1)
$nombres = _IEGetObjById($IeObj, "login-existing")
$nombres.value = "user"
$apellidos = _IEGetObjById($IeObj, "password-existing")
$apellidos.value = "pass"
_IEFormSubmit($ieform)
_IELoadWait($IeObj)
_ReplaceStringInFile(@ScriptDir & "\Plantilla.txt", "imagen.jpg", GUICtrlRead($pagina))
$file = FileRead(@ScriptDir & "/plantilla.txt")
$final = _StringBetween($file, "<html>", "</html>")
Sleep(2000)
;===================================
; Cambia a pagina de creacion
;===================================
_IENavigate($IeObj, "http://userstyles.org/styles/new", 0x1000)
_IELoadWait($IeObj)
$Inpshort = _IEGetObjById($IeObj, "style_short_description")
$Inplong = _IEGetObjById($IeObj, "style_long_description")
$Inpcss = _IEGetObjById($IeObj, "css")
$example=_IEGetObjByid($IeObj, "example-url")
;===================================
;Contador aleatorio
;===================================
$LowerLimit = 1
$UpperLimit = 99
$RandomNumber = Random($LowerLimit, $UpperLimit, 1)
;===================================
;Completando Formulario
;===================================
_IEFormElementSetValue($Inpshort, "Wallpapers para Facebook - " & GUICtrlRead($Nombre) & " - " & $RandomNumber)
_IEFormElementSetValue($Inplong, "Imagen subida por: " & GUICtrlRead($creador) & "</br></br> Script Original: style 109959 creado por user 283811, Modificado por : Tolch </br></br></br></br><b>Mas Wallpapers para personalizar Facebook en http://www.Tolchx.com</b>")
_IEFormElementSetValue($Inpcss, $final[0])
_IeFormElementSetValue($example, "http://www.facebook.com/")
;===================================
;Selecciono Checkbox
;===================================
$oShowAllBuildings = _IEGetObjById($IeObj, "license-ccbyncsa")
_IEAction($oShowAllBuildings, "click")
Sleep(500)
$button = _IEGetObjByName($IeObj, "commit")
_IEAction($button, "click")
_IELoadWait($IeObj)
Opt("WinTitleMatchMode", 2)
$IeObj = _IEAttach("userstyles", "WindowTitle") ;miro las ventanas de IE por el título de ventana
$direccion = _IEPropertyGet($IeObj, "locationurl") ;almaceno en la variable la dirección url.
Sleep(2000)
;===================================
;Subiendo Script a Tolch
;===================================
_IENavigate($IeObj, "http://tolchx.com/fotos/agregar.php", 0x1000)
_IELoadWait($IeObj)
$ftitle = _IEGetObjById($IeObj, "ftitle")
$fdesc = _IEGetObjById($IeObj, "fdesc")
$furl = _IEGetObjById($IeObj, "furl")
_IEFormElementSetValue($ftitle, "Wallpapers para Facebook - " & GUICtrlRead($Nombre))
_IEFormElementSetValue($fdesc, $direccion)
_IEFormElementSetValue($furl, GUICtrlRead($pagina))
$button = _IEGetObjByName($IeObj, "new")
_IEAction($button, "click")
;===================================
;Deja plantilla.txt con la imagen.jpg
;===================================
_ReplaceStringInFile(@ScriptDir & "\" & "Plantilla.txt", GUICtrlRead($pagina), "imagen.jpg")
MsgBox(0, "Listo!", "Wallpaper creado con exito :D")
EndFunc ;==>_createtheme
PD: la seccion donde sube el wallpapers a mi web es a partir de :
;===================================
;Subiendo Script a Tolch
;===================================