Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

VBScript logic to AutoIt - Please Help

$
0
0

Hi Guys,

 

I have written a code in VB Script, but i wanted to use AutoIt to deliver my project. Please help me,
I have a folder which contains, few *.txt, *.xml files.
My requirement is:
1. To get the Parent Folder Path. (e.g. C:\temp)
2. After Getting the Parent folder, i want to get the Path of the .txt and .xml files present in the Parent Folder (e.g. C:\temp\Sample.txt)

 
I can do this in VBScript using objWMIService.ExecQuery

Can we do the same in AutoIt, am new to AutoIt... Please Help.

My VBScript for doing the above requirement.

 

'***************GET PARENT FOLDER PATH *******************
If fso.FileExists(WScript.Arguments(0)) Then
Set objFile = fso.GetFile(WScript.Arguments(0))
ReqFolder = objfile.ParentFolder
End If
'***************GET PARENT FOLDER PATH *******************

strComputer = "."

Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
    
Set FileList = objWMIService.ExecQuery ("ASSOCIATORS OF {Win32_Directory.Name=" & "'" & ReqFolder & "'" & "} where ResultClass = CIM_DataFile")
For Each objFile In FileList

 

 

 '******************Looking for TXT file ***************************
      If objFile.Extension = "txt" Then
        txtname = objFile.Drive & objFile.Path & objFile.FileName & "." & "TXT"
      End If
 '******************Looking for TXT file ***************************

Please help me with AutoIt for above requirement.

 

 

Cheers,

Mohan


Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>