init Octave directly with files, using ps-scripts

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

init Octave directly with files, using ps-scripts

Nell, Erik

Hello,

 

I’m searching for a solution to start Octave with a specified file (*.m) (on windows 10 systems) while using command line scripts.

 

The *.ps1 script so far (called by a e-exam program to start programs like Octave, Maxima, etc.)

 

$lib = {

    function ShowDialog {

        # some nice sourcecode but no need to show it in this mail ;-)

   }

}

 

Start-Job { ShowDialog } -InitializationScript $lib

 

# this part don’t work

# $package = Get-AppvClientPackage -Name 'Octave.*'

# $appvveparam = "$($package.PackageId)_$($package.VersionId)"

# $cmd = "$($env:localappdata)\Microsoft\AppV\Client\Integration\$($package.PackageId)\Root\start-octave.bat"

# cmd.exe /appvve:$appvveparam /C $cmd $args[0]

 

# with this option Octave will start without loading any files

Invoke-Item -Path "$($env:appdata)\Microsoft\Windows\Start Menu\Programs\Octave V5.lnk"

 

Does anyone have an idea to solve this problem or knowledge about some parameters to init Octave-GUI with *.m files directly (on a windows system) ?

 

Kind regards,

Erik Nell

 

(Why I searching for a solution for a problem like this ? Because I try to use Octave in e-assessment scenarios.

In this case it is useful to make students life more comfortable and start Programs with specific files directly ;-) )

 



Reply | Threaded
Open this post in threaded view
|

init Octave directly with files, using ps-scripts

Nell, Erik

Hello,

 

I’m searching for a solution to start Octave with a specified file (*.m) (on windows 10 systems) while using command line scripts.

 

The *.ps1 script so far (called by a e-exam program to start programs like Octave, Maxima, etc.)

 

# this part don’t work

# $package = Get-AppvClientPackage -Name 'Octave.*'

# $appvveparam = "$($package.PackageId)_$($package.VersionId)"

# $cmd = "$($env:localappdata)\Microsoft\AppV\Client\Integration\$($package.PackageId)\Root\start-octave.bat"

# cmd.exe /appvve:$appvveparam /C $cmd $args[0]

 

# with this option Octave will start without loading any files

Invoke-Item -Path "$($env:appdata)\Microsoft\Windows\Start Menu\Programs\Octave V5.lnk"

 

Does anyone have an idea to solve this problem or knowledge about some parameters to init Octave-GUI with *.m files directly (on a windows system) ?

 

Kind regards,

Erik Nell

 

(Why I searching for a solution for a problem like this ? Because I try to use Octave in e-assessment scenarios.

In this case it is useful to make students life more comfortable and start Programs with specific files directly ;-) )

 



Reply | Threaded
Open this post in threaded view
|

Re: init Octave directly with files, using ps-scripts

Nell, Erik
Hello,

simple solution/workaround:

Start-Process -FilePath "${d}:\octave.vbs" -ArgumentList "--force-gui
--persist --eval `"edit $args`"" -Wait

$args (e.g. a filename) will come from a another script/program.


#######################################


#
# Get AppVClient Package and Version ID
#

$a=Get-AppvClientPackage -name Octave.502

#
# Artificially shortpath as workaround while run into the 260 character
limit for path/filenames
# see
https://stackoverflow.com/questions/34812349/how-can-i-query-a-temporary-ps-drive-while-returning-files-with-a-name-relative
#

$g="\\localhost\C$\ProgramData\App-V\$($a.packageid)\$($a.versionid)\Root"

#
# Get a free drive letter for create temporary persistent drives
#

$d=ls function:[d-z]: -n | ?{ !(test-path $_) } | random
$d = $d.substring(0,1)
$dum=New-psdrive -name $d -PSProvider FileSystem -Root $g -persist

#
# Run Octave and appent params including eval to open *.m files directly
#

Start-Process -FilePath "${d}:\octave.vbs" -ArgumentList "--force-gui
--persist --eval `"edit $args`"" -Wait
#Laufwerk wieder entfernen
remove-psdrive -name $d -force

#######################################

This is just a modification or better a kind of wrapper around the
original octave eviroment in AppV5 context.

Sincerely,
Erik Nell




smime.p7s (7K) Download Attachment