Menú

Mostrar Mensajes

Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.

Mostrar Mensajes Menú

Mensajes - Eleкtro

#10081
Cita de: kub0x en 19 Noviembre 2012, 08:47 AMbuscas cambiar el valor de alguna propiedad guardada en my.settings o simplemente hacer comprobaciones con éstas? Sería mejor que fueras más claro : p

Verás, pienso usar el ejemplo que me has proporcionado, eso sin duda, pero esto lo necesito hacer tanto para tu ejemplo como para el mío




En mi ejemplo de arriba, creo nuevos checkboxes y les proporciono un nombre:
newCheckBox.Name = "checkbox" & List.ToString()

El nombre final de cada checkbox es: "checkbox1", "checkbox2", "checkbox3", etc...

En my-settings los nombres que tengo son:
checkbox1
checkbox2
checkbox3
etc...

(Cada uno con el scope "user", y con el valor de "Y" o "N".)

En resumen, los nombres de los nuevos checkboxes y los nombres de my.settings son exactamente igual, eso lo hice para poder referenciarme mejor a "my.settings" basandome en el nombre de los nuevos checkboxes, pero no lo he conseguido xD.

Por ejemplo:

Código (vb) [Seleccionar]
Panel1.Controls.Add(newCheckBox)
newCheckBox.Name = "checkbox" & List.ToString()


Eso se llamará checkbox1, pues quisiera crear una nueva entrada (o reemplazar una ya existente con el mismo nombre) en my.settings, que tenga el mismo nombre que el "checkbox.Name", y poder obetener el valor de esa entrada.

Osea, crear la entrada "checkbox1" en my.settings, y obtener el valor de "checkbox1" en my-settings, las dos cosas necesitaría,pero sobretodo obtener el valor...

Yo se obtener y guardar valores en my.settings, pero no se hacerlo cuando el nombre que le intento dar al "my.settings" es el objeto "newCheckBox.Name = "checkbox" & List.ToString()"
Si uso "My.settings.newCheckBox.Name" me dice que no es un string, con toda la razón xD.

Muchas gracias por tu tiempo Kubox!


#10082

Hombre, es un tema delicado teniendo en cuenta que el ejecutable/carpeta en realidad podría tener cualquier nombre modificado, en ese caso yo buscaría el nombre "virtualdub.exe" o "vdub.exe" (No recuerdo como era) en TODO el disco duro,
Pero por otro lado es muy retorcido que alguien le vaya a cambiar el nombre... así que voy a guiarme por tu script.

El script está bien, y veo progresos por tu parte porque no hay nada mal en el código, por otro lado es un código más sencillo de los que solias tener dudas xD.

CitarMi duda mas bien es para optimizar el codigo a algo que seguramente se pueda hacer mas sencillo que todo el codigo que he usado,
El script se puede optimizar insignificativamente saltando la parte "x86" si el equipo es de 64 bit, pero eso no lo voy a hacer.
Se puede simplificar todo en general, mucho, haciendo un mejor uso de la sintaxis, operadores y argumentos, se puede simplificar tanto que me ha salido una función xD:

Código (dos) [Seleccionar]
@echo off
REM By Elektro H@cker

:: Modo de empleo:
Call :APPSearch "Virtual Dub Mod"
REM Echo %Errorlevel% | MORE

Call :APPSearch "Programa inexistente"
REM Echo %Errorlevel% | MORE

Pause&Exit
:: : :: :: :: :: :: :: :: :: :: :: ::

:APPSearch
(
DIR /B /AD "%PROGRAMFILES%\%~1"      >NUL 2>&1 && SET "PF=%PROGRAMFILES%" || (
DIR /B /AD "%PROGRAMFILES(x86)%\%~1" >NUL 2>&1 && SET "PF=%PROGRAMFILES(x86)%")
) && (
Echo %~1 esta instalado en:
Call Echo "%%PF%%\%~1"
Exit /B 0
) || (
Echo %~1 no esta instalado.
Exit /B 1
)
GOTO:EOF




Saludos
#10083
Cita de: kub0x en 18 Noviembre 2012, 20:41 PM

Espero haberte servido de ayuda!

Saludos!

Increible, muchísimas gracias Kubox

Mi intención era que al cargar la app saliesen 1 textbox por cada X carpeta previamente bindeada, y he conseguido "dibujar" los textboxs hace unos minutos así:

Código (vbnet) [Seleccionar]
 Public Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
       playertextbox.Text = My.Settings.playerpath
       foldertextbox.Text = My.Settings.folderpath
       updatefoldernames()
   End Sub

   Public Sub updatefoldernames()
       Dim List As Integer = 0
       Dim posy As Integer = 10

       filesystem = CreateObject("Scripting.FileSystemObject")
       ThisDir = filesystem.GetFolder(My.Settings.folderpath)

       For Each folder In ThisDir.Subfolders
           List = List + 1
           posy = posy + 20
           Dim newCheckBox As New CheckBox()
           Panel1.Controls.Add(newCheckBox)
           newCheckBox.Name = "checkbox" & List.ToString()
           newCheckBox.Text = folder.name
           newCheckBox.Location = New Point(10, posy)
           'MessageBox.Show(newCheckBox.Name.ToString())

           Dim checkbox_selected As String = "checkbox" & List.ToString()
           If My.Settings.checkbox_selected = "Y" Then newCheckBox.Checked = True
       Next
   End Sub


Pero me tendría que haber comido la cabeza unas semanas para conseguir lo del evento... ja!, addhandler!, como para saberlo sin haber estudiado 1 año mínimo xD, mil gracias esto me ahorra mucho trabajo ^^

EDITO: Aprovecho para preguntarte Kubox, si puedes fijarte en el final de ese code, intento asociar cada checkbox al nombre de "my.settings"

En my.settings lo tengo así:
My.Settings.checkbox1
My.Settings.checkbox2
My.Settings.checkbox3
etc...
Pero no consigo llamar a ninguno porque solo me acepta un string así que esto me da error:  My.Settings.checkbox_selected

un saludo
#10084
Scripting / Re: identificar unidades
18 Noviembre 2012, 19:56 PM
Buenas,

Puedes utilizar el siguiente code que obtiene solamente las unidades extraíbles.
Cita de: Elektro H@ckerFor /F "Tokens=1" %%X in ('wmic logicaldisk get caption^, description ^| Findstr /I "remo extra"') do (echo %%X)

Pero para que no te suceda lo de "la unidad no se encuentra disponible" debes ocultar en "Mi PC"  los dispositivos extraíbles sin medios insertados (Es decir, las unidades que no están conectadas), creo que no hay otra forma, es lo que pasa cuando Windows intenta leer un dispositivo NO conectado...

Código (dos) [Seleccionar]
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /V "HideDrivesWithNoMedia" /T "REG_DWORD" /D 0x00000001 /F >NUL 2>&1

PD: Reinicia sesión/PC para que los cambios tengan efecto.

Saludos!
#10085
Hola,

Gracias, pero lo he probado sin groupbox y no sé como hacerlo funcionar, directamente no ocurre nada... (no me da error)

Código (vbnet) [Seleccionar]
     For Each ctrl As Control In Me.Controls
           If TypeOf ctrl Is CheckBox Then
               DirectCast(ctrl, CheckBox).Text = "Test"
           End If
       Next


EDITO: Aún así, ese código tendría que usarlo en algun evento... y yo lo que necesito es un evento que haga eso para todos los checkboxes... así que en que evento lo meto? xD

que hago mal?
#10086
Cita de: Danyfirex en 18 Noviembre 2012, 13:34 PM
Yo pense algo asi aunque no se si funcione :S  :rolleyes:


Si funciona, y es más limpio usar min/max, pero así no nos hacen preguntas de más :xD

saludos
#10087
Código (python) [Seleccionar]
Count=0
ThisNum=None
GreaterNum=None

while (ThisNum!=0):
Count += 1
ThisNum = int(raw_input("Introduce un numero: "))
if ThisNum > GreaterNum: GreaterNum = ThisNum

print 'Numeros introducidos : ',Count, ' numeros.'
print 'El numero mas alto es: ',GreaterNum


Saludos
#10088
Hola,

Tengo un panel con casi 50 checkboxes (todos siguen un orden de nombre bien enumerado), y por ejemplo este es el sub del chekbox1:

Código (VB) [Seleccionar]
   Public Sub C1CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles C1CheckBox1.CheckedChanged
       If C1CheckBox1.Checked = True Then My.Settings.box1_selected = "Y" Else My.Settings.box1_selected = "N"
       Dim checkedpath1 = C1CheckBox1.Text
   End Sub


Lo que quisiera poder hacer es que ese mismo evento afecte a todos los checkboxes, eso se que se puede hacer añadiendo los checkboxes al "handle", vale, pero no es suficiente, ya que lo que hay dentro del sub del ejemplo solo afectará al checkbox 1 aunque yo añada todos al handle, ¿entienden lo que quiero decir?

Hay alguna forma de no escribir el mismo evento para los 50 checkboxes?

es decir, yo necesito hacer esto:

(Pseudocode)


Public Sub TODOS_LOS_CHECKBOXES_CheckedChanged(sender As Object, e As EventArgs) Handles TODOS_LOS_CHECKBOXES.CheckedChanged
If CUALQUIER_CHECKBOX.Checked = True Then My.Settings.NÚMERO_DEL_CHECKBOX_SELECCIONADO_selected = "Y" Else My.Settings.boxNÚMERO_DEL_CHECKBOX_SELECCIONADO_selected = "N"
Dim checkedpathNÚMERO_DEL_CHECKBOX _SELECCIONADO = C1CheckBoxNÚMERO_DEL_CHECKBOX _SELECCIONADO.Text
End Sub



Gracias y un saludo...
#10089
Scripting / [RUBY] MP3Crank Leecher v0.2
18 Noviembre 2012, 08:27 AM
MP3Crank es una página web que actualizan constantemente con albums de muchos estilos... pop, rock, dance, electro, heavy metal, indie, folk, hiphop, r&b etc...
Yo personalmente descargo musica casi todos los días en esta página porque los enlaces están en "potload" y se descargan enseguida usando JDownloader.

La cuestión es que para acceder a un link de descarga primer hay que pasar por 3 páginas, así que para evitar ese tiempo de espera tán incómodo he decidido hacer este pequeño script que parsea las "X" primeras páginas de la página web y guarda los links en un archivo de texto...

Los enlaces que se listen se registran en un archivo log para que no se vuelvan a listar en el próximo uso del script.













- Se puede configurar el máximo de páginas a parsear.
- Se pueden excluir los albumes por "tags", en la configuración del script. por ejemplo si excluimos el tag "pop" no se listará ningún album de estilo pop.
NOTA: Tener en cuenta que muchos albumes de la página tienen varios tags, por ejemplo "pop, rock, indie", si el tag "pop" lo hemos excluido, ese album se omitirá tenga los otros tags que tenga.

- El archivo de salida que obtendremos es algo parecido a este:

Title   : Layo & Bushwacka! - Rising & Falling
Genre   : House, Techno
Year    : 2012
Page    : http://www.mp3crank.com/layo-bushwacka/rising-falling.htm
Download: http://potload.com/w34j2fem2bra


Title   : Press Gang Metropol - Checkpoint
Genre   : New Wave, Post-punk
Year    : 2012
Page    : http://www.mp3crank.com/press-gang-metropol/checkpoint.htm
Download: http://potload.com/dizvwuf3m3sy


Title   : Porcupine Tree - Octane Twisted (Live) (2CD)
Genre   : Progressive, Rock
Year    : 2012
Page    : http://www.mp3crank.com/porcupine-tree/octane-twisted-live-2cd.htm
Download: http://potload.com/7h1rld0rfz03


Title   : Nightwish - Imaginaerum (The Score)
Genre   : Symphonic Metal
Year    : 2012
Page    : http://www.mp3crank.com/nightwish/imaginaerum-the-score.htm
Download: http://potload.com/eqznab8d44uk



EXECUTABLE: http://exoshare.com/download.php?uid=1Z1TPBQO

MP3Crank.rb:
Código (ruby) [Seleccionar]
# -*- coding: UTF-8 -*-


# MP3Crank Leecher v0.2
#
# By Elektro H@cker


# Description:
# -----------
#
# MP3Crank Leecher it's a tool that helps you to keep updated your music collection.
#
# This tool is intended for (almost) daily use.
#
# The script retreives all the downloadable links of the first "X" pages from the MP3Crank website,
# And then list the links into a text file for use it with a download managaer like "JDownloader".
#
# All the links are stored permanently into a log file to be excluded at the next use,
# (that's the reason why this tool is intended for daily use).
#
#
# The pass for the links is: mp3crank.com


require 'net/http'
require 'win32/registry'
require "highline/system_extensions"
include HighLine::SystemExtensions


exit if Object.const_defined?(:Ocra)


def logo()
puts "
MP3CRANK Leecher v0.2
By Elektro H@cker"
end


def main()
puts "\n\n(Remember, the password for the links is: \"mp3crank.com\")\n\n[+] Press \"C\" to config or press any other key to start leeching..."
key = get_character
config("") if key.to_s =~ /^67$|^99$/
get_downloads_list()
puts "\n\n\n[+] All links are stored in: #{$mp3crank_leecherfile}\n\n(Remember, the password for the links is: \"mp3crank.com\")"
exit
end


def get_settings()
begin
$mp3crank_logfile = regread("LOGFILEPATH")
rescue
$mp3crank_logfile = "#{ENV['WINDIR']}\\MP3Crank Leecher LOG.txt"
end

begin
$mp3crank_leecherfile = regread("LEECHERFILEPATH") +  "MP3Crank Leecher #{Time.new.strftime("%Y-%m-%d")}.txt"
rescue
$mp3crank_leecherfile = "#{ENV['USERPROFILE']}\\Desktop\\MP3Crank Leecher #{Time.new.strftime("%Y-%m-%d")}.txt"
end

begin
$max_pages = regread("MAXPAGES")
$max_pages = $max_pages.to_i
rescue
$max_pages = 10
end

begin
$excluded_tags = regread("EXCLUDED TAGNAMES")
rescue
$excluded_tags = ""
end

end


def config(errorcode)

puts "
º---------------------------------º---------------------------------º
| [1] Set the log file path       | [S] Show the current settings   |
| [2] Set the leecher file path   | [R] Reset the settings          |
| [3] Delete the log file         | [Z] Backup all the settings     |
|---------------------------------|---------------------------------|
| [M] Max. Pages to parse         |                                 |
| [T] Tagnames to exclude         | [E] Exit                        |
º---------------------------------º---------------------------------º
"
get_settings()
puts errorcode

keystr = "NOTHING"
until keystr =~ /^49$|^50$|^51$|^69$|^80$|^82|^83$|^84$|^90$|^101$|^112$|^114$|^115$|^116$|^122$/
print "\nChoose an option >> "
key = get_character
keystr = key.to_s
end

# Log file path
if key == 49
logfilepath = "NOTHING"
until File.directory?(logfilepath)
print "\n\nEnter the path to an existing directory for the logfile: "
logfilepath = STDIN.gets.chomp
end
if logfilepath[-1] == '\\' then logfilepath = logfilepath[0..-2] end
regwrite("LOGFILEPATH", logfilepath + "\\MP3Crank Leecher LOG.txt")
config("[+] Operation completed.")
end

# Leecher file path
if key == 50
leecherfile = "NOTHING"
until File.directory?(leecherfile)
print "\n\Enter the path to an existing directory for the leecher file: "
leecherfile = STDIN.gets.chomp
end
if not leecherfile[-1] == '\\' then leecherfile = leecherfile+"\\" end
regwrite("LEECHERFILEPATH", leecherfile)
config("[+] Operation completed.")
end

# delete log file
if key == 51
filedel = "NOTHING"
while not filedel =~ /^78$|^89$|^110$|^121$/
print "\n\nWant to delete the log file, Are you sure? [Y/N]: "
filedel = get_character.to_s
end
begin
if filedel =~ /^89$|^121$/ then File.delete($mp3crank_logfile) end
config("[+] Operation completed.")
rescue
config("\n\nERROR\n\nCan't find the logfile.")
end
end

# Max pages
if key == 80 or key == 112
maxpages = "NOTHING"
puts "\n\nThis option lets you configure the maximum pages to leech..."
until not maxpages[/[a-z]/i]
print "\nEnter a number for the max pages value: "
maxpages = STDIN.gets.chomp
end
regwrite("MAXPAGES", maxpages)
config("[+] Operation completed.")
end

# exclude tagnames
if key == 84 or key == 116
addtag = "NOTHING"
puts "\n\nThis option lets you exclude albums by their genre tagnames..."
until not addtag == "NOTHING"
print "\n\nEnter a tagname (Example: \"Hip Hop\") \nor enter the word \"none\" to reset the exclusions: "
addtag = STDIN.gets.chomp
end
begin
tags=regread("EXCLUDED TAGNAMES")
rescue
tags=""
end
if addtag =~ /^none$/i then regwrite("EXCLUDED TAGNAMES", "") else regwrite("EXCLUDED TAGNAMES", "#{tags};#{addtag}") end
config("[+] Operation completed.")
end

# show the current settings
if key == 83 or key == 115
config("

Log file path       : #{$mp3crank_logfile}

Leecher file path   : #{$mp3crank_leecherfile}

Max. pages to parse : #{$max_pages} pages

Excluded tagnames   : #{$excluded_tags.gsub(";","|")}

")
end

# reset the settings
if key == 114 or key == 82
resetkey = "NOTHING"
while not resetkey =~ /^78$|^89$|^110$|^121$/
print "\n\nWant to reset all the settings, Are you sure? [Y/N]: "
resetkey = get_character.to_s
end
if resetkey =~ /^89$|^121$/
Win32::Registry::HKEY_CURRENT_USER.open("SOFTWARE\\MP3Crank Leecher\\", Win32::Registry::KEY_ALL_ACCESS) do |reg|
reg['LOGFILEPATH'] = 'DELETE'
reg.delete_value("LOGFILEPATH")
reg['LEECHERFILEPATH'] = 'DELETE'
reg.delete_value("LEECHERFILEPATH")
reg['MAXPAGES'] = 'DELETE'
reg.delete_value("MAXPAGES")
reg['EXCLUDED TAGNAMES'] = 'DELETE'
reg.delete_value("EXCLUDED TAGNAMES")
end
config("[+] Operation completed.")
end
end

# backup the settings
if key == 90 or key == 122
system %[ regedit /e \"%USERPROFILE%\\Desktop\\MP3Crank Leecher settings %DATE:/=-%.reg\" \"HKEY_CURRENT_USER\\Software\\MP3Crank Leecher\" ]
config("\n\n[+] Settings stored in #{ENV['USERPROFILE']}\\Desktop\\MP3Crank Leecher settings.reg")
end

# exit
if key == 69 or key == 101 then main() end

end


def show_info()
  @info = "

Title   : #{@album_title}
Genre   : #{@album_tags.to_s.gsub('\\t','').gsub(']','').gsub('[','').gsub('"','').gsub('nil','').gsub(', , ','')}
Year    : #{@year}
Page    : #{@album_page}
Download: #{@potload_url}

"
  puts @info
end


def get_downloads_list()
@page = 0
print "\n\n[+] Leeching pages "
for i in 1..$max_pages do
@page = @page+1
@url  = "http://www.mp3crank.com/page/#{@page}"
print "#{@page}/#{$max_pages}..."
Net::HTTP.get_response(URI.parse(@url)).body.split('<!--/centercol -->').first.split('<div id="centercol">').last.each_line do |line|

if (line['class="release"']) then @downloadable = "yes" end

if line['class="year"'] then @year = line.split('</').first.split('>').last end

if line['class="genres"']
for tag in line.split('rel="tag">').each do
@album_tags = @album_tags, tag.split('<').first.gsub('&amp;','&')
for excluded_tag in $excluded_tags.split(";").each do
if not excluded_tag == "" and tag.split('<').first.to_s.chomp[/^#{Regexp.escape(excluded_tag)}$/i] then @downloadable = "no" end
end
end
end

if line['class="album"']
@album_title   = line.split('title="').last.split('">').first.gsub('Free MP3 download ','').gsub('&amp;','&')
@album_page    = line.split('" rel=').first.split('"').last
@download_page = Net::HTTP.get_response(URI.parse(@album_page)).body[/http:\/\/www.mp3crank.com\/download\/album\/[0-9]+/i]
@potload_url   = Net::HTTP.get_response(URI.parse(@download_page)).body[/http:\/\/potload.com\/[a-z0-9]+/i]
if @downloadable == "yes"
filewrite()
end
@album_tags  = nil
end

end
end
end


def regread(keyname)
Win32::Registry::HKEY_CURRENT_USER.open("SOFTWARE\\MP3Crank Leecher\\") do |reg| reg[keyname] end
end


def regwrite(keyname, value)
Win32::Registry::HKEY_CURRENT_USER.create("SOFTWARE\\MP3Crank Leecher\\") do |reg| reg[keyname, Win32::Registry::REG_SZ] = value end
end


def filewrite()
if not File.exist?($mp3crank_logfile) then File.open($mp3crank_logfile, "w") do |write| write.puts "MP3Crack leeched URLs\n\n(Remember, the password for the links is: \"mp3crank.com\")\n\n" end end
if not File.open($mp3crank_logfile, "r").read[@album_page]
show_info()
File.open($mp3crank_logfile,     "a+") do |write| write.puts @album_page end
File.open($mp3crank_leecherfile, "a+") do |write| write.puts @info end
end
end


logo()
get_settings()
main()


#10090
Cita de: sr_corsario en 16 Noviembre 2012, 19:40 PM
Hola!!!
Estaba buscando una solución para ese mismo "problemilla" del "enviar a" y he dado con este hilo :D

El link del archivo compilado está caido, ¿te sabría mal subirlo de nuevo? (tb he buscado en inet por si aparecía)

Muchas gracias

Me van a regañar por contestarte, fíjate en la fecha del post!  :-\

Desde la última vez que publiqué una actualización de esta tool no he vuelto a tocar el code xD

Aquí tienes el executable:

http://exoshare.com/download.php?uid=BRBGOHYP


Y aquí más info: [RUBY] (APORTE) MoveIt (Complemento para el menú SendTo de Windows)

Saludos