Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PIPECOM of SpriggsySpriggs
#1
For SpriggsySpriggs, but also for those who can contribute.

Good morning... everything okay? I hope so...

I’m trying to use your pipecom function for various purposes. One, for example, is the classic return of a DIR.

The problem is that, it seems, when I run it once everything works perfectly.

However, if I immediately invoke the function again, it gets stuck. For example, inside a simple loop - but the problem is not the loop! - if I choose a folder and want to know if there are PDF files inside, the first time it gives me the answer (positive or negative); if I then choose another folder right after, the function gets stuck.

Perhaps, before being invoked - or rather, when it exits - it needs to be reset in some way to make it available for subsequent uses?

Thank you!

P.S.
It seems to me that there are no alternatives from within QB64. Something else could be done with Python or C, but I believe the execution would be too slow: let me know if I'm wrong!
Reply
#2
Quote:It seems to me that there are no alternatives from within QB64.

Try _OpenFileDialog you can navigate your computer just like Windows File Explorer.

EDIT: Here is demo
Code: (Select All)
_ScreenMove 400, 400
title$ = "Select File for Viewing"
path$ = _CWD$ ' use the Current Working Directory
fPattern$ = "*.bas|*.txt"
fPattermDescrip$ = "Files that are viewable"
_Delay .2 ' let window set itself up then call OpenFile...   yep!
selectedPathedFileName$ = _OpenFileDialog$(title$, path$, fPattern$, fPattermDescrip$)
Print selectedPathedFileName$
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply
#3
A simple example would be to use the command:
Code: (Select All)
_SHELL "dir " + FOLDER$ + " /b > tmp.txt"
and then open tmp.txt for input.
OR
You can use a utility program which returns files and folder list as array:  File List and Directory List (as array)
Reply
#4
Thank you!

I was actually interested in understanding what causes the execution to crash when calling SpriggsySpriggs' SUBs just two times in a row.

The goal was not just the DIR command but (almost) anything else that can be done by querying Windows with SHELL, always trying to avoid writing a file and then having to read it, thus doing everything through RAM (CLIPBOARD).

I was surprised by SMcNEILL's code (qb64phoenix.com/forum/showthread.php?tid=3627) to the point that I couldn't tell – I confess! – if it writes a file to disk or not! I also don't understand what it queries to know the list of files. Anyway, it's very efficient.

I still need you for a problem that I posted on Help Me!...
Reply
#5
No file writing done with those routines.  It's all handled in memory for you and returns the value through an array for you to work with.  Wink
Reply
#6
Krovit, are you able to share a snippet of the code where you are calling the function twice? Also, can you share the file of the pipecom version you are using? It could be an older one.
The noticing will continue
Reply
#7
(08-25-2025, 11:57 AM)SpriggsySpriggs Wrote: Krovit, are you able to share a snippet of the code where you are calling the function twice? Also, can you share the file of the pipecom version you are using? It could be an older one.
I'm mortified, I'm sorry, I made you waste your time, and your code works perfectly.

Months ago, I took the liberty of implementing your code with a variant (at that time, I needed to pull up an endless list of files from certain folders, and the simple stdout result wasn't enough for me). Since I include many parts of code in my projects that I believe I won't need to touch again in external files that I then combine with $INCLUDE, I had forgotten about the modification.

The problem I reported arose because in your function you use certain words that I also assigned as variables for other functions, and with the error handling, the program entered an infinite loop.

However, not all bad things come to harm: do what you want with it, but in the meantime, I'm attaching the simple additional function that inserts the result into an array.

Of course, this only applies to DIR... I plan to use your code for various purposes because I really like the idea —like that of SMcNeill— of not writing anything and working as much as possible in RAM.

I'm sorry again.


Attached Files
.bas   PipecomNON-ORIGINAL.bas (Size: 9.7 KB / Downloads: 46)
Reply
#8
No need to apologize! It's ok! I'm glad you figured it out!
The noticing will continue
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Lightbulb New Pipecom Update SpriggsySpriggs 10 1,074 12-11-2025, 04:28 PM
Last Post: SpriggsySpriggs

Forum Jump:


Users browsing this thread: 1 Guest(s)