cyberal Posted February 2, 2012 Share Posted February 2, 2012 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 More sharing options...
AdmiralAlkex Posted February 2, 2012 Share Posted February 2, 2012 Hi and Welcome to the forums!!Any suggestions as to what I am doing wrongKinda 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). .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
Guest Posted February 2, 2012 Share Posted February 2, 2012 The syntax to run a bat file from the same directory and wait until it has ended. ShellExecuteWait ( @ScriptDir&"filename.bat" , "" , "" , "open") Link to comment Share on other sites More sharing options...
cyberal Posted February 2, 2012 Author Share Posted February 2, 2012 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 More sharing options...
cyberal Posted February 2, 2012 Author Share Posted February 2, 2012 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 Link to comment Share on other sites More sharing options...
Guest Posted February 3, 2012 Share Posted February 3, 2012 (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 February 3, 2012 by Guest Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted February 3, 2012 Moderators Share Posted February 3, 2012 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 More sharing options...
Guest Posted February 3, 2012 Share Posted February 3, 2012 Tested, See Link to comment Share on other sites More sharing options...
cyberal Posted February 3, 2012 Author Share Posted February 3, 2012 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 againcyberal Yah, I'm an old fart, but what the hey, still enjoy keeping busy Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted February 3, 2012 Moderators Share Posted February 3, 2012 Glad it got you where you needed to be "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 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