PantZ4 Posted August 1, 2008 Posted August 1, 2008 #Region - Find shortcut for executable $IsInShortcutDir = False $SearchHandle = FileFindFirstFile(@StartupCommonDir & "\" & "*.lnk"); Find all .lnk files in the commen startup dir If $SearchHandle <> - 1 Then; If any shortcut were founded. $ShortcutFile = FileFindNextFile($SearchHandle); Get first file While Not @error; Loop until no more files $ShortcutData = FileGetShortcut($ShortcutFile); Get details about the shortcut If $ShortcutData[0] = @ScriptFullPath Then; If shortcut leads to the executable $IsInShortcutDir = True; Then confirm it ExitLoop; And exit loop EndIf $ShortcutFile = FileFindNextFile($SearchHandle); Otherwise continue the search WEnd EndIf FileClose($SearchHandle); Close handle If $IsInShortcutDir = True Then; If confirmed MsgBox(0,0,"Shortcut founded") EndIf #EndRegion - Find shortcut for executable Anyone that can point out the error here? I get the "Subscript used with non-Array variable" error upon "If $ShortcutData[0] = ..." line. Why? Thanks.
Zedna Posted August 1, 2008 Posted August 1, 2008 You must use ABSOLUTE path ; ConsoleWrite(@StartupCommonDir & '\' & $ShortcutFile & @LF) $ShortcutData = FileGetShortcut(@StartupCommonDir & '\' & $ShortcutFile); Get details about the shortcut Resources UDF ResourcesEx UDF AutoIt Forum Search
PantZ4 Posted August 1, 2008 Author Posted August 1, 2008 You must use ABSOLUTE path ; ConsoleWrite(@StartupCommonDir & '\' & $ShortcutFile & @LF) $ShortcutData = FileGetShortcut(@StartupCommonDir & '\' & $ShortcutFile); Get details about the shortcut Doh thanks .
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now