Code: Select all
Exec ["/home/bill/GambasFolder/Executable/DocsViewer.gambas"]
Code: Select all
Exec ["/home/bill/GambasFolder/Executable/DocsViewer.gambas"]
Exec arguments are an array, additional parameters just need more strings.bill-lancaster wrote: ↑Friday 26th January 2024 9:51am I run a gambas executable from another gambas project by:-How can I provide an entry value (a file name) to DocsViewer.gambas?Code: Select all
Exec ["/home/bill/GambasFolder/Executable/DocsViewer.gambas"]
'
Exec ["gambas3", "/path/myproject"]
'
'or
Shell "gambas3 /path/myproject"
'
Exec ["gambas3", "/path/myproject"] With ["GB_GUI=gb.qt5"]
'
Code: Select all
Print Exist(User.Home &/ "GambasFolder/Executable/Golf.gambas")
Exec ["gambas3", "GambasFolder/Executable/Golf.gambas"]
Exec ["/home/bill/GambasFolder/Executable/DocsViewer.gambas", "/path/to/thedoc/item.doc"]
Code: Select all
Exec ["gbr3", "GambasFolder/Executable/DocsViewer.gambas"] With ["sTemp=XXX"]
Exec ["gbr3", "GambasFolder/Executable/DocsViewer.gambas", "sTemp=XXX"]
Public Sub Form_Open()
If Env["sTemp"] then ' Check for sTemp env variable
OpenFile(Env["sTemp"])
Endif
End
Yes, use the more advanced Args.class componentbill-lancaster wrote: ↑Saturday 27th January 2024 1:37pm
BTW I extract the argument value with Split(Args[1], "=")[1] is there a better way?
Public sub Form_Open()
Dim aFiles As New String[]
Args.Begin("Title, shows as header when user type --help") ' start processing args
Dim sFile As String = Args.Get("f", "file" , "Open a File", "Path") ' if user types -f "filename" then name is stored.
aFiles = Args.End() ' finish processing args, all unhandled args are returns as a list.
If sFile Then aFiles.Add(sFile,0) ' if -f or --file was used then put that file at head of the list.
If aFiles.Count Then ' now open each filename given as an argument
For Each sFile In aFiles
OpenFileInNewTab(sFile)
Next
Endif
End