|
8171
|
Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets)
|
en: 13 Octubre 2013, 11:51 am
|
He descubierto este mensaje de Windows para mover el ScrollBar de un control pudiendo especificar la cantidad de lineas a mover, y la dirección. <System.Runtime.InteropServices.DllImport("user32.dll")> _ Private Shared Function SendMessage(hWnd As IntPtr, wMsg As UInteger, wParam As UIntPtr, lParam As IntPtr) As Integer End Function ' Examples: ' ' SendMessage(RichTextBox1.Handle, &HB6, 0, 1) ' Move 1 line to down ' SendMessage(RichTextBox1.Handle, &HB6, 0, 5) ' Move 5 lines to down ' SendMessage(RichTextBox1.Handle, &HB6, 0, -1) ' Move 1 line to up ' SendMessage(RichTextBox1.Handle, &HB6, 0, -5) ' Move 5 lines to up
|
|
|
8172
|
Programación / Scripting / Re: (Solucionado) [Batch] Randomizar lineas en un txt?
|
en: 13 Octubre 2013, 09:41 am
|
Creo que no existe esa información en la estructura M3U, no estoy seguro, pero no creo que cueste tanto abrir la wikipedia, buscar, e informarse: http://en.wikipedia.org/wiki/M3UDirective Description Example #EXTM3U File header. Must be the first line of the file! #EXTM3U
#EXTINF Track information, including runtime and title. #EXTINF:191,Artist Name - Track Title Para especificar el tiempo de duración tienes que crear otro tipo de lista multimedia, por ejemplo "pls", y eso requiere escribir el código desde cero para adaptarlo a la estructura de la nueva lista multimedia. Pero además, usando Batch no es posible obtener la información de duración de un archivo multimedia, ya te lo dije que pides cosas que con Batch no es posible y va siendo hora de que uses otro lenguaje. De todas formas puedes usar la aplicación MediaInfo desde la consola para obtener la duración de un archivo multimedia: http://mediaarea.net/es/MediaInfo/Download/WindowsSaludos
|
|
|
8174
|
Programación / Scripting / Re: ayuda a simplificar bat
|
en: 13 Octubre 2013, 04:09 am
|
acabo de crear varios archivos y ninguno se inicia automaticamente Pues en ese caso y según lo que comentas, el único posible error es que no estés encerrando el argumento con comillas dobles: ... /tr "C:\ruta con espacios\archivo.bat" O que no estés usando la ruta absoluta del archivo, recuerda que el directorio actual del entorno de una nueva CMD es en la carpeta del sistema "C:\Windows\system32". Saludos
|
|
|
8176
|
Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets)
|
en: 13 Octubre 2013, 03:55 am
|
Este código reemplaza una palabra en un string, por una secuencia numérica: #Region " Replace Word (Increment method) " ' [ Replace Word (Increment method) ] ' ' // By Elektro H@cker ' ' Examples : ' MsgBox(Replace_Word_By_Increment("Hello World!, Hello World!", "Hello", , 3)) ' Result: 001 World!, 002 World! Private Function Replace_Word_By_Increment(ByVal str As String, _ ByVal replace As String, _ Optional ByVal IgnoreCase As System.StringComparison = StringComparison.CurrentCulture, _ Optional ByVal DigitLength As Long = 0) As String Dim str_split() As String = str.Split Dim replacement As String = Nothing Dim IndexCount As Long = 0 DigitLength = If(DigitLength = 0, replace.Length, DigitLength) For Item As Long = 0 To str_split.LongCount - 1 If str_split(Item).Equals(replace, IgnoreCase) Then replacement &= Threading.Interlocked.Increment(IndexCount).ToString While Not replacement.Length >= DigitLength replacement = replacement.Insert(0, "0") End While str_split(Item) = replacement replacement = Nothing End If Next Item Return String.Join(Convert.ToChar(Keys.Space), str_split) End Function #End Region
Este código reemplaza un patrón de búsqueda en un string, por una secuencia numérica: #Region " Replace String (Increment method) " ' [ Replace String (Increment method) ] ' ' // By Elektro H@cker ' ' Examples : ' MsgBox(Replace_String_By_Increment("Hello World!, Hello World!", New System.Text.RegularExpressions.Regex("Hello\sWorld", RegexOptions.IgnoreCase), 3)) ' Result: 001!, 002! Private Function Replace_String_By_Increment(ByVal str As String, _ ByVal replace As System.Text.RegularExpressions.Regex, _ Optional ByVal DigitLength As Long = 0) As String DigitLength = If(DigitLength = 0, replace.ToString.Length, DigitLength) Dim IndexCount As Integer = 0 Dim replacement As String = Nothing Dim matches As System.Text.RegularExpressions.MatchCollection = replace.Matches(str) For Each match As System.Text.RegularExpressions.Match In matches replacement &= Threading.Interlocked.Increment(IndexCount).ToString While Not replacement.Length >= DigitLength replacement = replacement.Insert(0, "0") End While str = replace.Replace(str, replacement, 1, match.Index - (match.Length * (IndexCount - 1))) replacement = Nothing Next matches = Nothing replacement = Nothing IndexCount = 0 Return str End Function #End Region
EDITO:Un sencillo proyecto para testear: Descarga: http://www.mediafire.com/?6b6qdy9iyigm63v
|
|
|
8177
|
Programación / Scripting / Re: Acciones sobre archivos de texto. [Batch]
|
en: 13 Octubre 2013, 03:03 am
|
Si sólamente se trata de modificar UNA palabra, entonces lo más sencillo es partir el string en un array y hacer un reemplazamiento de string con las cadenas que coincidan, cada uno de los items del array sólamente contendrá una palabra.
Si se quiere modificar más de una palabra entonces yo usaría expresiones regulares.
Recordemos que para hacer la secuencia numérica hay que manipular una variable de tipo String donde deberiamos agregarle "X" cantidad de ceros a la izquierda (Ej: "0001").
Esto es facil de hacer, pero no recomiendo llevar esto a cabo usando Batch, aunque cualquier usuario es libre de proporcionarte una solución, a ver si el compañero moderador Leo se anima.
Saludos!
|
|
|
8178
|
Programación / Scripting / Re: Script para organizar archivos
|
en: 13 Octubre 2013, 01:59 am
|
¿El código está completo? En Pastebin tendrás más espacio para postear el code sin limitación de tamaño Si tampoco cabe en Pastebin entonces si gustas puedes postear el code haciendo doble post (los que hagan falta para que quepa el código), y luego yo lo copio y publico el code en mi cuenta premium de pastebin (porque no tiene casi limite de tamaño) PD: estas lineas las duplicas cientos de veces: echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» echo º UNIDAD "%uni%" SELECCIONADA º echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» echo º ORGANIZANDO ARCHIVOS... º echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ Es muy sencillo de simplificar, te ahorrarías bastante código. un saludo
|
|
|
|
|
|
|