Jump to content

Recommended Posts

Posted (edited)
Global Const $DIR_WA_FOLDER         = @MyDocumentsDir & '\Whatsapp Extension'
Global Const $DIR_SHORTCUT          = @DesktopDir     & '\WhatsappWeb.exe'

Func _Create_Shortcut()
    Local $sMessage = "Creating shortcut "

    _Metro_SplashTextScreen(1, "", $sMessage)
    AdlibRegister("_Metro_LoopInProgress")

    If FileExists($DIR_WA_FOLDER) Then
        $iDelete = FileDelete($DIR_SHORTCUT)
        If $iDelete Then
            _FileWriteLog($LOG_INSTALLATION, "Debug: Desktop's shortcut is deleted.")
        Else
            _FileWriteLog($LOG_INSTALLATION, "Debug: Desktop's shortcut is not found. But, desktop's shortcut is still created.")
        EndIf

        If FileExists($DIR_WA_FOLDER & '\WhatsappWeb.exe') Then
            $iCreate = FileCreateShortcut($DIR_WA_FOLDER & '\WhatsappWeb.exe', $DIR_SHORTCUT)
            If $iCreate Then
                _Metro_MsgBox(0, "", "Desktop shortcut is now created!")
                _FileWriteLog($LOG_INSTALLATION, "Debug: Desktop's shortcut is created.")
            Else
                _Metro_MsgBox(0, "", "Desktop shortcut is failed to created!")
                _FileWriteLog($LOG_INSTALLATION, "Error: Fail to create shortcut.")
            EndIf
        Else
            _Metro_MsgBox(0, "", "Source not found!")
            _FileWriteLog($LOG_INSTALLATION, "Error: WhatsappWeb.exe is not found.")
        EndIf
    Else
        _Metro_MsgBox(0, "", "Source not found!")
        _FileWriteLog($LOG_INSTALLATION, "Error: Whatsapp Extension folder is not found.")
    EndIf

    AdlibUnRegister("_Metro_LoopInProgress")
    _Metro_SplashTextScreen(0)
EndFunc

So I do have a button to trigger this create shortcut to desktop.
But after it created shortcut at desktop, I cannot execute the shortcut as it has no any response.

Then I go try trigger the file at the source path @MyDocumentDir & '\Whatsapp Extension\WhatsappWeb.exe' and it work as expected.
Then I go to check my log, and it shows:- (P/S: I already did trigger the function twice)

2019-02-28 23:27:32 : Debug: Desktop's shortcut is not found. But, desktop's shortcut is still created.
2019-02-28 23:27:33 : Debug: Desktop's shortcut is created.
2019-02-28 23:28:40 : Debug: Desktop's shortcut is not found. But, desktop's shortcut is still created.
2019-02-28 23:28:41 : Debug: Desktop's shortcut is created.

So based on my log shows, it failed to locate the shortcut, but it did exists there.

 

P/S: This project is done developed weeks ago, every testing is passed. Is just somehow the executable cannot be execute. :o

 

 

Any advise?

Edited by gahhon
Posted
41 minutes ago, Subz said:

Where is the ".lnk" extension?  The shortcut filename would be "WhatsappWeb.exe.lnk" not "WhatsappWeb.exe"

Okay. The log message is solved, but the shortcut is still can't execute.

 

Posted

Check the shortcut properties, is it pointing to the correct path?  Create a shortcut manually that works and compare it against the Autoit shortcuts.

Posted
5 hours ago, Subz said:

Check the shortcut properties, is it pointing to the correct path?  Create a shortcut manually that works and compare it against the Autoit shortcuts.

image.png.780b3c942dc46fb570429a0c92022647.png

It missing the Start in: <Path>

Posted
8 hours ago, Subz said:

So did you try:

FileCreateShortcut($DIR_WA_FOLDER & '\WhatsappWeb.exe', $DIR_SHORTCUT, $DIR_WA_FOLDER)

 

After adding the workingdir is working fine. But I wonder why workingdir? I thought it optional tho?

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
×
×
  • Create New...