Selecting newly created file

A have a button that creates a PHP script file using a "template".

[code]@set name={dlgstringS|New PHP class name|}
echo ^<?php>> {$name}.php
echo.>> {$name}.php
echo class {$name} {>> {$name}.php
echo.>> {$name}.php
echo.>> {$name}.php
echo.>> {$name}.php
echo }>> {$name}.php
echo.>> {$name}.php
echo ?^>>> {$name}.php

Select NONE
Select {$name}.php

start notepad {$name}.php[/code]

Of course I set button function to ms-dos batch function.
Everything works ok except the newly created file is not selected.
Anyone have idea what's wrong?

FWIW, your code is working for me. Click button, enter in a name, name.php is created, auto selected and opened in notepad.

For me the created file is not selected. I tried in c:, d:\ and in d:\folder to create a file by entering "asdf", so "asdf.php" was created and opened, but not selected (nor focused).

If the lister hasn't noticed the file created by the external Echo command yet then the Select command won't do anything.

Here's one way to fix it, by forcing a refresh with Go CURRENT before the Select command. I've also improved the Select command slightly.

[code]@set name={dlgstringS|New PHP class name|}

echo ^<?php>> {$name}.php
echo.>> {$name}.php
echo class {$name} {>> {$name}.php
echo.>> {$name}.php
echo.>> {$name}.php
echo.>> {$name}.php
echo }>> {$name}.php
echo.>> {$name}.php
echo ?^>>> {$name}.php

Go CURRENT
Select DESELECTNOMATCH MAKEVISIBLE EXACT {$name}.php

start Notepad.exe {$name}.php[/code]

Thank you, it works ok now. The only difference is that the file will be sorted after executing GO CURRENT (I disabled "sort newly created and copied files") but I don't think it's big problem.

I just thought about something else.
Why is it possible to use Opus functions when "ms-dos batch function" is selected? Does that mean that I can use both dos and Opus functions then? If yes, why is there "standard function" option if it just makes it impossible to use dos functions?

You can run internal commands in both modes.

If you run an internal command in the middle of a DOS batch button, the things before and after it will be split into two separate batch files.

The difference between standard and DOS batch modes is in how external programs are run, like the difference between running something by double-clicking its icon or running it from a command prompt.

DOS batch also brings with it a lot of legacy baggage and arcane nonsense dating back to the 1980s, of course, so it's best avoided except when it is actually useful (like in this case). :slight_smile: