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úCita de: Seazoux en 11 Enero 2013, 13:44 PM
Dime un codigo snippet que yo use en el Launcher. Gracias :p
Cita de: Seazoux en 11 Enero 2013, 12:10 PMque son snippets?
objshell.run """" & appdata & "\Ikillnukes\OPT.hta" & """"
objshell.run appdata & "\Ikillnukes\RUN.bat"
objshell.run appdata & "\Ikillnukes\OPT.hta"
Function runear()
setTimeout "ejecutar()",1000
End Function
<script type="text/javascript">
TODOS los códigos de VBS aquí, comentados y organizados.
</script>
My_Process_Info.FileName = "CMD.exe"
My_Process_Info.Arguments = "/k pause"
My_Process_Info.FileName = "CMD.exe" ' Process filename
My_Process_Info.Arguments = "/k For /L %a in (1,1,100000) do echo afijgifjigjfgjifjgi" ' Process arguments
Dim My_Process As New Process()
Dim My_Process_Info As New ProcessStartInfo()
My_Process_Info.FileName = "CMD.exe" ' Process filename
My_Process_Info.Arguments = "/k For /L %a in (1,1,100000) do echo afijgifjigjfgjifjgi" ' Process arguments
My_Process_Info.UseShellExecute = False ' Don't use system shell to execute the process
My_Process_Info.CreateNoWindow = False ' Show the CMD Window
My_Process_Info.RedirectStandardOutput = True ' Redirect (1) Output
My_Process_Info.RedirectStandardError = True ' Redirect non (1) Output
My_Process.EnableRaisingEvents = True
My_Process.StartInfo = My_Process_Info
My_Process.Start() ' Run the process
My_Process.WaitForExit() ' Wait X miliseconds to kill the process
Dim Process_StandardOutput = My_Process.StandardOutput.ReadToEnd() ' Stores the Standard Output (If any)
Dim Process_ErrorOutput = My_Process.StandardOutput.ReadToEnd() ' Stores the Error Output (If any)
Dim Process_StartTime As String = My_Process.StartTime ' Stores the time when the process was launched
Dim Process_EndTime As String = My_Process.ExitTime ' Stores the time when the process was finished
Dim ERRORLEVEL = My_Process.ExitCode ' Stores the ExitCode of the process
Dim result = Process_StartTime & vbNewLine & Process_EndTime & vbNewLine & ERRORLEVEL
MsgBox(result)
MsgBox(Process_StandardOutput)
MsgBox(Process_ErrorOutput)
' Usage:
'
' MsgBox(ConvertToDiscSize(737280000, "Bytes", "CD"))
' MsgBox(ConvertToDiscSize(700, "MB", "CD"))
' MsgBox(Math.Ceiling(ConvertToDiscSize(6.5, "GB", "DVD")))
' MsgBox(ConvertToDiscSize(40, "GB", "BR").ToString.Substring(0, 3) & " Discs")
#Region " Convert To Disc Size function"
Private Function ConvertToDiscSize(ByVal FileSize As Double, ByVal FileKindSize As String, ByVal To_DiscKindCapacity As String)
' KindSize Measures:
' --------------------------
' Bytes
' KB
' MB
' GB
' ToDiscKind Measures:
' -----------------------------
' CD
' CD800
' CD900
' DVD
' DVD-DL
' BR
' BR-DL
' BR-3L
' BR-4L
' BR-MD
' BR-MD-DL
' Bytes
If FileKindSize.ToUpper = "BYTES" Then
If To_DiscKindCapacity.ToUpper = "CD" Then Return FileSize / 737280000 ' CD Standard
If To_DiscKindCapacity.ToUpper = "CD800" Then Return FileSize / 829440393.216 ' CD 800 MB
If To_DiscKindCapacity.ToUpper = "CD900" Then Return FileSize / 912383803.392 ' CD 900 MB
If To_DiscKindCapacity.ToUpper = "DVD" Then Return FileSize / 4700000000 ' DVD Standard (DVD5
If To_DiscKindCapacity.ToUpper = "DVD-DL" Then Return FileSize / 8500000000 ' DVD Double Layer (DVD9)
If To_DiscKindCapacity.ToUpper = "BR" Then Return FileSize / 25025314816 ' BluRay Standard
If To_DiscKindCapacity.ToUpper = "BR-DL" Then Return FileSize / 50050629632 ' BluRay Double Layer
If To_DiscKindCapacity.ToUpper = "BR-3L" Then Return FileSize / 100103356416 ' BluRay x3 Layers
If To_DiscKindCapacity.ToUpper = "BR-4L" Then Return FileSize / 128001769472 ' BluRay x4 Layers
If To_DiscKindCapacity.ToUpper = "BR-MD" Then Return FileSize / 7791181824 ' BluRay MiniDisc Standard
If To_DiscKindCapacity.ToUpper = "BR-MD-DL" Then Return FileSize / 15582363648 ' BluRay MiniDisc Double Layer
' KB
ElseIf FileKindSize.ToUpper = "KB" Then
If To_DiscKindCapacity.ToUpper = "CD" Then Return FileSize / 720000 ' CD Standard
If To_DiscKindCapacity.ToUpper = "CD800" Then Return FileSize / 810000.384 ' CD 800 MB
If To_DiscKindCapacity.ToUpper = "CD900" Then Return FileSize / 890999.808 ' CD 900 MB
If To_DiscKindCapacity.ToUpper = "DVD" Then Return FileSize / 4589843.75 ' DVD Standard (DVD5)
If To_DiscKindCapacity.ToUpper = "DVD-DL" Then Return FileSize / 8300781.25 ' DVD Double Layer (DVD9)
If To_DiscKindCapacity.ToUpper = "BR" Then Return FileSize / 24438784 ' BluRay Standard
If To_DiscKindCapacity.ToUpper = "BR-DL" Then Return FileSize / 48877568 ' BluRay Double Layer
If To_DiscKindCapacity.ToUpper = "BR-3L" Then Return FileSize / 97757184 ' BluRay x3 Layers
If To_DiscKindCapacity.ToUpper = "BR-4L" Then Return FileSize / 125001728 ' BluRay x4 Layers
If To_DiscKindCapacity.ToUpper = "BR-MD" Then Return FileSize / 7608576 ' BluRay MiniDisc Standard
If To_DiscKindCapacity.ToUpper = "BR-MD-DL" Then Return FileSize / 15217152 ' BluRay MiniDisc Double Layer
' MB
ElseIf FileKindSize.ToUpper = "MB" Then
If To_DiscKindCapacity.ToUpper = "CD" Then Return FileSize / 703.125 ' CD Standard
If To_DiscKindCapacity.ToUpper = "CD800" Then Return FileSize / 791.016 ' CD 800 MB
If To_DiscKindCapacity.ToUpper = "CD900" Then Return FileSize / 870.117 ' CD 900 MB
If To_DiscKindCapacity.ToUpper = "DVD" Then Return FileSize / 4482.26929 ' DVD Standard (DVD5)
If To_DiscKindCapacity.ToUpper = "DVD-DL" Then Return FileSize / 8106.23169 ' DVD Double Layer (DVD9)
If To_DiscKindCapacity.ToUpper = "BR" Then Return FileSize / 23866 ' BluRay Standard
If To_DiscKindCapacity.ToUpper = "BR-DL" Then Return FileSize / 47732 ' BluRay Double Layer
If To_DiscKindCapacity.ToUpper = "BR-3L" Then Return FileSize / 95466 ' BluRay x3 Layers
If To_DiscKindCapacity.ToUpper = "BR-4L" Then Return FileSize / 122072 ' BluRay x4 Layers
If To_DiscKindCapacity.ToUpper = "BR-MD" Then Return FileSize / 7430.25 ' BluRay MiniDisc Standard
If To_DiscKindCapacity.ToUpper = "BR-MD-DL" Then Return FileSize / 14860.5 ' BluRay MiniDisc Double Layer
' GB
ElseIf FileKindSize.ToUpper = "GB" Then
If To_DiscKindCapacity.ToUpper = "CD" Then Return FileSize / 0.68665 ' CD Standard
If To_DiscKindCapacity.ToUpper = "CD800" Then Return FileSize / 0.77248 ' CD 800 MB
If To_DiscKindCapacity.ToUpper = "CD900" Then Return FileSize / 0.84972 ' CD 900 MB
If To_DiscKindCapacity.ToUpper = "DVD" Then Return FileSize / 4.37722 ' DVD Standard (DVD5)
If To_DiscKindCapacity.ToUpper = "DVD-DL" Then Return FileSize / 7.91624 ' DVD Double Layer (DVD9)
If To_DiscKindCapacity.ToUpper = "BR" Then Return FileSize / 23.30664 ' BluRay Standard
If To_DiscKindCapacity.ToUpper = "BR-DL" Then Return FileSize / 46.61328 ' BluRay Double Layer
If To_DiscKindCapacity.ToUpper = "BR-3L" Then Return FileSize / 93.22852 ' BluRay x3 Layers
If To_DiscKindCapacity.ToUpper = "BR-4L" Then Return FileSize / 119.21094 ' BluRay x4 Layers
If To_DiscKindCapacity.ToUpper = "BR-MD" Then Return FileSize / 7.2561 ' BluRay MiniDisc Standard
If To_DiscKindCapacity.ToUpper = "BR-MD-DL" Then Return FileSize / 14.51221 ' BluRay MiniDisc Double Layer
End If
Return Nothing ' Argument measure not found
End Function
#End Region
' Usage:
'
' RenameFile("C:\Test.txt", "TeSt.TxT")
' RenameFile("C:\Test.txt", "Test", "doc")
' RenameFile(FileInfoObject.FullName, FileInfoObject.Name.ToLower, FileInfoObject.Extension.ToUpper)
' If RenameFile("C:\Test.txt", "TeSt.TxT") Is Nothing Then MsgBox("El archivo no existe!")
#Region " RenameFile function "
Private Function RenameFile(ByVal File As String, ByVal NewFileName As String, Optional ByVal NewFileExtension As String = Nothing)
If IO.File.Exists(File) Then
Try
Dim FileToBeRenamed As New System.IO.FileInfo(File)
If NewFileExtension Is Nothing Then
FileToBeRenamed.MoveTo(FileToBeRenamed.Directory.FullName & "\" & NewFileName) ' Rename file with same extension
Else
FileToBeRenamed.MoveTo(FileToBeRenamed.Directory.FullName & "\" & NewFileName & NewFileExtension) ' Rename file with new extension
End If
Return True ' File was renamed OK
Catch ex As Exception
' MsgBox(ex.Message)
Return False ' File can't be renamed maybe because User Permissions
End Try
Else
Return Nothing ' File doesn't exist
End If
End Function
#End Region
' Usage:
' Attrib("File.txt", IO.FileAttributes.ReadOnly + IO.FileAttributes.Hidden)
' If Attrib("File.txt", IO.FileAttributes.System) Is Nothing Then MsgBox("File doesn't exist!")
Private Function Attrib(ByVal File As String, ByVal Attributes As System.IO.FileAttributes)
If IO.File.Exists(File) Then
Try
FileSystem.SetAttr(File, Attributes)
Return True ' File was modified OK
Catch ex As Exception
' MsgBox(ex.Message)
Return False ' File can't be modified maybe because User Permissions
End Try
Else
Return Nothing ' File doesn't exist
End If
End Function
Private Sub Button_Is_Clicked(sender As Object, e As EventArgs) Handles _
Button1.Click, _
Button2.Click, _
Button3.Click
Dim Clicked_Button As Button = CType(sender, Button)
If Clicked_Button.Name = "Button1" Then
' Things for Button1
ElseIf Clicked_Button.Name = "Button2" Then
' Things for Button2
ElseIf Clicked_Button.Name = "Button3" Then
' Things for Button3
End If
Ens Sub
' First add a LinkLabel control into the form.
Private Sub LinkLabel_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
System.Diagnostics.Process.Start("http://www.Google.com")
System.Diagnostics.Process.Start("mailto:ME@Hotmail.com")
End Sub
For Each ResourceFile As DictionaryEntry In My.Resources.ResourceManager.GetResourceSet(Globalization.CultureInfo.CurrentCulture, True, True).OfType(Of Object)()
If TypeOf (ResourceFile.Value) Is String Then
MsgBox(My.Resources.ResourceManager.GetObject(ResourceFile.Key))
'MsgBox(ResourceFile.Key) ' Resource Name
'MsgBox(ResourceFile.Value) ' Resource FileContent
End If
Next
For Each ResourceFile As DictionaryEntry In My.Resources.ResourceManager.GetResourceSet(Globalization.CultureInfo.CurrentCulture, True, True).OfType(Of Object)()
If TypeOf (ResourceFile.Value) Is Drawing.Image Then
Button_2000_2006.Image = ResourceFile.Value
'MsgBox(ResourceFile.Key) ' Resource Name
'MsgBox(ResourceFile.Value) ' Resource FileContent
End If
Next
' Instructions:
' 1. Add the class
' 2. Add the declaration
' 3. Add a listview
Dim ColumnOrder As String = "Down"
#Region " ListView Sort Column event "
Private Sub ListView_ColumnClick(ByVal sender As Object, ByVal e As System.Windows.Forms.ColumnClickEventArgs) Handles ListView1.ColumnClick
If ColumnOrder = "Down" Then
Me.ListView1.ListViewItemSorter = New OrdenarListview(e.Column, SortOrder.Ascending)
ListView1.Sort()
ColumnOrder = "Up"
ElseIf ColumnOrder = "Up" Then
Me.ListView1.ListViewItemSorter = New OrdenarListview(e.Column, SortOrder.Descending)
ListView1.Sort()
ColumnOrder = "Down"
End If
End Sub
#End Region
#Region " OrdenarListView [CLASS] "
Public Class OrdenarListview
Implements IComparer
Private vIndiceColumna As Integer
Private vTipoOrden As SortOrder
Public Sub New(ByVal pIndiceColumna As Integer, ByVal pTipoOrden As SortOrder)
vIndiceColumna = pIndiceColumna
vTipoOrden = pTipoOrden
End Sub
Public Function Ordenar(ByVal x As Object, ByVal y As Object) As Integer Implements System.Collections.IComparer.Compare
Dim item_x As ListViewItem = DirectCast(x, ListViewItem)
Dim item_y As ListViewItem = DirectCast(y, ListViewItem)
Dim string_x As String
If item_x.SubItems.Count <= vIndiceColumna Then
string_x = ""
Else
string_x = item_x.SubItems(vIndiceColumna).Text
End If
Dim string_y As String
If item_y.SubItems.Count <= vIndiceColumna Then
string_y = ""
Else
string_y = item_y.SubItems(vIndiceColumna).Text
End If
If vTipoOrden = SortOrder.Ascending Then
If IsNumeric(string_x) And IsNumeric(string_y) Then
Return Val(string_x).CompareTo(Val(string_y))
ElseIf IsDate(string_x) And IsDate(string_y) Then
Return DateTime.Parse(string_x).CompareTo(DateTime.Parse(string_y))
Else
Return String.Compare(string_x, string_y)
End If
Else
If IsNumeric(string_x) And IsNumeric(string_y) Then
Return Val(string_y).CompareTo(Val(string_x))
ElseIf IsDate(string_x) And IsDate(string_y) Then
Return DateTime.Parse(string_y).CompareTo(DateTime.Parse(string_x))
Else
Return String.Compare(string_y, string_x)
End If
End If
End Function
End Class
#End Region
Dim SaveFile As New SaveFileDialog
SaveFile.Title = "Save a Report File"
SaveFile.InitialDirectory = Environ("programfiles")
SaveFile.RestoreDirectory = True
SaveFile.DefaultExt = "txt"
SaveFile.Filter = "txt file (*.txt)|*.txt"
SaveFile.CheckPathExists = True
'SaveFile.CheckFileExists = True
'SaveFile.ShowDialog()
If SaveFile.ShowDialog() = DialogResult.OK Then
MsgBox(SaveFile.FileName)
End If
#Region " CenterForm function "
Function CenterForm(ByVal Form_to_Center As Form, ByVal Form_Location As Point) As Point
Dim FormLocation As New Point
FormLocation.X = (Me.Left + (Me.Width - Form_to_Center.Width) / 2) ' set the X coordinates.
FormLocation.Y = (Me.Top + (Me.Height - Form_to_Center.Height) / 2) ' set the Y coordinates.
Return FormLocation ' return the Location to the Form it was called from.
End Function
#End Region
' Form2 Load
Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.Location = Form1.centerForm(Me, Me.Location)
End Sub
' Private Sub Button_MouseHover(sender As Object, e As EventArgs) Handles Button1.MouseHover
' Form2.Show()
' End Sub
' Private Sub Button_MouseLeave(sender As Object, e As EventArgs) Handles Button1.MouseLeave
' Form2.Dispose()
' End Sub