gahhon Posted February 28, 2019 Posted February 28, 2019 (edited) expandcollapse popupGlobal 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. Any advise? Edited February 28, 2019 by gahhon
Subz Posted February 28, 2019 Posted February 28, 2019 Where is the ".lnk" extension? The shortcut filename would be "WhatsappWeb.exe.lnk" not "WhatsappWeb.exe"
gahhon Posted February 28, 2019 Author Posted February 28, 2019 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.
Subz Posted February 28, 2019 Posted February 28, 2019 Check the shortcut properties, is it pointing to the correct path? Create a shortcut manually that works and compare it against the Autoit shortcuts.
gahhon Posted March 1, 2019 Author Posted March 1, 2019 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. It missing the Start in: <Path>
Subz Posted March 1, 2019 Posted March 1, 2019 So did you try: FileCreateShortcut($DIR_WA_FOLDER & '\WhatsappWeb.exe', $DIR_SHORTCUT, $DIR_WA_FOLDER)
gahhon Posted March 1, 2019 Author Posted March 1, 2019 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?
Earthshine Posted March 2, 2019 Posted March 2, 2019 Because the app that you’re trying to launch requires it most likely My resources are limited. You must ask the right questions
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