Pagina con resumen de enlaces Autoit

Antes de ir al Soporte consultame aquí, gracias
Responder
Avatar de Usuario
BasicOs
Site Admin
Mensajes: 2083
Registrado: 21 Nov 2006, 19:24
Ubicación: El Internet - (Canarias, España)
Contactar:

Re: Pagina con resumen de enlaces Autoit

Mensaje por BasicOs »

Enlaces de autoit:

Como convertir un batch2exe con autoit:

Código: Seleccionar todo

;Hacer un batch ejecutable

#include <File.au3>



Dim $TempBatchFile = _TempFile(@TempDir,"",".bat")

Dim $HideConsole = False



FileInstall("MiBatch.bat",$TempBatchFile)



If $HideConsole Then

    RunWait($TempBatchFile,@TempDir,@SW_HIDE)

Else

    RunWait($TempBatchFile,@TempDir)

EndIf



FileDelete($TempBatchFile)



MsgBox(64,"Hecho","Ejecutado completamente!")
No muestra la “caja del DOS”. Si quieres ver la consola, cambiar esta linea:

Dim $HideConsole = False a: --> Dim $HideConsole = True
La console debería aparecer

Tambien, la linea:
FileInstall(“MiBatch.bat”,$TempBatchFile)
Es donde se pone la ruta completa del fichero bat. Cambia Mibatch.bat a el nombre del fichero, no se puede usar una variable en FileInstall.
Compila tu script y ya está listo! Instantaneamente fichero bat compilado! Fuente


Cosas en autoit con unas pocas lineas de código. Programitas rápidos que se pueden usar en tus scripts.

Determinar Unidad o Recurso de red (Drive or Network Share)

Determinamos si se arraca del disco local o de una carpeta de red, mostrará el disco o el recurso.

Código: Seleccionar todo

Dim $LocationType

Dim $Location

 

If StringMid(@ScriptDir,2,1)=":" Then

    $LocationType = "Drive"

Else

    $LocationType = "Network"

EndIf

 

Switch $LocationType

    Case "Drive"

        $Location = StringLeft(@ScriptDir,2)

    Case "Network"

        $Location = StringLeft(@ScriptDir,StringInStr(@ScriptDir,"\",-1,4))

EndSwitch

 

MsgBox(0,$LocationType,$Location)

 
Reemplace Texto en un Fichero

Usar este codigo para reemplazar cada instancia de un trozo de texo con otro texto diferente.

Código: Seleccionar todo


$TextFileName = "TextFile.txt"

$FindText = "dog"

$ReplaceText = "cat"

 

$FileContents = FileRead($TextFileName)

$FileContents = StringReplace($FileContents,$FindText,$ReplaceText)

FileDelete($TextFileName)

FileWrite($TextFileName,$FileContents)
Internet Downloader de ficheros

Puede generar su propia barra de progreso al bajar un fichero con este programita:

Código: Seleccionar todo


$FileURL = "http://www.DailyCupOfTech.com/Downloads/TorparkSetup.exe"

$FileName = "TorparkSetup.exe"

$FileSaveLocation = FileSaveDialog("Save Location...",@ScriptDir,"All (*.*)",18,$FileName)

$FileSize = InetGetSize($FileURL)

 

InetGet($FileURL,$FileName,0,1)

 

ProgressOn("","")

While @InetGetActive

    $Percentage = @InetGetBytesRead * 100 / $FileSize

    ProgressSet($Percentage,"Downloaded " & @InetGetBytesRead & " of " & $FileSize & " bytes","Downloading " & $FileName)

    Sleep(250)

Wend

ProgressOff()

 

MsgBox(0, "Done","Download Complete!")

 
Crear un acceso directo(Shortcut)

Este script crea un acceso en el escritorio para el notepad.

Código: Seleccionar todo


$FileName = "C:\Windows\Notepad.exe"

$LinkFileName = @DesktopDir & "\Text Editor.lnk"

$WorkingDirectory = @DesktopDir

$Icon = "C:\Windows\system32\SHELL32.dll"

$IconNumber = 57

$Description = "This is the text editor that comes with Windows"

$State = @SW_SHOWMAXIMIZED ;Can also be @SW_SHOWNORMAL or @SW_SHOWMINNOACTIVE

 

FileCreateShortcut($FileName,$LinkFileName,$WorkingDirectory,"",$Description,$Icon,"",$IconNumber,$State)
Muestra Información del disco

Recupera información especifica de cada unidad conectada al sistema.

Código: Seleccionar todo


$DriveArray = DriveGetDrive("all")

If Not @error Then

    $DriveInfo = ""

    For $DriveCount = 1 to $DriveArray[0]

        $DriveInfo &= StringUpper($DriveArray[$DriveCount])

        $DriveInfo &= " -  File System = " & DriveGetFileSystem($DriveArray[$DriveCount])

        $DriveInfo &= ",  Label = " & DriveGetLabel($DriveArray[$DriveCount])

        $DriveInfo &= ",  Serial = " & DriveGetSerial($DriveArray[$DriveCount])

        $DriveInfo &= ",  Type = " &  DriveGetType($DriveArray[$DriveCount])

        $DriveInfo &= ",  Free Space = " & DriveSpaceFree($DriveArray[$DriveCount])

        $DriveInfo &= ",  Total Space = " & DriveSpaceTotal($DriveArray[$DriveCount])

        $DriveInfo &= ",  Status = " & DriveStatus($DriveArray[$DriveCount])

        $DriveInfo &= @CRLF

    Next

    MsgBox(4096,"Drive Info", $DriveInfo)

EndIf

 
Determina si un Proceso está en marcha

Chequea para ver si un nombre de proceso esta corriendo e indica su estado.

Código: Seleccionar todo

$ProcessName = "Notepad.exe"

 If ProcessExists($ProcessName) Then

    MsgBox(0,"Running",$ProcessName & " esta corriendo.")

Else

    MsgBox(0,"Not Running",$ProcessName & " no está corriendo.")

EndIf

 
ProcessRunning.au3

Genera un número aleatorio

Genera un random number entre dos valores especificados:

Código: Seleccionar todo


$LowerLimit = 104

$UpperLimit = 213

 

$RandomNumber = Random($LowerLimit,$UpperLimit,1)

 

MsgBox(0,"Random Number",$RandomNumber)
RandomNumber.au3

Contador de tiempo

Este programa cuenta los segundos que ha pasado hasta que un cierto número ha sido alcanzado.

Código: Seleccionar todo

SplashTextOn("Timer","0 Seconds",125,25)

 

$BeginTime = TimerInit()

$CountTo = 10

$SecondsLapsed = 0

 

While $SecondsLapsed<$CountTo

    $TimeDifference = TimerDiff($BeginTime)

    $SecondsLapsed = Round($TimeDifference/1000,0)

 

    ControlSetText("Timer", "", "Static1", $SecondsLapsed & " Seconds")

    Sleep(1000)

WEnd

 
Timer.au3

Se pueden hacer miles. Si tienes alguno puedes postearlo.
Fuente

Otros consejos y programitas:
http://www.google.com/cse?cx=0061655775 ... of=FORID:1
Responder