Sign in to follow this  
Followers 0
Dev

Run A Shortcut?

41 posts in this topic

Ive found out that the only way to run one of my "homemade" C++ apps via AutoIt is to run it via a shortcut. Nothing else does work. Can i have AutoIt to run a shortcut in the same folder as the EXE-file?

Thanks for looking at this, hope you can help me :whistle:

Share this post


Link to post
Share on other sites



Ive found out that the only way to run one of my "homemade" C++ apps via AutoIt is to run it via a shortcut. Nothing else does work.

WHAT ?! Nah..

Are you sure that you're using Run properly ?

Run ("filename", "workingdir", flag)

Example :

Run ("CPlusPlusProgram.exe", "C:\MyPrograms", @SW_MAXIMIZE)
Are you sure that you are pointing "workingdir" to the correct directory ?

If you're C++ program is in the same directory as the AutoIt-script,

then you can use @ScriptDir instead of "C:\MyPrograms"

Share this post


Link to post
Share on other sites

I tried everything, but its something in the parameters as causing this problem, i dont know why. I need hmm... two parameters, it works fine if i use the shortcut, but not if i run it via AutoIt...

Strange... Very strange :whistle:

:iamstupid:

Share this post


Link to post
Share on other sites

CyberSlug:

I dont get that to work :whistle:

Here is my code:

[...]
Run(@ComSpec & " /c " & "c:/launcher.ink")
[...]

:iamstupid:

Share this post


Link to post
Share on other sites

Elll, not eye. Its a lowercase L, not an uppercase i. Its short for Link.

Share this post


Link to post
Share on other sites

Oh, sorry...

"Maybe" thats why it doesnt work :whistle:

:iamstupid:

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

i had trouble with that before to but i never got it to work i finally just told it to use the run.exe thing

Edited by zCoCoz

Share this post


Link to post
Share on other sites

I get errors if I run the EXE...

:iamstupid:

Share this post


Link to post
Share on other sites

And are you going to tell us what the error is or are you going to make us guess ???? :whistle:

Maybe showing the code that has the error also helps ....


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Run(@ComSpec & ' /c start "" c:/launcher.lnk') <- W2000

Run(@ComSpec & ' /c start c:/launcher.lnk') <- W9x

Edited as josbe advice.

Edited by ezzetabi

Share this post


Link to post
Share on other sites

For this reason, the best way is to use the ', instead "

For example,

Run(@ComSpec & ' /c start "c:/launcher.lnk"') <- W2000
Run(@ComSpec & ' /c start c:/launcher.lnk') <- W9x

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

For this reason, the best way is to use the ', instead "

For example,

Run(@ComSpec & ' /c start "c:/launcher.lnk"') <- W2000
Run(@ComSpec & ' /c start c:/launcher.lnk') <- W9x
@josbe or ezzetabi: I'm havin' a bit of trouble w/ this one... apparently it doesn't like to launch shortcuts that are located on the desktop? Dumb question: just add the .lnk to the end of the shortcut's title?

Here's my code:

Run ( @ComSpec & ' /c start "C:\Documents and Settings\UserName\Desktop\shortcut.lnk"' )

No dice; error message below:

Cannot find the file 'C:\Documents' (or one of its components).  Make sure the path and filename are correct and that all required libraries are available.

:postal:

EDIT: Well, now I'm around that error message, but rather than launching the shortcut it gives me a dos-esk command prompt to a folder on my desktop... :D

Edited by esfalk

Share this post


Link to post
Share on other sites

why use start ? .... try it this way to see if that helps:

Run ( @ComSpec & ' /c "C:\Documents and Settings\UserName\Desktop\shortcut.lnk"' )

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

<sing> ... did you ever know that you're my hero ... </sing>

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

well i try to make a program that runs a shortcut from the desktop or better say the internet PPPoE i want to run but i cant make it work

can someone help me ???

the problem is that is working too fast i mean i cant see nothing :|

or can you give me some idea or source code of some how i can run a internet conection shortcut ??? ( i want to make to auto start my internet conection with out going in control panel -> network connection -> rds -> enter

Run ( @ComSpec & ' /c "C:\Users\All Users\Desktop\rds.ink"' )

ok i find the problem :)

#include <Process.au3>
_RunDOS("ncpa.cpl")

my god ( i never think at that in all my life)

Edited by mircea

Share this post


Link to post
Share on other sites

i am having the same problem

Run ( @ComSpec & '/c C:\Documents and Settings\Aria\Desktop\BitComet.lnk"' )

nothing happens when the script is run, it just sits there, how the heck do i launch a shortcut? the above posts have done nothing to help me i have followed all


Intermediate AutoIt/Autohotkey User

Share this post


Link to post
Share on other sites

ShellExecute(@DesktopDir & "\BitComet.lnk")


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

i got an error

cannot find C:\Documents and settings\.....\Desktop\BitComet.lnk

somehow i dont think its ".lnk"


Intermediate AutoIt/Autohotkey User

Share this post


Link to post
Share on other sites

Check that with FileExists()

If FileExists(@DeskTopDir & "\bitcomet.lnk") Then MsgBox(0, "Results", "It's a link")

There is another way to do it if it is actually a lnk file but you will need to know that first.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

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