Jump to content
Sign in to follow this  

Finding required text (name of application) and opening it.

Recommended Posts


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

Share this post

Link to post
Share on other sites

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')


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)
        $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
                    Return True


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