Machsupport Forum
Mach Discussion => Mach4 General Discussion => Topic started by: gorf23 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
-
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)
-
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
-
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
-
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