Jump to content

Using a shortcut on my desktop


cyberal
 Share

Recommended Posts

I would like to be able to use a shortcut that is on my desktop which in turn points to a location of a batch file and execute the batch file. A shortcut can be configured to place the window at a specified location and size the window. I have been looking at "runwait" and "shellexecutewait" but cannot get them to work. Any suggestions as to what I am doing wrong or what the proper syntax would be?

Thanks - cyberal

Yah, I'm an old fart, but what the hey, still enjoy keeping busy

Link to comment
Share on other sites

Hi and Welcome to the forums!!

Any suggestions as to what I am doing wrong

Kinda hard to suggest anything as you haven't shown us what you are doing, don't you agree? :)

To provide good answers, we need to see some code. We are not mind-readers. If your script is long or you can't disclose it for some reason, then post a reproducer (short working example script).

Link to comment
Share on other sites

You are so right.

This works runwait("c:\users\al\desktop\batchbufiles\menumain.bat") This is where the actual batch file resides

This doesn't work runwait("c:\users\al\desktop\menumain.lnk") This is where the actual shortcut resides

And I don't know what the actual file extension is for a shortcut, but probably not ".lnk" ??

This also works local $val = ShellExecuteWait ("C:\users\al\desktop\batchbufiles\menumain.bat") again, where the batch file resides

The only "include" I am using is <GUIConstantsEx.au3>

Hope this helps

cyberal

Yah, I'm an old fart, but what the hey, still enjoy keeping busy

Link to comment
Share on other sites

Here try this, works for me.

After testing them i have noticed a problem and it is:

If ink file is in @DesktopCommonDir then it is not a actual file on the desktop but acts like one. To work around this problam you need to use the following codes:

Run(@ComSpec & ' /c "Google Earth.lnk"', @DesktopCommonDir, @SW_HIDE)

or

ShellExecuteWait(@DesktopCommonDir & "Google Earth.lnk")

________________________________________________________________

IF the file actually exists on the desktop then use the following codes:

Run(@ComSpec & ' /c "Google Earth.lnk"', @DesktopDir, @SW_HIDE)

or

ShellExecuteWait(@DesktopDir & "Google Earth.lnk")

As you can see i tested it out on Google Earth.lnk

Edited by Guest
Link to comment
Share on other sites

  • Moderators

Or simply use shellexecute rather than run:

ShellExecuteWait(@DesktopDir & "menumain.lnk")

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

JLogan3o13,

This worked perfectly. I also did not know the the link name on my desktop looks like this "menumain.bat - Shortcut.lnk" and I kept trying "menumain.lnk" You pointed me in the right direction and I appreciate your help. I am a newbe at this.

Thanks again

cyberal

Yah, I'm an old fart, but what the hey, still enjoy keeping busy

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...