B4A.BASE.JOBI.RUN@WIN
Summary
- Object type
- JOBI
- Object Folder
- PACKAGES/BEST4AUTOMIC/B4A.BASE/SOURCE/RUN
- Title
- Generic include for starting b4A modules on WIndows systems
- Archive Key 1
- -
- Archive Key 2
- -
- Created
- WRITER/B4A am: 2022-03-24 08:01:39
- Last Modified
- WRITER/B4A am: 2024-01-09 10:09:52 14 x
- Last Used
- -
Description
This include starts a b4A module on Microsoft Windows systems
Parameter
- $MODULE$
- The name of the b4A module. Separated by a colon (:) names of configuration variable names can be specified. The names are the suffix of variable objects called B4A.BASE.VARA.CONFIG#
Input
Output
Example
:include B4A.BASE.JOBI.RUN@UNIX $MODULE$ = "info.Search"
Process
! read module name and config options
:set &module# = "$MODULE$"
:define ¶m#, string, 2
:fill ¶m#[] = str_split( &module#, ":" )
:set &module# = ¶m#[ 1 ]
:set &configs# = ¶m#[ 2 ]
:define &config#, string, 10
:fill &config#[] = str_split( &configs#, "," )
! publish module name
:set &B4AB_CLASS_O# = "&module#"
:publish &B4AB_CLASS_O#, , TASK
! create configuration file
$finalconfig = New-TemporaryFile
:set &num# = 1
:while &config#[ &num# ] <> ""
: set &vara# = "B4A.BASE.VARA.CONFIG#&config#[ &num# ]"
: set &hnd# = prep_process_var( &vara# )
: process &hnd#
: set &key# = get_process_line( &hnd#, 1 )
: set &value# = get_process_line( &hnd#, 2 )
"&key# = &value#" | Add-Content $finalconfig.fullName
: endprocess
: close_process &hnd#
: set &num# = add( &num#, 1 )
:endwhile
Get-Content $b4a_config_file.fullName | Add-Content $finalconfig.fullName
! replace blackslash with double backslash (for Windows paths)
(Get-Content $finalconfig.fullName) | Foreach-Object {
$_ -replace '\\', '\\'
} | Set-Content $finalconfig.fullName
Remove-Item $b4a_config_file.fullName -Force
! show the configuration
"-- b4A module"
"&module#"
"-- b4A configuration"
Get-Content $finalconfig.fullName
"--"
! java settings
:if &B4AB_JAVA_OPTS_O# ne ""
$env:JAVA_OPTS="&B4AB_JAVA_OPTS_O#"
:endif
:if &B4AB_JAVA_HOME_O# ne ""
$env:JAVA_HOME="&B4AB_JAVA_HOME_O#"
:endif
! activate configuration file
$env:B4J_CONF_FILE=$finalconfig
! start the module
$process = Start-Process -NoNewWindow -PassThru -Wait -WorkingDirectory "&B4AB_BIN_DIR_O#" -FilePath "Powershell.exe" -ArgumentList ".\b4A-cli.ps1 &module#"
! remove configuration file
Remove-Item $finalconfig.fullName -Force
Variable Publications
Found 1 variable publications (TASK)
Zeilennummer | Scriptzeile |
---|---|
12 | :publish &B4AB_CLASS_O#, , TASK |