Author Topic: Pipecom Browser for Filename$  (Read 10806 times)

0 Members and 1 Guest are viewing this topic.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Pipecom Browser for Filename$
« Reply #30 on: February 10, 2021, 04:53:25 pm »
OK
If someone could provide a Linux command that produces a Directory Listing that distinguishes Files from Folders and provides a Sample Output Directory, I could adapt this for Linux.

@johnno56  can you help with this?

I think it's "dir -F" I looked it up a couple days ago.
Code: QB64: [Select]
  1. 'make sure pipecom.h is in same folder as QB64.exe
  2. Declare Library "pipecom"
  3.     Function pipecom$ (cmd As String)
  4. F$ = pipecom("dir -F")
  5. print F$ 'see it
  6. _clipboard = F$ 'copy to clipboard
  7.  
If that works, get a copy of output to _clipboard, paste _clipboard into text file. Then paste a copy of txt file here.
I need to know if uses tabs or spaces in output and amount of spacing.

Then I can see how to parse output.

@johnno56   OK you posted but can't read colors from text string, try above instructions.

I know I can read Folders from a dir command because they end in a slash.
* pipecom.h (Filesize: 0.45 KB, Downloads: 154)
« Last Edit: February 10, 2021, 05:01:16 pm by bplus »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Pipecom Browser for Filename$
« Reply #31 on: February 10, 2021, 05:03:25 pm »
@johnno56  I updated instructions in above post.

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Pipecom Browser for Filename$
« Reply #32 on: February 10, 2021, 05:05:27 pm »
I figured you might have issues with the colours.The colours would change with the overall theme of the desktop...
Anyway, I tried the 'dir -F' and all the directories ended in a slash.

I also tried running the the program , as is, and received a "illegal string-number conversion on line 1"
Logic is the beginning of wisdom.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Pipecom Browser for Filename$
« Reply #33 on: February 10, 2021, 05:11:04 pm »
I figured you might have issues with the colours.The colours would change with the overall theme of the desktop...
Anyway, I tried the 'dir -F' and all the directories ended in a slash.

I also tried running the the program , as is, and received a "illegal string-number conversion on line 1"

That's the line to the Declare Library? can't be the comment!

Well the ball is now in @SpriggsySpriggs  's court!

@johnno56  to be sure our bases are covered, you do have pipecom.h file copy in your QB64.exe Folder?

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Pipecom Browser for Filename$
« Reply #34 on: February 10, 2021, 05:11:46 pm »
You were updating your listing as I was forming my last post.

Updated my listing. Ran it. "Invalid name on line 7"
Logic is the beginning of wisdom.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Pipecom Browser for Filename$
« Reply #35 on: February 10, 2021, 05:13:14 pm »
Try $ on the end of _Clipboard$ <====

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Pipecom Browser for Filename$
« Reply #36 on: February 10, 2021, 05:14:48 pm »
No. The pipecom.h is on my Desktop but the listing path was modified.
Logic is the beginning of wisdom.

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Pipecom Browser for Filename$
« Reply #37 on: February 10, 2021, 05:15:30 pm »
Adding the $ did it... nicely done...
Logic is the beginning of wisdom.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Pipecom Browser for Filename$
« Reply #38 on: February 10, 2021, 05:16:18 pm »
No. The pipecom.h is on my Desktop but the listing path was modified.

Well that won't work has to be where QB64.exe can get it.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Pipecom Browser for Filename$
« Reply #39 on: February 10, 2021, 05:17:36 pm »
Adding the $ did it... nicely done...

Oh, can I get a txt copy, please? Or do you want to try a parsing yourself?
« Last Edit: February 10, 2021, 05:19:17 pm by bplus »

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Pipecom Browser for Filename$
« Reply #40 on: February 10, 2021, 05:27:26 pm »
Ok. Normally I put 'test' programs on my desktop and transfer them if and when they work.

Both '.bas' and .h' files are now in the QB64 directory. Used 'F$ = pipecom("dir -F > pipecom.txt")' to produce a text file. See attached.

Parsed? Not sure what you mean. I'm only familiar with that term in regards to text adventures... lol

* pipecom.txt (Filesize: 1.14 KB, Downloads: 154)
Logic is the beginning of wisdom.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Pipecom Browser for Filename$
« Reply #41 on: February 10, 2021, 05:43:17 pm »
OK, got it. Thanks @johnno56

That's one folder?

And appears to be 2 columns but the 2nd column is a little 'all over' ;-))

I bet some kind of tabs are in there.

Parse - is just breaking down a string into more usable units of data using different string functions.
This depends on the strings having some sort of dependable or predictable structure or pattern.

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: Pipecom Browser for Filename$
« Reply #42 on: February 10, 2021, 11:07:40 pm »
This doesn't sound like an error on pipecom's side
Shuwatch!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Pipecom Browser for Filename$
« Reply #43 on: February 10, 2021, 11:40:37 pm »
This doesn't sound like an error on pipecom's side

No, just going to be a challenge to make a list and preferably get all the directories at the top of the list.

I am kind of busy trying to figure out how to get ElseIf blocks into my Interpreter this time around.
(and yet I keep checking in here ;-))

OK piece of cake, it's just tabbing out to some 2nd column, displayed in Notepad++ it looked like hell.
« Last Edit: February 11, 2021, 12:01:10 am by bplus »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Pipecom Browser for Filename$
« Reply #44 on: February 11, 2021, 12:07:26 am »
@johnno56

Does the command 'dir -F" always make a 2 column list, or does it pick the longest name and make the column widths as narrow as possible to fit the maximum number of names in a minimum number of lines?

OK I am assuming a width of 80 chars for lines, could be 90 so 2nd column at 45 divides in 2 the screen.

2nd Column at 45 chars out.PNG
* 2nd Column at 45 chars out.PNG (Filesize: 35.16 KB, Dimensions: 777x708, Views: 181)
« Last Edit: February 11, 2021, 12:18:14 am by bplus »