Jump to content

Convert a batch script to Autoit


trof
 Share

Recommended Posts

Hi,

I need to convert this batch script to Autoit script

FOR %%i IN (D E F G H I J K L M N O P Q R S T U V W X Y Z) DO IF EXIST %%i:\FDisc.txt SET DiscoF=%%i:
FOR %%m IN (%DiscoF%\Documenti\Download\HONEYVIEW-PORTABLE\*.exe) DO SET INST=%%m
start /wait %INST%

I know how translate %DiscoF% variable
I use this code (thanks to the Developer guinness)

Local $aSplit = StringSplit('D E F G H I J K L M N O P Q R S T U V W X Y Z', ' '), _
        $sDrive = '', _
For $i = 1 To $aSplit[0]
    If FileExists($aSplit[$i] & ':\FDisc.txt') Then
        $sDrive = $aSplit[$i] & ':\'

but I don't know how translate %INST% variable

Edited by trof
Link to comment
Share on other sites

#include <File.au3>

Local $aSplit = StringSplit('DEFGHIJKLMNOPQRSTUVWXYZ', ''), $sDrive, $sFileList
For $i = 1 To $aSplit[0]
    If FileExists($aSplit[$i] & ':\FDisc.txt') Then
        $sDrive = $aSplit[$i] & ':\'
        ConsoleWrite("! Found: " & $sDrive & @CRLF)
        $sFileList = _FileListToArray($sDrive & '\Documenti\Download\HONEYVIEW-PORTABLE', '*.exe', 1, 1)
        For $x = 1 To UBound($sFileList) - 1
            ConsoleWrite("! Execute: " & $sFileList[$x] & @CRLF)
            RunWait($sFileList[$x])
        Next
        ;ExitLoop
    EndIf
Next

 

Edited by Trong

Regards,
 

Link to comment
Share on other sites

Slight modification:

#include <File.au3>
$a = DriveGetDrive("All")
For $i = 1 To UBound($a)-1
    If FileExists($a[$i] & '\FDisc.txt') Then
        $sFileList = _FileListToArray($a[$i] & '\Documenti\Download\HONEYVIEW-PORTABLE', '*.exe', 1, 1)
        For $x = 1 To UBound($sFileList) - 1
            RunWait($sFileList[$x])
        Next
    EndIf
Next

 

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...