Sign in to follow this  
Followers 0
trof

Convert a batch script to Autoit

4 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

#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,
 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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.

Share this post


Link to post
Share on other sites

Thank you very much Trong and jdelaney

A complex script, compliments

Share this post


Link to post
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
Sign in to follow this  
Followers 0