hexagon logo

How to open a python script in pcdmis?

I've got a couple basic scripts running on our programs and you simply go to INSERT > BASIC SCRIPT and chose the .bas file. But it won't let me choose a python file .py.
I tried external command and that doesn't work and I've tried INSERT > FILE I/O COMMAND > FILE OPEN, but when I run the program it runs the program without doing anything inside the python script.

How were those running some python scripts here actually getting pcdmis to open the python script?

Thanks.

Parents
  • OKAY, I GOT IT!!!

    The problem was :
    Set Set vbaShell = VBA.CreateObject("Wscript.Shell") needed to remove the 'VBA.'

    So this code is working now to call my python file...I'm going to try and call my python code now to do some more involved CSV editing...I'll report back.

    I thought the pause line was needed to slow pcdmis down, but it starts the python program without regard for the pause command. PCdmis looks like it allows the python code to continue to run even after the program is finished, which is a good thing.

    Sub Main
    
      Dim vbaShell As Object
      Set vbaShell = CreateObject("Wscript.Shell")
      vbaShell.Run """C:\Users\PNT31\AppData\Local\Programs\Python\Python311\python.exe""" & """C:\Users\PNT31\OneDrive - PNT31\Desktop\test.py"""
      Application.Wait (Now + TimeValue("0:00:10"))
    
    End Sub​
    
Reply
  • OKAY, I GOT IT!!!

    The problem was :
    Set Set vbaShell = VBA.CreateObject("Wscript.Shell") needed to remove the 'VBA.'

    So this code is working now to call my python file...I'm going to try and call my python code now to do some more involved CSV editing...I'll report back.

    I thought the pause line was needed to slow pcdmis down, but it starts the python program without regard for the pause command. PCdmis looks like it allows the python code to continue to run even after the program is finished, which is a good thing.

    Sub Main
    
      Dim vbaShell As Object
      Set vbaShell = CreateObject("Wscript.Shell")
      vbaShell.Run """C:\Users\PNT31\AppData\Local\Programs\Python\Python311\python.exe""" & """C:\Users\PNT31\OneDrive - PNT31\Desktop\test.py"""
      Application.Wait (Now + TimeValue("0:00:10"))
    
    End Sub​
    
Children
No Data