English Amiga Board

English Amiga Board (https://eab.abime.net/index.php)
-   Coders. Scripting (https://eab.abime.net/forumdisplay.php?f=117)
-   -   Add directory to path with ARexx? (https://eab.abime.net/showthread.php?t=70869)

Firestone 22 September 2013 19:34

Add directory to path with ARexx?
 
Been doing some projects lately with ARexx just for the fun of it, and came accross a weird problem when trying to add a new path with the AmigaDOS-command "Path"

I'm doing this inside the .rexx script with the following code:

Code:

Address command 'C:path ram:temp ADD'
Script seems to run fine, no errors. But the directory is never added to path for some reason.
I then tried to add path to a directory that don't exist, and then it will output errors, so the command seems to be run fine.

Can anyone please explain me why this is not working inside this script?

thomas 22 September 2013 19:47

I don't think you can change local shell-specific things from ARexx. The problem is that ADDRESS COMMAND calls Execute() or System() for each command and these DOS functions create a new CLI. The new CLI inherits its path from the parent, then the command is executed and it changes the path of the new CLI only. Finally the new CLI is destroyed again together with its changed path. The path of the parent CLI is never touched. The same applies to the current directory (CD command) and local variables (Set and Get commands).

daxb 23 September 2013 12:44

Alternative in hypothesis of you just want to have a temp dir/place. Why you don`t use "Ram:T" or simply "Ram:"? Path is more or less for global search places and should made in S-S or U-S. In most cases path entries will never removed.

idrougge 22 May 2015 17:25

If you run your script from a CLI, I think you could do something like:
Open('con','*','WRITE')
WriteLn('con','Path ADD mypath:')

at the end of your script.

BigFan 22 May 2015 19:21

As already mentioned, you can't add a local setting globally. Your path is correctly added, then thrown away, when closing current shell.

If you really want to enhance your actual shell, then add your path to a specific shell-startup, name it what you like , run a new shell with 'from' keyword and your newly created shell-start as input.

e.g.
echo >ram:t/pathvar path Dummydrive: add
newshell from ram:t/pathvar

now your shell has got the new path (Dummydrive: here) as set by your script

Cheers

idrougge 07 May 2017 04:28

Or, if you run your script from the CLI, you can just PUSH or QUEUE your commands and they will be performed on exit.


All times are GMT +2. The time now is 08:13.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.

Page generated in 0.05076 seconds with 11 queries