Sign in to follow this  
Followers 0
cyberal

Using a shortcut on my desktop

10 posts in this topic

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

Share this post


Link to post
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).

Share this post


Link to post
Share on other sites

The syntax to run a bat file from the same directory and wait until it has ended.

ShellExecuteWait ( @ScriptDir&"filename.bat" , "" , "" , "open")

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Aipion,

Yes that works, but I want to use a shortcut on my desktop to start the actual batch file.

cyberal


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

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

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 Aipion

Share this post


Link to post
Share on other sites

Or simply use shellexecute rather than run:

ShellExecuteWait(@DesktopDir & "menumain.lnk")

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Tested, See

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Glad it got you where you needed to be :)


√-1 2^3 ∑ π, and it was delicious!

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  
Followers 0