Jump to content
Sign in to follow this  

Array problems

Recommended Posts


#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
        $ShortcutFile = FileFindNextFile($SearchHandle); Otherwise continue the search
FileClose($SearchHandle); Close handle

If $IsInShortcutDir = True Then; If confirmed
    MsgBox(0,0,"Shortcut founded")
#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?


Share this post

Link to post
Share on other sites

You must use ABSOLUTE path

;      ConsoleWrite(@StartupCommonDir & '\' & $ShortcutFile & @LF)
       $ShortcutData = FileGetShortcut(@StartupCommonDir & '\' & $ShortcutFile); Get details about the shortcut
Doh thanks :P.

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.