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


Tema destacado: Guía rápida para descarga de herramientas gratuitas de seguridad y desinfección


  Mostrar Mensajes
Páginas: 1 ... 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 [819] 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 ... 1253
8181  Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets) en: 12 Octubre 2013, 01:04 am
Este snippet comprueba si un nombre de archivo contiene caracteres que no estén en la tabla ASCII (sin contar la tabla ASCII extendida)

Un ejemplo de uso sería, el que yo le doy:
yo dejo el PC descargando miles de archivos de música diariamente, muchos de los nombres de archivos descargados contienen caracteres rusos y otras mierd@s que luego me toca renombrar de forma manual porque no se pueden leer estos nomrbes de archivos por otros programas que uso.

PD: No contiene todos los caracteres de la tabla ASCII normal, recordemos que Windows no permite escribir ciertos caracteres ASCII en los nombres de archivo, asi que no es necesario añadir dichos caracteres la función, además le añadí el caracter "Ñ", y los caracteres de la tabla ASCII extendida yo los considero caracteres extraños, quizás el nombre de la función debería ser: "Filename Has Strange Characters? " :P.

Código:
#Region " Filename Has Non ASCII Characters "

    ' [ Filename Has Non ASCII Characters Function ]
    '
    ' // By Elektro H@cker
    '
    ' Examples :
    ' MsgBox(Filename_Has_Non_ASCII_Characters("ABC├│")) ' Result: True
    ' MsgBox(Filename_Has_Non_ASCII_Characters("ABCDE")) ' Result: False

    Private Function Filename_Has_Non_ASCII_Characters(ByVal [String] As String) As Boolean

        Dim Valid_Characters As String = ( _
            "abcdefghijklmnñopqrstuvwxyz" & _
            "ABCDEFGHIJKLMNÑOPQRSTUVWXYZ" & _
            "áéíóúÁÉÍÓÚàèìòùÀÈÌÒÙçÇ" & _
            "@#~€!·$%&()=!'ºª+-_.,;{}[]" & _
            ":\" & _
            "0123456789" & _
            " " _
        )

        Return Not [String].ToCharArray() _
                   .All(Function(character) Valid_Characters.Contains(character))

        ' Valid_Characters = Nothing

    End Function

#End Region
8182  Programación / Programación General / Re: [Delphi] ImageShack Uploader 0.1 en: 11 Octubre 2013, 23:41 pm
La interface quedó excelente

Crítica constructiva:
Deberías agregarle soporte para recibir argumentos, así sería una aplicación perfecta para agregarla al menú contextual de Windows, ya sabes, click derecho en una imagen > "Imageshack Uploader" y listo, así cargan los archivos más fácilmente.

(Aunque yo no lo necesito porque hice mi propio ImagesHack Uploader de esta manera, solo te doy la idea si quieres copiarla xD)

Un saludo
8183  Programación / Scripting / Re: ayuda a simplificar bat en: 11 Octubre 2013, 22:21 pm
tienes el argumento abierto en Copiar G, encierralo con comillas dobles...

De todas formas puedes eliminar tareas desde el programador de tareas, en el panel de control.

saludos
8184  Programación / Scripting / Re: ayuda a simplificar bat en: 11 Octubre 2013, 20:49 pm
En lugar de copiar los ejemplos de los demás sin entender su funcionamiento deberías procurar buscar lo que significa cada cosa y para que sirven.

El ejemplo de @Segadorfelix contiene dos errores de sintaxis, aquí estás dejando un espacio entre la variable del FOR y la comilla doble \" %%r,
pero además de eso, la variable de FOR contiene una letra, un solo caracter, ¿entonces no crees que aquí faltaría algo más?:
Código:
\" %%r\Hide\start.vbs\"

Hazle un Echo a la cadena para darte cuenta de lo que falta.

Saludos
8185  Programación / Scripting / Re: Batch script --> Informacion SETLOCAL & ENDLOCAL en: 11 Octubre 2013, 17:58 pm
¿Ninguna idea?

Si quieres que el script A reciba una variable del script B entonces tienes que hacer global dicha variable.

Una vez hayas terminado de manejar tus variables locales en el script B, al desactivar ENDLOCAL, podrías setearlas para hacerlas globales, de esta manera:

script A
Código
  1. @Echo OFF & SETLOCAL
  2. Call ScriptB.bat
  3. Echo %var% & REM Result: 123
  4. Pause&Exit

Script B
Código
  1. @Echo OFF & SETLOCAL
  2. Set "var=123"
  3. Set "var=%var%"
  4. )
  5. Exit /B 0

Saludos
8186  Programación / Scripting / Re: [Batch] Ayuda con código en: 11 Octubre 2013, 17:28 pm
Hola

Aquí se ve un fallo a simple vista, te comiste una comilla doble:
Citar
Código:
Set /P "SelectFiles=

Luego aquí no estás redireccionando absolútamente nada:
Citar
Código:
	--------->Activados.txt

No ibas mal encaminado en esta parte, pero esto no es un For, el keyword "Do" solo pertenece a un For, en su lugar usa los operadores lógicos y de comparación "&" "|" "&&"  "||".
Citar
Código:
Type "%Directory%\activados.txt" | Findstr /V /I "!File%%X!" do (set info=Activado)

Aquí no estás expandiendo la variable info, por lo tanto tus checkeos no iban a funcionar corréctamente.
Citar
Código:
Echo %%X. !File%%X! %info% | MORE

Prueba así:
Código:
@Echo OFF & Color 70 & MODE con cols=75
Title Animefiles 1.3.2

REM CD Plugins
if not exist ".\Plugins\Activados.txt" (
REM --------->Activados.txt
Echo. --------->".\Plugins\Activados.txt"
)

:ACTIVAR
cls
SETLOCAL EnableDelayedExpansion
Set "Directory=%CD%\plugins"

For %%# in (
"%Directory%\*.bat"
) Do (
Set /A "FileCount+=1"
Set "File!FileCount!=%%~nx#"
)
echo.
echo ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ |MORE
For /L %%X in (1, 1, !FileCount!) Do (
REM Type "%Directory%\activados.txt" | Findstr /V /I "!File%%X!" do (set info=Activado)
Type "%Directory%\activados.txt" | Findstr /I "!File%%X!" 1>NUL 2>&1 && (
set "info=Activado"
) || (
set "info=Desactivado"
)
REM if not defined info (set info=Desactivado)
REM Echo %%X. !File%%X! %info% | MORE
Echo %%X. !File%%X! !info! | MORE
)
echo ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ|MORE
echo Seleccione el plugin que desea activar:
echo.
Set /P "SelectFiles="
Set "SelectFiles=%SelectFiles: =%"
REM For %%# in (%SelectFiles%) Do (
REM Echo "!File%%#!" >> Activados.txt
REM )
(For %%# in (%SelectFiles%) Do (Echo "!File%%#!"))>> ".\Plugins\Activados.txt"
pause
exit
8187  Programación / Scripting / Re: (Solucionado) [Batch] Randomizar lineas en un txt? en: 11 Octubre 2013, 17:05 pm
No puedo ayudarte mucho más porque no entiendo porque intentas usar las Pipes del For con el programa Clever, no tengo estas utilidades de Winamp y tampoco comentas lo que se supone que debería suceder al redireccionar a este programa, entonces solo puedo aconsejarte que mejores la sintaxis/integridad del código y poco más.

Prueba algo así:
Código
  1. IF %ERRORLEVEL% EQU 0 (cd "%UserProfile%\Desktop\clever pause") | (clever.exe pause 1>nul & Goto :Comprobar)

Código
  1. IF %ERRORLEVEL% EQU 0 (FOR /R %%_ in ("*clever.exe") do (start /B "" "%%_")) | clever.exe pause 1>nul | (Taskkill /F /IM TxtTick.exe >nul & Goto :Esperar)

Saludos
8188  Programación / Scripting / Re: (Solucionado) [Batch] Randomizar lineas en un txt? en: 11 Octubre 2013, 02:56 am
Mientras sigas escribiendo código de la manera en la que lo estás haciendo, los errores no van a cesar.

1. Usa los operadores de agrupación para agrupar los comandos ().

2. Encierra todos los argumentos "" (sobretodo el de la ruta de directorio...).

3. Comprueba si el error se solucionó.

Saludos
8189  Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets) en: 10 Octubre 2013, 23:57 pm
Un ayudante para manejar la aplicación dBpoweramp Music Converter, es el mejor conversor archivos de música a cualquier formato.

http://www.dbpoweramp.com/dmc.htm

Le agregué lo necesario para convertir a MP3, WAV, y WMA, se puede extender para agregar todos los demás codecs, pero es muy tedioso...

Tambiñen le agregué un par de eventos para capturar el progreso de conversión y mensajes de errores, el modo de empleo está explicado en los primeros comentarios.

PD: También existe una librería llamada dMcscriptinglib.dll, pero los autores de dbPowerAmp me dijeron que no es posible capturar el progreso de una conversión usando la librería, por ese motivo uso el executable CLI.

EDITO: Corregido un bug en las Enumeraciones del SampleRate de los Codecs, y he simplificado parte del código.

Código
  1. #Region " CoreConverter Helper "
  2.  
  3.  
  4.  
  5. ' [ CoreConverter Helper ]
  6. '
  7. ' // By Elektro H@cker
  8. '
  9. '
  10. ' Instructions:
  11. '
  12. ' 1. Add the "CoreConverter.exe" into the project,
  13. '    together with the dbPoweramp Effects and Codec folders.
  14. '
  15. ' Examples :
  16. '
  17. ' -------------------
  18. ' CONVERT FILE TO MP3
  19. ' -------------------
  20. ' CoreConverter.Convert_To_MP3("C:\Input.wav", "C:\Output.mp3", _
  21. '                              CoreConverter.Lame_Bitrate.kbps_320, _
  22. '                              CoreConverter.Lame_Bitrate_Mode.cbr, _
  23. '                              CoreConverter.Lame_Profile.SLOW, _
  24. '                              CoreConverter.Lame_Quality.Q0_Maximum, _
  25. '                              CoreConverter.Lame_Khz.Same_As_Source, _
  26. '                              CoreConverter.Lame_Channels.auto, _
  27. '                              { _
  28. '                                CoreConverter.DSP_Effects.Delete_Output_File_on_Error, _
  29. '                                CoreConverter.DSP_Effects.Recycle_Source_File_After_Conversion _
  30. '                              }, _
  31. '                              False, _
  32. '                              CoreConverter.Priority.normal)
  33. '
  34. ' -------------------
  35. ' CONVERT FILE TO WAV
  36. ' -------------------
  37. ' CoreConverter.Convert_To_WAV_Uncompressed("C:\Input.mp3", "C:\Output.wav", _
  38. '                                           CoreConverter.WAV_Uncompressed_Bitrate.Same_As_Source, _
  39. '                                           CoreConverter.WAV_Uncompressed_Khz.Same_As_Source, _
  40. '                                           CoreConverter.WAV_Uncompressed_Channels.Same_As_Source, , False)
  41. '
  42. ' -------------------
  43. ' CONVERT FILE TO WMA
  44. ' -------------------
  45. ' CoreConverter.Convert_To_WMA("C:\Input.mp3", "C:\Output.wma", _
  46. '                              CoreConverter.WMA_9_2_BitRates.Kbps_128, _
  47. '                              CoreConverter.WMA_9_2_Khz.Khz_44100, _
  48. '                              CoreConverter.WMA_9_2_Channels.stereo, , False)
  49. '
  50. ' ------
  51. ' EVENTS
  52. ' ------
  53. ' Public WithEvents Converter As New CoreConverter()
  54. '
  55. ' Sub Converter_Progress(Progress As Integer, e As EventArgs) Handles Converter.PercentDone
  56. '     ProgressBar1.Maximum = 59
  57. '     ProgressBar1.Step = 1
  58. '     ProgressBar1.PerformStep()
  59. ' End Sub
  60. '
  61. ' Sub Converter_Message(Message As String, e As EventArgs) Handles Converter.Exited
  62. '     ProgressBar1.Value = 0
  63. '     MessageBox.Show(Message)
  64. ' End Sub
  65.  
  66.  
  67.  
  68. Public Class CoreConverter : Implements IDisposable
  69.  
  70. #Region " Variables "
  71.  
  72.    ' <summary>
  73.    ' Gets or sets CoreConverter.exe executable path.
  74.    ' </summary>
  75.    Public Shared CoreConverter_Location As String = ".\CoreConverter.exe"
  76.  
  77.    ' Stores the CoreConverter process progress
  78.    Private Shared CurrentProgress As Integer = 0
  79.  
  80.    ' Stores the CoreConverter process StandarOutput
  81.    Private Shared StandardOutput As String = String.Empty
  82.  
  83.    ' Stores the CoreConverter process ErrorOutput
  84.    Private Shared ErrorOutput As String = String.Empty
  85.  
  86.    ' Stores the next output character
  87.    Private Shared OutputCharacter As Char = Nothing
  88.  
  89.    ' Stores the DSP Effects formatted string
  90.    Private Shared Effects As String = String.Empty
  91.  
  92. #End Region
  93.  
  94. #Region " Events "
  95.  
  96.    ' <summary>
  97.    ' Event raised when conversion progress changes.
  98.    ' </summary>
  99.    Public Shared Event PercentDone As EventHandler(Of PercentDoneEventArgs)
  100.    Public Class PercentDoneEventArgs : Inherits EventArgs
  101.        Public Property Progress As Integer
  102.    End Class
  103.  
  104.    ' <summary>
  105.    ' Event raised when CoreConverter process has exited.
  106.    ' </summary>
  107.    Public Shared Event Exited As EventHandler(Of ExitedEventArgs)
  108.    Public Class ExitedEventArgs : Inherits EventArgs
  109.        Public Property Message As String
  110.    End Class
  111.  
  112. #End Region
  113.  
  114. #Region " Process Info "
  115.  
  116.    ' CoreConverter Process Information.
  117.    Private Shared CoreConverter As New Process() With { _
  118.        .StartInfo = New ProcessStartInfo With { _
  119.        .CreateNoWindow = True, _
  120.        .UseShellExecute = False, _
  121.        .RedirectStandardError = True, _
  122.        .RedirectStandardOutput = True, _
  123.        .StandardErrorEncoding = System.Text.Encoding.Unicode, _
  124.        .StandardOutputEncoding = System.Text.Encoding.Unicode}}
  125.  
  126. #End Region
  127.  
  128. #Region " CoreConverter Enumerations "
  129.  
  130.    ' Priority level of CoreConverter.exe
  131.    Enum Priority
  132.        idle
  133.        low
  134.        normal
  135.        high
  136.    End Enum
  137.  
  138.    ' DSP Effects
  139.    Public Enum DSP_Effects
  140.        Delete_Output_File_on_Error ' Delete failed conversion (not deletes source file).
  141.        Delete_Source_File_After_Conversion ' Delete source file after conversion.
  142.        Recycle_Source_File_After_Conversion ' Send source file to recycle bin after conversion.
  143.        Karaoke_Remove_Voice ' Remove voice from file.
  144.        Karaoke_Remove_Instrument ' Remove instruments from file.
  145.        Reverse ' Reverse complete audio file.
  146.        Write_Silence ' Write silence at start of file.
  147.    End Enum
  148.  
  149. #End Region
  150.  
  151. #Region " Codec Enumerations "
  152.  
  153. #Region " MP3 Lame "
  154.  
  155.    Enum Lame_Bitrate
  156.        kbps_8 = 8
  157.        kbps_16 = 16
  158.        kbps_24 = 24
  159.        kbps_32 = 32
  160.        kbps_40 = 40
  161.        kbps_48 = 48
  162.        kbps_56 = 56
  163.        kbps_64 = 64
  164.        kbps_80 = 80
  165.        kbps_96 = 96
  166.        kbps_112 = 112
  167.        kbps_128 = 128
  168.        kbps_144 = 144
  169.        kbps_160 = 160
  170.        kbps_192 = 192
  171.        kbps_224 = 224
  172.        kbps_256 = 256
  173.        kbps_320 = 320
  174.    End Enum
  175.  
  176.    Enum Lame_Bitrate_Mode
  177.        cbr
  178.        abr
  179.    End Enum
  180.  
  181.    Enum Lame_Profile
  182.        NORMAL
  183.        FAST
  184.        SLOW
  185.    End Enum
  186.  
  187.    Enum Lame_Quality
  188.        Q0_Maximum = 0
  189.        Q1 = 1
  190.        Q2 = 2
  191.        Q3 = 3
  192.        Q4 = 4
  193.        Q5 = 5
  194.        Q6 = 6
  195.        Q7 = 7
  196.        Q8 = 8
  197.        Q9_Minimum = 9
  198.    End Enum
  199.  
  200.    Enum Lame_Khz
  201.        Same_As_Source
  202.        khz_8000 = 8000
  203.        khz_11025 = 11025
  204.        khz_12000 = 12000
  205.        khz_16000 = 16000
  206.        khz_22050 = 22050
  207.        khz_24000 = 24000
  208.        khz_32000 = 32000
  209.        khz_44100 = 44100
  210.        khz_48000 = 48000
  211.    End Enum
  212.  
  213.    Enum Lame_Channels
  214.        auto
  215.        mono
  216.        stereo
  217.        joint_stereo
  218.        forced_joint_stereo
  219.        forced_stereo
  220.        dual_channels
  221.    End Enum
  222.  
  223.  
  224. #End Region
  225.  
  226. #Region " WAV Uncompressed "
  227.  
  228.    Enum WAV_Uncompressed_Bitrate
  229.        Same_As_Source
  230.        bits_8 = 8
  231.        bits_16 = 16
  232.        bits_24 = 24
  233.        bits_32 = 32
  234.    End Enum
  235.  
  236.    Enum WAV_Uncompressed_Khz
  237.        Same_As_Source
  238.        khz_8000 = 8000
  239.        khz_11025 = 11025
  240.        khz_12000 = 12000
  241.        khz_16000 = 16000
  242.        khz_22050 = 22050
  243.        khz_24000 = 24000
  244.        khz_32000 = 32000
  245.        khz_44100 = 44100
  246.        khz_48000 = 48000
  247.        khz_96000 = 96000
  248.        khz_192000 = 192000
  249.    End Enum
  250.  
  251.    Enum WAV_Uncompressed_Channels
  252.        Same_As_Source
  253.        Channels_1_Mono = 1
  254.        Channels_2_Stereo = 2
  255.        Channels_3 = 3
  256.        Channels_4_Quadraphonic = 4
  257.        Channels_5_Surround = 5
  258.        Channels_6_Surround_DVD = 6
  259.        Channels_7 = 7
  260.        Channels_8_Theater = 8
  261.    End Enum
  262.  
  263. #End Region
  264.  
  265. #Region " WMA 9.2 "
  266.  
  267.    Enum WMA_9_2_BitRates
  268.        Kbps_12 = 12
  269.        Kbps_16 = 16
  270.        Kbps_20 = 20
  271.        Kbps_22 = 22
  272.        Kbps_24 = 24
  273.        Kbps_32 = 32
  274.        Kbps_40 = 40
  275.        Kbps_48 = 48
  276.        Kbps_64 = 64
  277.        Kbps_80 = 80
  278.        Kbps_96 = 96
  279.        Kbps_128 = 128
  280.        Kbps_160 = 160
  281.        Kbps_192 = 192
  282.        Kbps_256 = 256
  283.        Kbps_320 = 320
  284.    End Enum
  285.  
  286.    Enum WMA_9_2_Khz
  287.        Khz_8000 = 8
  288.        Khz_16000 = 16
  289.        Khz_22050 = 22
  290.        Khz_32000 = 32
  291.        Khz_44100 = 44
  292.        Khz_48000 = 48
  293.    End Enum
  294.  
  295.    Enum WMA_9_2_Channels
  296.        mono
  297.        stereo
  298.    End Enum
  299.  
  300. #End Region
  301.  
  302. #End Region
  303.  
  304. #Region " Codec Procedures "
  305.  
  306. #Region " MP3 Lame "
  307.  
  308.    ' <summary>
  309.    ' Converts a file to MP3 using Lame codec.
  310.    ' </summary>
  311.    Public Shared Sub Convert_To_MP3(ByVal In_File As String, _
  312.                             ByVal Out_File As String, _
  313.                             ByVal Bitrate As Lame_Bitrate, _
  314.                             ByVal Bitrate_Mode As Lame_Bitrate_Mode, _
  315.                             ByVal Encoding_Profile As Lame_Profile, _
  316.                             ByVal Quality As Lame_Quality, _
  317.                             ByVal Khz As Lame_Khz, _
  318.                             ByVal Channels As Lame_Channels, _
  319.                             Optional ByVal DSP_Effects() As DSP_Effects = Nothing, _
  320.                             Optional ByVal Update_Tag As Boolean = True, _
  321.                             Optional ByVal Priority As Priority = Priority.normal, _
  322.                             Optional ByVal Processor As Short = 1)
  323.  
  324.        Get_Effects(DSP_Effects)
  325.  
  326.        Set_Main_Parametters("mp3 (Lame)", In_File, Out_File, If(Not Update_Tag, "-noidtag", ""), Effects, Priority.ToString, Processor.ToString)
  327.  
  328.        CoreConverter.StartInfo.Arguments &= _
  329.        String.Format("-b {0} --{1} -encoding=""{2}"" -freq=""{3}"" -channels=""{4}"" --noreplaygain --extracli=""-q {5}""", _
  330.                      CInt(Bitrate), _
  331.                      Bitrate_Mode.ToString, _
  332.                      Encoding_Profile.ToString, _
  333.                      If(Khz = Lame_Khz.Same_As_Source, "", CInt(Khz)), _
  334.                      If(Channels = Lame_Channels.auto, "", Channels), _
  335.                      CInt(Quality))
  336.  
  337.        Run_CoreConverter()
  338.  
  339.    End Sub
  340.  
  341. #End Region
  342.  
  343. #Region " WAV Uncompressed "
  344.  
  345.    ' <summary>
  346.    ' Converts a file to WAV
  347.    ' </summary>
  348.    Public Shared Sub Convert_To_WAV_Uncompressed(ByVal In_File As String, _
  349.                                 ByVal Out_File As String, _
  350.                                 ByVal Bitrate As WAV_Uncompressed_Bitrate, _
  351.                                 ByVal Khz As WAV_Uncompressed_Khz, _
  352.                                 ByVal Channels As WAV_Uncompressed_Channels, _
  353.                                 Optional ByVal DSP_Effects() As DSP_Effects = Nothing, _
  354.                                 Optional ByVal Update_Tag As Boolean = True, _
  355.                                 Optional ByVal Priority As Priority = Priority.normal, _
  356.                                 Optional ByVal Processor As Short = 1)
  357.  
  358.        Get_Effects(DSP_Effects)
  359.  
  360.        Set_Main_Parametters("Wave", In_File, Out_File, If(Not Update_Tag, "-noidtag", ""), Effects, Priority.ToString, Processor.ToString)
  361.  
  362.        CoreConverter.StartInfo.Arguments &= _
  363.        String.Format("-compression=""PCM"" -bits=""{0}"" -freq=""{1}"" -channels=""{2}""", _
  364.                      If(Bitrate = WAV_Uncompressed_Bitrate.Same_As_Source, "", CInt(Bitrate)), _
  365.                      If(Khz = WAV_Uncompressed_Khz.Same_As_Source, "", CInt(Khz)), _
  366.                      If(Channels = WAV_Uncompressed_Channels.Same_As_Source, "", CInt(Channels)))
  367.  
  368.        Run_CoreConverter()
  369.  
  370.    End Sub
  371.  
  372. #End Region
  373.  
  374. #Region " WMA 9.2 "
  375.  
  376.    ' <summary>
  377.    ' Converts a file to WMA 9.2
  378.    ' </summary>
  379.    Public Shared Sub Convert_To_WMA(ByVal In_File As String, _
  380.                                 ByVal Out_File As String, _
  381.                                 ByVal Bitrate As WMA_9_2_BitRates, _
  382.                                 ByVal Khz As WMA_9_2_Khz, _
  383.                                 ByVal Channels As WMA_9_2_Channels, _
  384.                                 Optional ByVal DSP_Effects() As DSP_Effects = Nothing, _
  385.                                 Optional ByVal Update_Tag As Boolean = True, _
  386.                                 Optional ByVal Priority As Priority = Priority.normal, _
  387.                                 Optional ByVal Processor As Short = 1)
  388.  
  389.        Get_Effects(DSP_Effects)
  390.  
  391.        Set_Main_Parametters("Windows Media Audio 10", In_File, Out_File, If(Not Update_Tag, "-noidtag", ""), Effects, Priority.ToString, Processor.ToString)
  392.  
  393.        CoreConverter.StartInfo.Arguments &= _
  394.        String.Format("-codec=""Windows Media Audio 9.2"" -settings=""{0} kbps, {1} kHz, {2} CBR""",
  395.                      CInt(Bitrate), _
  396.                      CInt(Khz), _
  397.                      Channels.ToString)
  398.  
  399.        Run_CoreConverter()
  400.  
  401.    End Sub
  402.  
  403. #End Region
  404.  
  405. #End Region
  406.  
  407. #Region " Run Converter Procedure "
  408.  
  409.    Private Shared Sub Run_CoreConverter()
  410.  
  411.        CoreConverter.StartInfo.FileName = CoreConverter_Location
  412.        CoreConverter.Start()
  413.  
  414.        While Not CoreConverter.HasExited
  415.  
  416.            OutputCharacter = ChrW(CoreConverter.StandardOutput.Read)
  417.  
  418.            If OutputCharacter = "*" Then
  419.                CurrentProgress += 1 ' Maximum value is 59, so a ProgressBar Maximum property value would be 59.
  420.                RaiseEvent PercentDone(CurrentProgress, Nothing)
  421.            End If
  422.  
  423.            If CurrentProgress = 59 Then
  424.                ' I store the last line(s) 'cause it has interesting information:
  425.                ' Example message: Conversion completed in 30 seconds x44 realtime encoding
  426.                StandardOutput = CoreConverter.StandardOutput.ReadToEnd.Trim
  427.            End If
  428.  
  429.        End While
  430.  
  431.        ' Stores the Error Message (If any)
  432.        ErrorOutput = CoreConverter.StandardError.ReadToEnd
  433.  
  434.        Select Case CoreConverter.ExitCode
  435.  
  436.            Case 0 : RaiseEvent Exited(StandardOutput, Nothing) ' Return StandardOutput
  437.            Case Else : RaiseEvent Exited(ErrorOutput, Nothing) ' Return ErrordOutput
  438.  
  439.        End Select
  440.  
  441.        CurrentProgress = Nothing
  442.        OutputCharacter = Nothing
  443.        StandardOutput = Nothing
  444.        ErrorOutput = Nothing
  445.        Effects = Nothing
  446.        CoreConverter.Close()
  447.  
  448.    End Sub
  449.  
  450. #End Region
  451.  
  452. #Region " Miscellaneous functions "
  453.  
  454.    ' <summary>
  455.    ' Checks if CoreConverter process is avaliable.
  456.    ' </summary>
  457.    Public Shared Function Is_Avaliable() As Boolean
  458.        Return IO.File.Exists(CoreConverter_Location)
  459.    End Function
  460.  
  461.    ' Set the constant parametters of CoreConverter process
  462.    Private Shared Sub Set_Main_Parametters(ByVal Codec_Name As String, _
  463.                                            ByVal In_File As String, _
  464.                                            ByVal Out_File As String, _
  465.                                            ByVal Update_Tag As String, _
  466.                                            ByVal Effects As String, _
  467.                                            ByVal Priority As String, _
  468.                                            ByVal Processor As String)
  469.  
  470.        CoreConverter.StartInfo.Arguments = _
  471.        String.Format("-infile=""{0}"" -outfile=""{1}"" -convert_to=""{2}"" {3} {4} -priority=""{5}"" -processor=""{6}"" ", _
  472.                      In_File, Out_File, Codec_Name, Update_Tag, Effects, Priority, Processor)
  473.  
  474.    End Sub
  475.  
  476.    ' Returns all joined DSP Effects formatted string
  477.    Private Shared Function Get_Effects(ByVal DSP_Effects() As DSP_Effects) As String
  478.  
  479.        If DSP_Effects Is Nothing Then Return Nothing
  480.  
  481.        For Effect As Integer = 0 To DSP_Effects.Length - 1
  482.            Effects &= String.Format(" -dspeffect{0}={1}", _
  483.                                     Effect + 1, _
  484.                                     Format_DSP_Effect(DSP_Effects(Effect).ToString))
  485.        Next Effect
  486.  
  487.        Return Effects
  488.  
  489.    End Function
  490.  
  491.    ' Returns a DSP Effect formatted string
  492.    Private Shared Function Format_DSP_Effect(ByVal Effect As String)
  493.  
  494.        Select Case Effect
  495.            Case "Reverse" : Return """Reverse"""
  496.            Case "Delete_Output_File_on_Error" : Return """Delete Destination File on Error="""
  497.            Case "Recycle_Source_File_After_Conversion" : Return """Delete Source File=-recycle"""
  498.            Case "Delete_Source_File_After_Conversion" : Return """Delete Source File="""
  499.            Case "Karaoke_Remove_Voice" : Return """Karaoke (Voice_ Instrument Removal)="""
  500.            Case "Karaoke_Remove_Instrument" : Return """Karaoke (Voice_ Instrument Removal)=-i"""
  501.            Case "Write_Silence" : Return """Write Silence=-lengthms={qt}2000{qt}""" ' 2 seconds
  502.            Case Else : Return String.Empty
  503.        End Select
  504.  
  505.    End Function
  506.  
  507. #End Region
  508.  
  509. #Region " Dispose Objects "
  510.  
  511.    Public Sub Dispose() Implements IDisposable.Dispose
  512.        ' CoreConverter_Location = Nothing ' Do not change if want to preserve a custom location.
  513.        OutputCharacter = Nothing
  514.        StandardOutput = Nothing
  515.        ErrorOutput = Nothing
  516.        CurrentProgress = Nothing
  517.        Effects = Nothing
  518.        CoreConverter.Close()
  519.        GC.SuppressFinalize(Me)
  520.    End Sub
  521.  
  522. #End Region
  523.  
  524. End Class
  525.  
  526. #End Region
8190  Programación / Scripting / Re: [batch] error con findstr en: 10 Octubre 2013, 21:20 pm
En consola:

Código:
PUSDH /?
Código:
POPD /?

+ http://ss64.com/nt/syntax-redirection.html + http://ss64.com/nt/syntax-args.html

Saludos
Páginas: 1 ... 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 [819] 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 ... 1253
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines