xnbyte Posted July 20, 2007 Share Posted July 20, 2007 (edited) I know the Windows Explorer.exe has a Command-Line Option "select,". It could target a shortcut to its exact folder and file. And the article is here. http://support.microsoft.com/kb/314853/en-usSo I could target the shortcut in AutoIt as below:$NotepadLnk = FileGetShortcut(@DesktopDir & "\Notepad.lnk");I suppose there is a Notepad shortcut in the desktop Run("Explorer.exe" & " /select, " & $NotepadLnk[0])oÝ÷ Ù8^vvö§qëayÊzÚ-j¸µ©ò²+µËo(±Ê'µìméîêÞËayÊy«¢+Ø9½QÉå%½¸()I]É¥Ñ ÅÕ½Ðí!- HÀäÈí±¹¥±ÀäÈíÍ¡±°ÀäÈíQÉÑ1¹¬ÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì°ÅÕ½ÐíI}MhÅÕ½Ðì°ÅÕ½ÐíQÉй±¹¬ÅÕ½Ðì¤)I]É¥Ñ ÅÕ½Ðí!- HÀäÈí±¹¥±ÀäÈíÍ¡±°ÀäÈíQÉÑ1¹¬ÀäÈí½µµ¹ÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì°ÅÕ½ÐíI}MhÅÕ½Ðì°ÌäìÅÕ½ÐíáÁ±½ÉȹáÅÕ½ÐìÌäìµÀìÅÕ½Ðì½Í±Ð°ÅÕ½ÐìµÀìÕ±±AÑ ÅÕ½ÐìÄÅÕ½Ð줤()Õ¹Õ±±AÑ ÀÌØí1¹¥±¤(ÀÌØíô¥±ÑM¡½ÉÑÕÐ ÀÌØí1¹¥±¤(%ÉÑÕɸ ÀÌØílÁt¤)¹Õ¹However, there is a error of "Subscript used with non-Array variable." in Line 8. Then I don't know how to fix it. Does someone have an idea? Thanks. Edited July 20, 2007 by xnbyte Link to comment Share on other sites More sharing options...
MHz Posted July 20, 2007 Share Posted July 20, 2007 However, there is a error of "Subscript used with non-Array variable." in Line 8. Then I don't know how to fix it. Does someone have an idea? Thanks.I would say that you are getting the error as the shortcut does not exist. I am unsure of your direction of this by using RegWrite() and other functions but if it involves simply running a shortcut or document, then perhaps ShellExecute() or ShellExecuteWait() maybe easier to use? Open a shortcut like this ShellExecute(@DesktopDir & '\notepad.lnk')oÝ÷ Úè¥éÚv.éí)¶¬jëh×6ShellExecute(@DesktopDir & '\test.txt') Link to comment Share on other sites More sharing options...
xnbyte Posted July 20, 2007 Author Share Posted July 20, 2007 I am unsure of your direction of this by using RegWrite() and other functions but if it involves simply running a shortcut or document, then perhaps ShellExecute() or ShellExecuteWait() maybe easier to use?Thank MHz for your reply. But all I want is to target instead execute the shortcut. Link to comment Share on other sites More sharing options...
MHz Posted July 20, 2007 Share Posted July 20, 2007 Thank MHz for your reply. But all I want is to target instead execute the shortcut.This example will return the path stored in the shortcut. $value = FullPath(@DesktopDir & '\notepad.lnk') If Not @error Then MsgBox(0x40000, 'value =', $value) EndIf Exit Func FullPath($LnkFile) ; Return a path from a shortcut Local $array If FileExists($LnkFile) Then $array = FileGetShortcut($LnkFile) If Not @error And IsArray($array) Then Return $array[0] Else Return SetError(1, 0, '') EndIf EndIf EndFunc Link to comment Share on other sites More sharing options...
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