eageleyes Posted June 3, 2007 Share Posted June 3, 2007 Hi there: My basic aim is to open an application from the start menu. For e.g i have installed Adobe Photoshop 7.0 and its shortcut is created inside it. I have opened the start menu + all program. Now i want this selection to be systematically done. For this purpose my mind says: "Sort the start menu items simply by opening the context menu and selecting Sort by Name", but how to find the specific text like "Adobe Photoshop 7.0" along with other items. I can do this simply by MouseClick but this isn't the right way for doing it, bcoz i donno if i wanna open the same applicatoin in different PC then its not necessary that it should be present there. Simply i wanna learn Sorting + Searching Strings Concept. Hope to hear! Thanx in Advance Link to comment Share on other sites More sharing options...
MHz Posted June 3, 2007 Share Posted June 3, 2007 To automate the start menu in the same way that you may do with the mouse and using your vision to identify shortcut links is not easy for a script to do because the script lacks the vision. To handle the start menu, I will give an example of using the file system to find the shortcut link and run it. If Not _Execute_Startmenu_Link(@StartMenuDir, 'notepad.exe') Then _Execute_Startmenu_Link(@StartMenuCommonDir, 'notepad.exe') EndIf Exit Func _Execute_Startmenu_Link($path, $exe_name) Local $link, $link_split Local $exe_length = StringLen($exe_name) ; Get startmenu link paths and store them in $link Local $pid = Run('"' & @ComSpec & '" /c dir /b/s "' & $path & '\*.lnk"', '', @SW_HIDE, 2) Do $link &= StdOutRead($pid) Until @error ; Split the paths into an array $link_split = StringSplit($link, @CRLF, 1) $link = '' ; Loop through the array For $i = 1 To $link_split[0] If FileExists($link_split[$i]) And StringRight($link_split[$i], 4) = '.lnk' Then $link = FileGetShortcut($link_split[$i]) ; If the right side of the path matches the $exe_name, the run it. If Not @error And $link[0] <> '' And StringRight($link[0], $exe_length) = $exe_name Then If FileExists($link[0]) Then Run($link[0]) Return True EndIf EndIf EndIf Next 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