Jump to content
Macro Express Forums

Need To Determine If A Link Is On The Desktop


Recommended Posts

The If File Exists command will work. Here are a couple of sample macros:


Simple macro to determine if the file is on the desktop:

// Get path to the Desktop
Set Variable %T1% to "Path to Desktop"
Variable Set String %T4% "SM56pci LtMoh.lnk"
If File Exists "%T1%\%T4%"
 Text Box Display: Found the file
End If

This macro types the names of all shortcuts on the desktop into Notepad.

// Activate or Launch Notepad
Activate or Launch: "Notepad" OR "notepad.exe"

// Get path to the Desktop
Set Variable %T1% to "Path to Desktop"

// Loop through all files on the desktop and write the filenames into notepad
Repeat with Folder
 // Get the file extension
 Variable Set From File Path
 Text Box Display: DEBUG T1 T2 T3
 // Only do this if the file extension is lnk
 If Variable %T3% = ".lnk"
   // If Notepad does not have focus, activate it
   If Not Window Title "Notepad" on top
     Activate Window: "Notepad"
   End If
   // Type the name of the shortcut
   Text Type: %T2%<ENTER>
 End If
Repeat End

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...