|
9951
|
Programación / .NET (C#, VB.NET, ASP) / [APORTE] Splitty v1.6 [Source code]
|
en: 15 Enero 2013, 19:21 pm
|
SplittyBy Elektro H@ckerEsta 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.
|
|
|
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). Private Sub TextBox_Custom_Size_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox_Custom_Size.KeyPress e.Handled = NumericOnly(e.KeyChar) End Sub Public Function NumericOnly(ByVal eChar As Char) As Boolean Dim chkStr As String = "0123456789," If chkStr.IndexOf(eChar) > -1 OrElse eChar = vbBack Then If eChar = Keys.Oemcomma & TextBox_Custom_Size.Text.Contains(",") Then Return True Return False Else Return True End If 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. #Region " File Remove Attribute Function " ' [ File Remove Attribute Function ] ' ' Examples : ' ' MsgBox(File_Remove_Attribute("C:\Test.txt", FileAttribute.ReadOnly)) ' MsgBox(File_Remove_Attribute("C:\Test.txt", FileAttribute.ReadOnly + FileAttribute.Hidden)) Public Function File_Remove_Attribute (ByVal File As String, ByVal Remove_Attribute As FileAttribute ) As Boolean Try Dim FileAttributes As FileAttribute = IO. File. GetAttributes(File) IO. File. SetAttributes(File, FileAttributes And Not Remove_Attribute ) Return True Catch ex As Exception Return False End Try End Function #End Region
Función para añadir atributos a un archivo, preservando el resto de atributos. #Region " File Add Attribute Function " ' [ File Add Attribute Function ] ' ' Examples : ' ' MsgBox(File_Add_Attribute("C:\Test.txt", FileAttribute.ReadOnly)) ' MsgBox(File_Add_Attribute("C:\Test.txt", FileAttribute.ReadOnly + FileAttribute.Hidden)) Public Function File_Add_Attribute (ByVal File As String, ByVal Add_Attribute As FileAttribute ) As Boolean Try Dim FileAttributes As FileAttribute = IO. File. GetAttributes(File) IO. File. SetAttributes(File, FileAttributes Or Add_Attribute ) Return True Catch ex As Exception Return False End Try End Function #End Region
Función que comprueba si un archivo tiene un atributo #Region " File Have Attribute Function " ' [ File Have Attribute Function ] ' ' Examples : ' ' MsgBox(File_Have_Attribute("C:\Test.txt", FileAttribute.ReadOnly)) ' MsgBox(File_Have_Attribute("C:\Test.txt", FileAttribute.ReadOnly + FileAttribute.Hidden)) Public Function File_Have_Attribute (ByVal File As String, ByVal CheckAttribute As FileAttribute ) As Boolean Try Dim FileAttributes As FileAttribute = IO. File. GetAttributes(File) If (FileAttributes And CheckAttribute) = CheckAttribute Then Return True Else Return False Catch ex As Exception Return Nothing End Try End Function #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. #Region " Create ShortCut Function " ' [ Create ShortCut Function ] ' ' // By Elektro H@cker ' ' Examples : ' ' Create_ShortCut(ShortcutPath.MyDocuments, "My APP Shortcut.lnk", "C:\File.exe") ' Create_ShortCut(ShortcutPath.Desktop, "My CMD Shortcut.lnk", "CMD.exe", "/C Echo Hello World & Pause") ' Create_ShortCut(ShortcutPath.Favorites, "My INTERNET Shortcut.lnk", "http://www.Google.com", , "CTRL+SHIFT+S") ' Create_ShortCut(ShortcutPath.Favorites, "My INTERNET Shortcut.lnk", "http://www.Google.com", , "CTRL+SHIFT+S", "Description of the shortcut") Enum ShortcutPath AppData = Environment.SpecialFolder.ApplicationData Desktop = Environment.SpecialFolder.Desktop Favorites = Environment.SpecialFolder.Favorites LocalAppData = Environment.SpecialFolder.LocalApplicationData MyDocuments = Environment.SpecialFolder.MyDocuments ProgramFiles = Environment.SpecialFolder.ProgramFiles ProgramFilesx86 = Environment.SpecialFolder.ProgramFilesX86 StartMenu = Environment.SpecialFolder.StartMenu System32 = Environment.SpecialFolder.System SysWOW64 = Environment.SpecialFolder.SystemX86 UserProfile = Environment.SpecialFolder.UserProfile Windows = Environment.SpecialFolder.Windows End Enum Function Create_ShortCut(ByVal Shortcut_Path As ShortcutPath, _ ByVal Shortcut_Name As String, _ ByVal APP As String, _ Optional ByVal APP_Arguments As String = Nothing, _ Optional ByVal HotKey As String = Nothing, _ Optional ByVal Icon As String = Nothing, _ Optional ByVal Description As String = Nothing) As Boolean Dim Dir = New IO.DirectoryInfo(System.Environment.GetFolderPath(Shortcut_Path)) Dim WorkingDir As IO.FileInfo If Not APP.Contains("/") Then WorkingDir = New IO.FileInfo(APP) Else WorkingDir = Nothing Try Dim WSHShell As Object = CreateObject("WScript.Shell") Dim Shortcut As Object Shortcut = WSHShell.CreateShortcut(Dir.FullName & "\" & Shortcut_Name) Shortcut.TargetPath = APP Shortcut.Arguments = APP_Arguments Shortcut.WindowStyle = 2 Shortcut.Hotkey = HotKey Shortcut.Description = Description If Not APP.Contains("/") Then Shortcut.WorkingDirectory = WorkingDir.DirectoryName If Icon IsNot Nothing Then Shortcut.IconLocation = Icon Else Shortcut.IconLocation = APP Shortcut.Save() Return True Catch ex As Exception Return False End Try End Function #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: WScript.exe "Archivo.vbs" 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. #Region " Make Dir Function " ' [ Make Dir Function ] ' ' // By Elektro H@cker ' ' Examples : ' ' MsgBox(MakeDir("C:\Test")) Private Function Make_Dir(ByVal Path As String, Optional ByVal Attributes As System.IO.FileAttributes = IO.FileAttributes.Normal) If My.Computer.FileSystem.DirectoryExists(Path) Then Return Nothing ' Directory already exists Try My.Computer.FileSystem.CreateDirectory(Path) ' Create directory If Not Attributes = IO.FileAttributes.Normal Then My.Computer.FileSystem.GetDirectoryInfo(Path).Attributes = Attributes ' Apply Folder Attributes Return True ' Directory is created OK Catch ex As Exception Return False ' Can't create the directory maybe because user permissions ' Return ex.Message End Try End Function #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. #Region " Copy File Function " ' [ Copy File Function ] ' ' // By Elektro H@cker ' ' Examples : ' ' MsgBox(Copy_File("C:\File.txt", "C:\Test\")) ' Standard copy ' MsgBox(Copy_File("C:\File.txt", "C:\Test\", True)) ' Create the directory if doesn't exists ' MsgBox(Copy_File("C:\File.txt", "C:\Test\", , True)) ' Replace any existing file ' MsgBox(Copy_File("C:\File.txt", "C:\Test\", , , IO.FileAttributes.Hidden + IO.FileAttributes.ReadOnly)) ' Apply new attributes Private Function Copy_File (ByVal File As String, ByVal Target_Path As String, _ Optional ByVal Force_Target_Path As Boolean = False, Optional ByVal Force_File_Replace As Boolean = False, _ Optional ByVal Attributes As System.IO.FileAttributes = IO.FileAttributes.Normal) Dim File_Information = My. Computer. FileSystem. GetFileInfo(File) ' Get Input File Information ' Directory If Not Force_Target_Path And Not My.Computer.FileSystem.DirectoryExists(Target_Path) Then Return False ' Target Directory don't exists ElseIf Force_Target_Path Then Try My.Computer.FileSystem.CreateDirectory(Target_Path) ' Create directory Catch ex As Exception 'Return False Return ex.Message ' Directory can't be created maybe beacuse user permissions End Try End If ' File Try My. Computer. FileSystem. CopyFile(File, Target_Path & "\" & File_Information. Name, Force_File_Replace ) ' Copies the file If Not Attributes = IO.FileAttributes.Normal Then My.Computer.FileSystem.GetFileInfo(Target_Path & "\" & File_Information.Name).Attributes = Attributes ' Apply File Attributes Return True ' File is copied OK Catch ex As Exception 'Return False Return ex.Message ' File can't be created maybe beacuse user permissions End Try End Function #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.  :: By Elektro H@cker Set "DefaultExt=bat doc cmd exe txt" :MENU CLS SET /A Count+=1 & REM Sumo un valor en el contador Call SET "EXT %%COUNT%%=%%@" & REM Creo la variable dinámica que contendrá cada extensión Call <Nul SET /P =[ %%COUNT%%] %%@ & REM Muestro las extensiones REM Si quieres la lista en horizontal en lugar de vertical elimina la línea del echo ) Choice /C AEN /m "[A]Agregar, [E] Eliminar, [N] Nada" :Agregar CLS Echo: [ Agregar extension ] | MORE SET /p "ADDEXT= AGREGA UNA EXTENSION >> " SET "ADDEXT= %ADDEXT:.=%" & REM Elimino cualquier punto SET "ADDEXT= %ADDEXT: =%" & REM Elimino cualquier espacio SET "DefaultExt= %DefaultExt% %ADDEXT%" & REM Añado la nueva extensión a la lista de extensiones :Eliminar CLS Echo: [ Eliminar extension ] | MORE Set "ChoiceDigits=" & REM Reseteo la variable Call Echo [ %%X] %%EXT%%X%% & REM Muestro las variables que creé en el menú Call Set "ChoiceDigits= %%ChoiceDigits%%%%X" & REM Seteo las opciones del comando CHOICE ) Choice /C %ChoiceDigits%N /M "[N] Ninguna" Call Set "DEL_EXT= %%EXT%ERRORLEVEL %%%" & REM Seteo la extensión elegida call SET "DefaultExt= %%DefaultExt:%DEL_EXT %=%%" & REM Elimino la extensión de la lista call SET "DefaultExt= %%DefaultExt: = %%" & REM Elimino dobles espacios si quedasen. :Copiar CLS Set "DefaultExt= %DefaultExt: = ,*.%" & REM Modifico los espacios de la variable para añadirlo los símbolos necesarios :: FOR /R "%userprofile%\Mis documentos\" %%a IN (*.%DefaultExt%) DO (copy /y "%%a" "E:\datossss\")
Saludos
|
|
|
|
|
|
|