Hello Guest it is March 28, 2024, 10:22:20 AM

Author Topic: os.execute pdf  (Read 987 times)

0 Members and 1 Guest are viewing this topic.

Offline gorf23

*
  •  183 183
    • View Profile
os.execute pdf
« on: April 02, 2019, 10:16:06 PM »
is there a way to run a pdf file from a button?

Tried os.execute but can't seem to get that to work.

Thanks gary

Offline Chaoticone

*
  • *
  •  5,624 5,624
  • Precision Chaos
    • View Profile
Re: os.execute pdf
« Reply #1 on: April 03, 2019, 08:51:31 AM »
Code: [Select]
local major, minor = wx.wxGetOsVersion()
    local dir = mc.mcCntlGetMachDir(inst);
    local cmd = "explorer.exe /open," .. dir .. "\\Docs\\MyDoc.pdf"
    if(minor <= 5) then -- Xp we don't need the /open
        cmd = "explorer.exe ," .. dir .. "\\Docs\\MyDoc.pdf"
    end
    wx.wxExecute(cmd)
;D If you could see the things I have in my head, you would be laughing too. ;D

My guard dog is not what you need to worry about!

Offline gorf23

*
  •  183 183
    • View Profile
Re: os.execute pdf
« Reply #2 on: April 03, 2019, 11:43:52 AM »
Yes I tried that also but couldn't run that from a button... there was some sort of restriction couldn't be run from ? forgot the message..

I did get the os.execute to work turns out windows firewall was blocking it from running,,

thanks gary
Re: os.execute pdf
« Reply #3 on: April 03, 2019, 01:21:42 PM »
Hello Gary,

Create a function in the screenload script with the script provided in Chaoticone's comment. Then, use a button to call the function.

It is also worth mentioning that the path included in that script requires your document to be in the Docs subfolder in your Mach4 directory.

-B
Newfangled Solutions Helpdesk: http://support.machsupport.com
YouTube Support Channel: https://www.youtube.com/c/MachSupportOfficial

Offline gorf23

*
  •  183 183
    • View Profile
Re: os.execute pdf
« Reply #4 on: April 03, 2019, 01:52:42 PM »
ok thanks will try that i was using it in the button script itself will put in the screen load script.
Also i do already have the file in the docs folder..

Thanks Gary