Getting a list of directories

22 views
Skip to first unread message

Tom Collins

unread,
Oct 29, 2025, 10:19:03 AM (6 days ago) Oct 29
to SemWare TSE Pro text editor
I have a macro that searches a directory on disk for some information, and I'd like to prompt the user for that directory name - kinda like PickFile(), but allow them to pick a directory instead.  It doesn't seem like there's a built-in way to do that in TSE, which seems crazy to me.  I did stumble across an undocumented PickDir() function, but I have no idea what the (string,integer,integer,integer,integer) function parameters are for.

Thoughts?

Thanks.

knud van eeden

unread,
Oct 29, 2025, 11:54:54 AM (6 days ago) Oct 29
to sem...@googlegroups.com
what about running the

Where

TSE macro.

with friendly greetings 
Knud van Eeden

Sent from Yahoo Mail on Samsung Galaxy S24 Ultra / 1 terabyte / artificial intelligence

--

---
You received this message because you are subscribed to the Google Groups "SemWare TSE Pro text editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to semware+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/semware/c9048f53-daed-46c9-bd38-0ad88a6d33b4n%40googlegroups.com.

Tom Collins

unread,
Oct 29, 2025, 12:10:41 PM (6 days ago) Oct 29
to sem...@googlegroups.com
I don't need to get a list of files, I need to get a directory name.  And then I run my own search against some of the files in that directory.

You received this message because you are subscribed to a topic in the Google Groups "SemWare TSE Pro text editor" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/semware/WTwvemV30mY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to semware+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/semware/1740689289.2116145.1761753279077%40mail.yahoo.com.

Carlo Hogeveen

unread,
Oct 29, 2025, 1:29:46 PM (6 days ago) Oct 29
to sem...@googlegroups.com

An old macro from 2003 that does exactly what you describe:
https://ecarlo.nl/tse/ToolsAndExtensions.html#PickDir

For reasons unknown neither Sammy nor I published this on a website.
Compatible with Windows only.
Linux TSE started a year after this macro.
I will look into why it does not function in Linux.

Carlo



Tom Collins

unread,
Oct 29, 2025, 2:09:25 PM (6 days ago) Oct 29
to sem...@googlegroups.com
Thanks!  If I have some time in the next few days, I'll poke at it and see if I can fix the Windows-isms and post the results.

Tom

--

---
You received this message because you are subscribed to the Google Groups "SemWare TSE Pro text editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to semware+u...@googlegroups.com.

Carlo Hogeveen

unread,
Oct 29, 2025, 4:50:11 PM (6 days ago) Oct 29
to sem...@googlegroups.com

In v1.1 I made PickDir Linux-compatible and fixed two bugs:
https://ecarlo.nl/tse/ToolsAndExtensions.html#PickDir
Carlo



zhong zhao

unread,
Oct 29, 2025, 10:28:06 PM (6 days ago) Oct 29
to SemWare TSE Pro text editor
Windows:(All folders on D:\ save to  d:\all_folders_on_D.txt)
    cmd /c dir D:\*.* /b /s  /ad >d:\all_folders_on_D.txt
Linux: (All folders on / save to  ~/all_folders.txt  )
    sudo find / -name '*' -type d >~/all_folders.txt

knud van eeden

unread,
Oct 30, 2025, 7:56:51 AM (5 days ago) Oct 30
to sem...@googlegroups.com
FYI:

The download is not possible out of the box.

with friendly greetings
Knud van Eeden


--

---
You received this message because you are subscribed to the Google Groups "SemWare TSE Pro text editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to semware+u...@googlegroups.com.

knud van eeden

unread,
Oct 30, 2025, 8:17:15 AM (5 days ago) Oct 30
to sem...@googlegroups.com, S.E. Mitchell
1. Note: Issue: Compiling the program with latest TSE for Linux version 4.50.13 on Linux WSL Ubuntu works,
but running it does not do anything.

See second screenshot.

2. The out of the box solution for that on TSE Microsoft Windows.

    BrowseDir()

See also first screenshot.


---

STRING PROC FNStringGetInputFileDirectoryS( STRING titleS, STRING directoryBeginS )
 RETURN( BrowseDir( titleS, directoryBeginS ) )
END

PROC Main()
 STRING s1[255] = "C:\TMP" // change this
 s1 = FNStringGetInputFileDirectoryS( "directory = ", s1 )
 Warn( s1 )
END

---

Inline image


Inline image





Tom Collins

unread,
Oct 30, 2025, 9:53:52 AM (5 days ago) Oct 30
to sem...@googlegroups.com, S.E. Mitchell
1. Can confirm Knud's observation that Carlo's PickDir macro file isn't downloadable from his site as of right now.

2. The (undocumented) BrowseDir("hello", "/tmp") doesn't seem to do anything on my Linux install.

Carlo Hogeveen

unread,
Oct 30, 2025, 10:14:43 AM (5 days ago) Oct 30
to sem...@googlegroups.com

I fixed the PickDir download error.
https://ecarlo.nl/tse/ToolsAndExtensions.html#PickDir
Thanks to all who reported it.

Carlo



Tom Collins

unread,
Oct 30, 2025, 1:42:32 PM (5 days ago) Oct 30
to sem...@googlegroups.com
Carlo's PickDir() macro works great!  The only change I'd make is to prefix directory names with a slash or backslash, since it's not 100% obvious when first looking at the list that you're only seeing directories.  Thank you for the help!

Tom

--

---
You received this message because you are subscribed to the Google Groups "SemWare TSE Pro text editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to semware+u...@googlegroups.com.

Carlo Hogeveen

unread,
Oct 30, 2025, 2:07:06 PM (5 days ago) Oct 30
to sem...@googlegroups.com

> Carlo's PickDir() macro works great!
And Sammy's! He wrote the first version and most of it.

> The only change I'd make is to prefix directory names with a slash or backslash,
That would solve it, because files start after a slash too.

> since it's not 100% obvious when first looking at the list that you're only seeing directories.
That is a bit of a problem.
The title could be improved to "Pick a directory:".
Brighter ideas elude me at the moment.

Carlo



Reply all
Reply to author
Forward
0 new messages