使用 AutoIT 打开 RDP 文件

Opening RDP File With AutoIT

我是 AutoIT 的新手,正在寻找打开 RDP 文件的帮助。 RDP 文件在我的下载文件夹中可用。大多数时候我不知道我的 RDP 文件。我想打开最近下载的 RDP 文件。有人可以帮我处理代码吗?现在,我只是尝试通过对文件名进行硬编码来打开 RDP 文件,它可以运行 PFB 代码,但我需要找到最近下载的 RDP 文件并打开它,而不是对其进行硬编码。

Run("explorer.exe " & "C:\Users\Balaji\Downloads")
Run(@Comspec & " /c start " & FileGetShortName('C:\Users51615\Downloads\TestRDP.rdp'))

试试这个!这应该查看所有文件 *.rdp 的下载文件夹,然后对数组进行排序,这样您就可以获得最新修改的文​​件,然后 运行 它。

#include <Array.au3>
#include <File.au3>
#include <MsgBoxConstants.au3>

;~ Global $downloadPath = 'C:\Users\Balaji\Downloads'
Global $downloadPath = @UserProfileDir & '\Downloads'

Global $rdpFiles = _FileListToArray($downloadPath, '*.rdp', $FLTA_FILES, True)

Global $ar[UBound($rdpFiles)][2]

For $i = 1 To UBound($rdpFiles) - 1
    $ar[$i][0] = $rdpFiles[$i]
    $ar[$i][1] = FileGetTime($rdpFiles[$i], $FT_MODIFIED, $FT_STRING )
Next

_ArraySort($ar, 1, Default, Default, 1)
; _ArrayDisplay($ar) ; If you want to have at look at the array

Run($ar[0], '', @SW_MAXIMIZE)