Author Topic: Running shortcut with autolisp  (Read 3592 times)

0 Members and 1 Guest are viewing this topic.

@_Bilal

  • Mosquito
  • Posts: 19
Running shortcut with autolisp
« on: February 12, 2019, 07:19:31 PM »
Hi Guys,

Someone can help me to run from AutoLISP using Shell object the following shortcut
Target: C:\Users\Myfolder\updater.exe /checknow

thank you in advance

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Running shortcut with autolisp
« Reply #1 on: February 12, 2019, 07:57:38 PM »
A bit long in the tooth and I don't have time to test if it still works but the shortcut portion of this code worked way back when ... link.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Lee Mac

  • Seagull
  • Posts: 12905
  • London, England
Re: Running shortcut with autolisp
« Reply #2 on: February 13, 2019, 08:23:20 AM »
This?

Code: [Select]
(command "_.shell" "C:\\Users\\Myfolder\\updater.exe /checknow")

JohnK

  • Administrator
  • Seagull
  • Posts: 10603
Re: Running shortcut with autolisp
« Reply #3 on: February 13, 2019, 08:41:54 AM »
The original question is a little confusing--and I think Lee has already answered it but if the question is: "how to create a shortcut with lisp", I had this in one of my old files. You will have to update the information to suit your needs.

Code - Auto/Visual Lisp: [Select]
  1. ( (lambda ( / sh shorcutlnk)
  2.     ;; how to create a shortcut with Visual Lisp
  3.     (setq sh
  4.           (vla-getInterfaceObject
  5.             (vlax-get-acad-object) "WScript.Shell")
  6.           shortcutlnk (vlax-invoke-method sh 'CreateShortcut (strcat "C:\\Documents and Settings\\" (getvar 'LOGINNAME) "\\Desktop\\AutoCAD MEP (US Imprerial).lnk")))
  7.     (vlax-put-property shortcutlnk 'TargetPath "\\Program Files\\ABS2008\\acad.exe\" /ld \"C:\\Program Files\\ABS2008\\AecBase.dbx\" /p \"AutoCAD (Mech)")
  8.     (vlax-put-property shortcutlnk 'IconLocation "%SystemRoot%\\Installer\\{5783F2D7-6006-0409-0002-0060B0CE6BBA}\\abs2008.ico, 0")
  9.     (vlax-put-property shortcutlnk 'WindowStyle 1)
  10.     (vlax-put-property shortcutlnk 'Hotkey "")
  11.     (vlax-put-property shortcutlnk 'Description "Launch AutoCAD MEP 2008 with Company Profile")
  12.     (vlax-invoke-method shortcutlnk 'Save)
  13.     (vlax-release-object shortcutlnk)
  14.     )
  15.  )
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

@_Bilal

  • Mosquito
  • Posts: 19
Re: Running shortcut with autolisp
« Reply #4 on: February 13, 2019, 09:56:52 AM »
Tanks for All

The target file "updater.exe" resides in
"C:\\Users\\username\\AppData\\Roaming\\softwareFolder\\updater.exe"
While the shortcut "soft_Updater.lnk" resides in
"C:\\Users\\username\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\softwareFolder\\soft_Updater.lnk"

When i ran the updater.exe file from the target directly
(command "_.shell" "C:\\Users\\username\\AppData\\Roaming\\softwareFolder\\updater.exe")
failed result:-------the cmd screen run then close immediatetly

(command "_.shell" "C:\\Users\\username\\AppData\\Roaming\\softwareFolder\\updater.exe /checknow")
success result:-------But two screens run at the same time one is cmd screen and the other is for updater.exe

when trying to run the shortcut "soft_Updater.lnk"
(command "_.shell" "C:\\Users\\username\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\softwareFolder\\soft_Updater.lnk")
failed result:-------the cmd screen run then close immediatetly

When using Lee Mac function
(LM:Open "C:\\Users\\username\\AppData\\Roaming\\softwareFolder\\updater.exe")
return T:-------but nothing happens.

(LM:Open "C:\\Users\\username\\AppData\\Roaming\\softwareFolder\\updater.exe /checknow")
Return nil

(LM:Open "C:\\Users\\username\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\soffold\\soft_Updater.lnk")
Return T:------------the updater.exe run alone without the cmd screen. Which is perfect

What i am looking for is to run (LM:open "C:\\Users\\username\\AppData\\Roaming\\softwareFolder\\updater.exe /checknow")
is it possible?

VovKa

  • Water Moccasin
  • Posts: 1626
  • Ukraine
Re: Running shortcut with autolisp
« Reply #5 on: February 13, 2019, 10:31:43 AM »
no Shell
Code: [Select]
(startapp "C:\\Users\\username\\AppData\\Roaming\\softwareFolder\\updater.exe" "/checknow")

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Running shortcut with autolisp
« Reply #6 on: February 13, 2019, 12:27:58 PM »
Absolute VovKa. :)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

@_Bilal

  • Mosquito
  • Posts: 19
Re: Running shortcut with autolisp
« Reply #7 on: February 13, 2019, 03:05:09 PM »
Great,

(startapp "C:\\Users\\username\\AppData\\Roaming\\softwareFolder\\updater.exe" "/checknow")
success result:-------------updater.exe run in a proper manner

Thanks, Vovka, and Thanks every budy