Sign in to follow this  
Followers 0
au3scr

ShellExecute () dont work for shortcut

8 posts in this topic

ShellExecute("C:\Documents and Settings\rain\Desktop\hama (2).lnk")

Any ideas how to get this thing work? i need to execute *.lnk files

current example here dont work.


Share this post


Link to post
Share on other sites



Hmm, Its working for me!

Could you try renaming it to 'hama(2)' ?

AlmarM


Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites

I tried .. didnt worked, here is other examples that dont work

ShellExecute("C:\Documents and Settings\rain\Desktop\smite.lnk")

ShellExecute("C:\Documents and Settings\rain\Desktop\Doom3.lnk")


Share this post


Link to post
Share on other sites

I tried .. didnt worked, here is other examples that dont work

ShellExecute("C:\Documents and Settings\rain\Desktop\smite.lnk")

ShellExecute("C:\Documents and Settings\rain\Desktop\Doom3.lnk")

Have you tried...?

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

Share this post


Link to post
Share on other sites

Have you tried...?

ShellExecute(@DesktopDir & "\Doom3.lnk")
Arg! Just what I wanted to say :)

@ au3scr

Try what he said >_<

AlmarM


Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I dno whats wrong, I just cant get it work

Edit:Still dont work

Posted Image

Edited by au3scr

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

I dno whats wrong, I just cant get it work

Edit:Still dont work

Posted Image

I just wrote this...it works on my PC

Try this

#cs --------------------------------------------------------------------------------------------
    
    AutoIt Version: 3.2.12.1
    Author:      erik7426
    
    Script Function:
    If available gets the path to the executable from a shortcut(.lnk) file
    and then runs the executable.
    
    Requirements:   $lnk = name of a valid shortcut including path
    Return Values:
    SUCCESS - Returns 0
    FAILURE - Returns 1 if the shortcut is not found
    FAILURE - Returns 2 if there is an error extracting the executable path
    Example:    FileShortcutRunWait(@DesktopDir & "\MyProgram.lnk")
    
#cE --------------------------------------------------------------------------------------------

FileShortcutRun(@DesktopDir & "\Doom3.lnk")




Func FileShortcutRun($lnk)
    If Not FileExists($lnk) Then
        Return (1)
    EndIf
    
    $filepath = FileGetShortcut($lnk)
    If @error = 1 Then
        Return (2)
    EndIf
    Run($filepath[0], $filepath[1])
    Return (0)
EndFunc;==>FileShortcutRun

Func FileShortcutRunWait($lnk)
    If Not FileExists($lnk) Then
        Return (1)
    EndIf
    
    $filepath = FileGetShortcut($lnk)
    If @error = 1 Then
        Return (2)
    EndIf
    RunWait($filepath[0], $filepath[1])
    Return (0)
EndFunc;==>FileShortcutRunWait
Edited by erik7426

Share this post


Link to post
Share on other sites

@erik7426

My great thanks to you. yours version works


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