hexagon logo

Please help/guide/or just do it; Basic script to open other basic scripts

I am not providing a code sample, but at the end of this I hope one will exist. Ultimately I want a .BAS that opens a dialog that allows me to execute other .BAS files I have created. It'd be great if they can be assigned to buttons instead of a file selection dialog.

I want this functionality because the PC-DMIS toolbars don't work properly- they lose the icon leaving a blank toolbar- leaving me to guess what is what. With a .BAS like the one I have described I can assign just one user defined command and not care that it is a blank icon.

Is anyone versed enough in BASIC to help me with this?
  • I am not providing a code sample, but at the end of this I hope one will exist. Ultimately I want a .BAS that opens a dialog that allows me to execute other .BAS files I have created. It'd be great if they can be assigned to buttons instead of a file selection dialog.

    I want this functionality because the PC-DMIS toolbars don't work properly- they lose the icon leaving a blank toolbar- leaving me to guess what is what. With a .BAS like the one I have described I can assign just one user defined command and not care that it is a blank icon.

    Is anyone versed enough in BASIC to help me with this?


    Have you tried to correct this with the Settings Editor using the Reset User back to default ?
  • I have not tried this. Won't this destroy all of my settings and toolbars and directories? I don't want to rock the PC-DMIS boat as most things currently work well...

    Don't want to go off topic...I'm still interested in the .BAS
  • I have not tried this. Won't this destroy all of my settings and toolbars and directories? I don't want to rock the PC-DMIS boat as most things currently work well...

    Don't want to go off topic...I'm still interested in the .BAS
    Chances are that your user settings are corrupted anyways. I would reset your user settings and recreate your customized toolbars. Then create a backup of the new toolbars using the Settings Editor. I always save these backup files with a date code because this will happen again and its easer to restore your toolbars then recreate them. Also, once you get your customize toolbars where you want them take a screen shot of your toolbars to make it easer to recreate them if your backup file doesn't work correctly.
  • Yeah, there is something very wrong with the toolbar code section...
  • So...Can anyone help with this (original post)? Or tell me if it's even possible? It'd be a great tool to run snippets of code...
  • It's possible. Everything is possible with computers, it just takes different amounts of time.

    Unfortunately your wish seems to me to be TMWFTLB ("too much work for too little benefit") - the time would in my opinion be better spent fixing the PC-DMIS toolbars (but neither you nor I can do that)...

    You can of course combine all your basic snippets in one gigantic .BAS-file, and begin with a dialog that jumps to the selected function. I don't know how large a basic script may be...

    I can't find anything in the PC-DMIS Basic Help indicating a way to call another basic script file, so to do what you want will probably need an external program in VB/C#/C++/Delphi/whatever, and every script you want to include in the system will have to be translated to the programming language you choose to use.

    TMWFTLB...
  • Ultimately I want a .BAS that opens a dialog that allows me to execute other .BAS files I have created.


    I tried something similar (trying to keep everything inside PcDmis) but abandoned the effort due to the limited functionality of Cypress and it's GUI. Instead, I have a single toolbar BAS file that calls a EXE (compiled AutoIt) that launches Excel, opens a workbook and loads a tabbed form. The form has command buttons for different scripts (sometimes with additional dialogs). For me, it's easier to manage and changes can be made on the fly. It lets me keep the little code I have all in one place.

    BAS that calls the EXE which starts Excel...
    Sub Main()
    	Dim oApp as Object
    	Dim sPath as String
    	
    	Set oApp = CreateObject("PCDLRN.Application")
    	sPath = oApp.GetRegistryString("Option", "SubroutineUserSearchDirectory", "Nada")
    	Set oApp = Nothing
    	
    	sPath = sPath & "RunPcDmisMacros.exe"
    	Shell ( sPath )
    	
    End Sub


    Thanks to AndersI for mentioning AutoIt in other posts. A really valuable tool that's also been helpful outside of PcDmis.
  • AutoIt is very good, but you may have to re-create your AutoIt scripts when changing computer, video resolution, version of the called software (e.g. Excel), etc. depending on how you do the automation.
  • You can of course combine all your basic snippets in one gigantic .BAS-file, and begin with a dialog that jumps to the selected function. I don't know how large a basic script may be...


    I see no problem with this. Sounds perfect. Perhaps it can wait for a single keystroke and jump based on that. Problem is- I don't know how to code this stuff. Are there any examples of code that contain dialogs, "if" or "case" type evaluation? If so I could start ripping it apart and learning.

    (All of my basic scripts are just modifications of exporting snippets of code from PC-DMIS. The only syntax I know how to employ is the ' comment character.)
  • You can of course combine all your basic snippets in one gigantic .BAS-file, and begin with a dialog that jumps to the selected function. I don't know how large a basic script may be...


    ^^ This! I have been thinking of a "toolbox" containing a dialog that allows you to select the script to run and it executes when pressing the button...