elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.


Tema destacado: Recopilación Tutoriales y Manuales Hacking, Seguridad, Privacidad, Hardware, etc


  Mostrar Mensajes
Páginas: 1 ... 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 [996] 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 ... 1254
9951  Programación / .NET (C#, VB.NET, ASP) / [APORTE] Splitty v1.6 [Source code] en: 15 Enero 2013, 19:21 pm
Splitty
By Elektro H@cker


Esta utilidad se encarga de organizar un directorio separando el directorio en varias carpetas de un tamaño específico (tamaño de la capacidad de disco) para grabarlo posteriormente.


Para que lo entiendan mejor, pongámonos en situación,
imaginemos que tenemos una carpeta con subcarpetas, llenas de archivos, y la carpeta pesa 100 GB,
si por necesidad queremos grabar la carpeta a DVD's tenemos que organizarlo todo (Cortar y medir) manualmente, lo cual es una tarea muy agobiante xD... Pues para eso hice este programa.

versión 1.6:

     

El código fuente:

>  http://www.mediafire.com/download/pn69i21t9nja5xm/Splitty.rar

* Está desarrollado en VB.NET (VS2012), Es un WinForm y requiere Framework 4.0.

9952  Programación / .NET (C#, VB.NET, ASP) / Re: Permitir solo una coma en un textbox en: 15 Enero 2013, 16:48 pm
Ups, acabo de copiar tu code tál cual y si que funciona, algo habré puesto mal en mi code xD

Solucionado, gracias de nuevo.
9953  Programación / .NET (C#, VB.NET, ASP) / Re: Permitir solo una coma en un textbox en: 15 Enero 2013, 16:39 pm
Creo que así funcionaria.

Gracias, pero no :(
9954  Programación / .NET (C#, VB.NET, ASP) / [SOLUCIONADO] Permitir solo una coma en un textbox en: 15 Enero 2013, 15:38 pm
Estoy intentando que el textbox sólamente acepte números, y una coma (sólamente una coma),
No se que estoy haciendo mal (Acepta más de una coma).

Código
  1.    Private Sub TextBox_Custom_Size_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox_Custom_Size.KeyPress
  2.        e.Handled = NumericOnly(e.KeyChar)
  3.    End Sub
  4.  
  5.    Public Function NumericOnly(ByVal eChar As Char) As Boolean
  6.        Dim chkStr As String = "0123456789,"
  7.        If chkStr.IndexOf(eChar) > -1 OrElse eChar = vbBack Then
  8.            If eChar = Keys.Oemcomma & TextBox_Custom_Size.Text.Contains(",") Then Return True
  9.            Return False
  10.        Else
  11.            Return True
  12.        End If
  13.    End Function

Saludos!
9955  Programación / .NET (C#, VB.NET, ASP) / Re: [APORTE] Snippets !! (Posteen aquí sus snippets) en: 15 Enero 2013, 07:33 am
He añadido, ordenado, y mejorado bastantes snippets del pack de snippets, el nuevo enlace está en el comentario principal.

 
Función para eliminar atributos de un archivo, preservando el resto de atributos.

Código
  1. #Region " File Remove Attribute Function "
  2.  
  3.    ' [ File Remove Attribute Function ]
  4.    '
  5.    ' Examples :
  6.    '
  7.    ' MsgBox(File_Remove_Attribute("C:\Test.txt", FileAttribute.ReadOnly))
  8.    ' MsgBox(File_Remove_Attribute("C:\Test.txt", FileAttribute.ReadOnly + FileAttribute.Hidden))
  9.  
  10.    Public Function File_Remove_Attribute(ByVal File As String, ByVal Remove_Attribute As FileAttribute) As Boolean
  11.        Try
  12.            Dim FileAttributes As FileAttribute = IO.File.GetAttributes(File)
  13.            IO.File.SetAttributes(File, FileAttributes And Not Remove_Attribute)
  14.            Return True
  15.        Catch ex As Exception
  16.            Return False
  17.        End Try
  18.    End Function
  19.  
  20. #End Region


Función para añadir atributos a un archivo, preservando el resto de atributos.

Código
  1. #Region " File Add Attribute Function "
  2.  
  3.    ' [ File Add Attribute Function ]
  4.    '
  5.    ' Examples :
  6.    '
  7.    ' MsgBox(File_Add_Attribute("C:\Test.txt", FileAttribute.ReadOnly))
  8.    ' MsgBox(File_Add_Attribute("C:\Test.txt", FileAttribute.ReadOnly + FileAttribute.Hidden))
  9.  
  10.    Public Function File_Add_Attribute(ByVal File As String, ByVal Add_Attribute As FileAttribute) As Boolean
  11.        Try
  12.            Dim FileAttributes As FileAttribute = IO.File.GetAttributes(File)
  13.            IO.File.SetAttributes(File, FileAttributes Or Add_Attribute)
  14.            Return True
  15.        Catch ex As Exception
  16.            Return False
  17.        End Try
  18.    End Function
  19.  
  20. #End Region

Función que comprueba si un archivo tiene un atributo

Código
  1. #Region " File Have Attribute Function "
  2.  
  3.    ' [ File Have Attribute Function ]
  4.    '
  5.    ' Examples :
  6.    '
  7.    ' MsgBox(File_Have_Attribute("C:\Test.txt", FileAttribute.ReadOnly))
  8.    ' MsgBox(File_Have_Attribute("C:\Test.txt", FileAttribute.ReadOnly + FileAttribute.Hidden))
  9.  
  10.    Public Function File_Have_Attribute(ByVal File As String, ByVal CheckAttribute As FileAttribute) As Boolean
  11.        Try
  12.            Dim FileAttributes As FileAttribute = IO.File.GetAttributes(File)
  13.            If (FileAttributes And CheckAttribute) = CheckAttribute Then Return True Else Return False
  14.        Catch ex As Exception
  15.            Return Nothing
  16.        End Try
  17.  
  18.    End Function
  19.  
  20. #End Region
9956  Programación / .NET (C#, VB.NET, ASP) / Re: [APORTE] Snippets !! (Posteen aquí sus snippets) en: 15 Enero 2013, 07:11 am
Crea un acceso directo a una aplicación o a una página web, con muchas opciones.

Código
  1. #Region " Create ShortCut Function "
  2.  
  3.    ' [ Create ShortCut Function ]
  4.    '
  5.    ' // By Elektro H@cker
  6.    '
  7.    ' Examples :
  8.    '
  9.    ' Create_ShortCut(ShortcutPath.MyDocuments, "My APP Shortcut.lnk", "C:\File.exe")
  10.    ' Create_ShortCut(ShortcutPath.Desktop, "My CMD Shortcut.lnk", "CMD.exe", "/C Echo Hello World & Pause")
  11.    ' Create_ShortCut(ShortcutPath.Favorites, "My INTERNET Shortcut.lnk", "http://www.Google.com", , "CTRL+SHIFT+S")
  12.    ' Create_ShortCut(ShortcutPath.Favorites, "My INTERNET Shortcut.lnk", "http://www.Google.com", , "CTRL+SHIFT+S", "Description of the shortcut")
  13.  
  14.    Enum ShortcutPath
  15.        AppData = Environment.SpecialFolder.ApplicationData
  16.        Desktop = Environment.SpecialFolder.Desktop
  17.        Favorites = Environment.SpecialFolder.Favorites
  18.        LocalAppData = Environment.SpecialFolder.LocalApplicationData
  19.        MyDocuments = Environment.SpecialFolder.MyDocuments
  20.        ProgramFiles = Environment.SpecialFolder.ProgramFiles
  21.        ProgramFilesx86 = Environment.SpecialFolder.ProgramFilesX86
  22.        StartMenu = Environment.SpecialFolder.StartMenu
  23.        System32 = Environment.SpecialFolder.System
  24.        SysWOW64 = Environment.SpecialFolder.SystemX86
  25.        UserProfile = Environment.SpecialFolder.UserProfile
  26.        Windows = Environment.SpecialFolder.Windows
  27.    End Enum
  28.  
  29.    Function Create_ShortCut(ByVal Shortcut_Path As ShortcutPath, _
  30.                            ByVal Shortcut_Name As String, _
  31.                            ByVal APP As String, _
  32.                            Optional ByVal APP_Arguments As String = Nothing, _
  33.                            Optional ByVal HotKey As String = Nothing, _
  34.                            Optional ByVal Icon As String = Nothing, _
  35.                            Optional ByVal Description As String = Nothing) As Boolean
  36.  
  37.        Dim Dir = New IO.DirectoryInfo(System.Environment.GetFolderPath(Shortcut_Path))
  38.        Dim WorkingDir As IO.FileInfo
  39.        If Not APP.Contains("/") Then WorkingDir = New IO.FileInfo(APP) Else WorkingDir = Nothing
  40.        Try
  41.            Dim WSHShell As Object = CreateObject("WScript.Shell")
  42.            Dim Shortcut As Object
  43.            Shortcut = WSHShell.CreateShortcut(Dir.FullName & "\" & Shortcut_Name)
  44.            Shortcut.TargetPath = APP
  45.            Shortcut.Arguments = APP_Arguments
  46.            Shortcut.WindowStyle = 2
  47.            Shortcut.Hotkey = HotKey
  48.            Shortcut.Description = Description
  49.            If Not APP.Contains("/") Then Shortcut.WorkingDirectory = WorkingDir.DirectoryName
  50.            If Icon IsNot Nothing Then Shortcut.IconLocation = Icon Else Shortcut.IconLocation = APP
  51.            Shortcut.Save()
  52.            Return True
  53.        Catch ex As Exception
  54.            Return False
  55.        End Try
  56.    End Function
  57.  
  58. #End Region
9957  Programación / Scripting / Re: Programa que simula la presión de teclas en: 15 Enero 2013, 05:52 am
Batch es .bat, ¿verdad?
Sí.
Como te digo en Batch no es posible enviar pulsaciones del teclado, a menos que mezcles VBS con Batch o uses aplicaciones externas (Lo cual significa compilar o unirlo de alguna manera por ejemplo con WinRAR),
Así que te puse el código en VisualBasicScript para no hacer un engorro de código usando Batch.

no sabría como generar el programa usando su código en VBS. De todos modos, muchas gracias.
Sigue las instrucciones de SegadorFelix, tán fácil como ponerle la extensión VBS al script.

PD: Y luego puedes ejecutar el VBS desde batch la CMD con el intérprete adecuado:
Código:
Ccript.exe "Archivo.vbs"
Código:
WScript.exe "Archivo.vbs"

Saludos
9958  Programación / Scripting / Re: Como evito que python muestre el CMD al ejecutar un script con pyQT4? en: 15 Enero 2013, 05:47 am
Guarda el archivo con extensión PYW

Saludos.
9959  Programación / .NET (C#, VB.NET, ASP) / Re: [APORTE] Snippets !! (Posteen aquí sus snippets) en: 15 Enero 2013, 05:05 am
Make Dir, para crear directorios con opción de añadir atributos.

Código
  1. #Region " Make Dir Function "
  2.  
  3.    ' [ Make Dir Function ]
  4.    '
  5.    ' // By Elektro H@cker
  6.    '
  7.    ' Examples :
  8.    '
  9.    ' MsgBox(MakeDir("C:\Test"))
  10.  
  11.    Private Function Make_Dir(ByVal Path As String, Optional ByVal Attributes As System.IO.FileAttributes = IO.FileAttributes.Normal)
  12.        If My.Computer.FileSystem.DirectoryExists(Path) Then Return Nothing ' Directory already exists
  13.        Try
  14.            My.Computer.FileSystem.CreateDirectory(Path) ' Create directory
  15.            If Not Attributes = IO.FileAttributes.Normal Then My.Computer.FileSystem.GetDirectoryInfo(Path).Attributes = Attributes ' Apply Folder Attributes
  16.            Return True ' Directory is created OK
  17.        Catch ex As Exception
  18.            Return False ' Can't create the directory maybe because user permissions
  19.            ' Return ex.Message
  20.        End Try
  21.    End Function
  22.  
  23. #End Region
Copy File , para copiar archivos, con opción de crear el directorio si no existe, opción de reemplazar archivos, y opcion de aplicar atributos al archivo.

Código
  1. #Region " Copy File Function "
  2.  
  3.    ' [ Copy File Function ]
  4.    '
  5.    ' // By Elektro H@cker
  6.    '
  7.    ' Examples :
  8.    '
  9.    ' MsgBox(Copy_File("C:\File.txt", "C:\Test\")) ' Standard copy
  10.    ' MsgBox(Copy_File("C:\File.txt", "C:\Test\", True)) ' Create the directory if doesn't exists
  11.    ' MsgBox(Copy_File("C:\File.txt", "C:\Test\", , True)) ' Replace any existing file
  12.    ' MsgBox(Copy_File("C:\File.txt", "C:\Test\", , , IO.FileAttributes.Hidden + IO.FileAttributes.ReadOnly)) ' Apply new attributes
  13.  
  14.    Private Function Copy_File(ByVal File As String, ByVal Target_Path As String, _
  15.                               Optional ByVal Force_Target_Path As Boolean = False, Optional ByVal Force_File_Replace As Boolean = False, _
  16.                               Optional ByVal Attributes As System.IO.FileAttributes = IO.FileAttributes.Normal)
  17.  
  18.        Dim File_Information = My.Computer.FileSystem.GetFileInfo(File) ' Get Input File Information
  19.  
  20.        ' Directory
  21.        If Not Force_Target_Path And Not My.Computer.FileSystem.DirectoryExists(Target_Path) Then
  22.            Return False ' Target Directory don't exists
  23.        ElseIf Force_Target_Path Then
  24.            Try
  25.                My.Computer.FileSystem.CreateDirectory(Target_Path) ' Create directory
  26.            Catch ex As Exception
  27.                'Return False
  28.                Return ex.Message ' Directory can't be created maybe beacuse user permissions
  29.            End Try
  30.        End If
  31.  
  32.        ' File
  33.        Try
  34.            My.Computer.FileSystem.CopyFile(File, Target_Path & "\" & File_Information.Name, Force_File_Replace) ' Copies the file
  35.            If Not Attributes = IO.FileAttributes.Normal Then My.Computer.FileSystem.GetFileInfo(Target_Path & "\" & File_Information.Name).Attributes = Attributes ' Apply File Attributes
  36.            Return True ' File is copied OK
  37.        Catch ex As Exception
  38.            'Return False
  39.            Return ex.Message ' File can't be created maybe beacuse user permissions
  40.        End Try
  41.    End Function
  42.  
  43. #End Region
9960  Programación / Scripting / Re: menu bath cambiar codigo en: 15 Enero 2013, 03:48 am
Aquí tienes un menú, y sin usar SETLOCAL.

   

Código
  1. @Echo OFF
  2.  
  3.  
  4. :: By Elektro H@cker
  5.  
  6.  
  7. Set "DefaultExt=bat doc cmd exe txt"
  8.  
  9. :MENU
  10. CLS
  11. Set /A "Count=0"
  12. For %%@ in (%DefaultExt%) DO (
  13. SET /A Count+=1 & REM Sumo un valor en el contador
  14. Call SET "EXT%%COUNT%%=%%@" & REM Creo la variable dinámica que contendrá cada extensión
  15. Call <Nul SET /P =[%%COUNT%%] %%@ & REM Muestro las extensiones
  16. REM Si quieres la lista en horizontal en lugar de vertical elimina la línea del echo
  17. Echo+
  18. )
  19. Choice /C AEN /m "[A]Agregar, [E] Eliminar, [N] Nada"
  20. If %errorlevel% EQU 1 (CALL :Agregar)
  21. If %errorlevel% EQU 2 (CALL :Eliminar)
  22. If %errorlevel% EQU 3 (GOTO :Copiar)
  23. GOTO :MENU
  24.  
  25. :Agregar
  26. CLS
  27. Echo: [ Agregar extension ] | MORE
  28. SET /p "ADDEXT= AGREGA UNA EXTENSION >> "
  29. IF NOT DEFINED ADDEXT (GOTO :Agregar)
  30. SET "ADDEXT=%ADDEXT:.=%" & REM Elimino cualquier punto
  31. SET "ADDEXT=%ADDEXT: =%" & REM Elimino cualquier espacio
  32. SET "DefaultExt=%DefaultExt% %ADDEXT%" & REM Añado la nueva extensión a la lista de extensiones
  33. GOTO :EOF
  34.  
  35. :Eliminar
  36. CLS
  37. Echo: [ Eliminar extension ] | MORE
  38. Set "ChoiceDigits=" & REM Reseteo la variable
  39. For /L %%X in (1,1,%COUNT%) DO (
  40. Call Echo [%%X] %%EXT%%X%% & REM Muestro las variables que creé en el menú
  41. Call Set "ChoiceDigits=%%ChoiceDigits%%%%X" & REM Seteo las opciones del comando CHOICE
  42. )
  43. Choice /C %ChoiceDigits%N /M "[N] Ninguna"
  44. Call Set "DEL_EXT=%%EXT%ERRORLEVEL%%%" & REM Seteo la extensión elegida
  45. call SET "DefaultExt=%%DefaultExt:%DEL_EXT%=%%" & REM Elimino la extensión de la lista
  46. call SET "DefaultExt=%%DefaultExt:  = %%" & REM Elimino dobles espacios si quedasen.
  47. GOTO:EOF
  48.  
  49. :Copiar
  50. CLS
  51. Set "DefaultExt=%DefaultExt: = ,*.%" & REM Modifico los espacios de la variable para añadirlo los símbolos necesarios
  52. FOR %%a IN (*.%DefaultExt%) DO (echo "%%a")
  53. :: FOR /R "%userprofile%\Mis documentos\" %%a IN (*.%DefaultExt%) DO (copy /y "%%a" "E:\datossss\")
  54.  
  55. Pause&Exit

Saludos
Páginas: 1 ... 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 [996] 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 ... 1254
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines