|
Post by Walt Decker on Oct 27, 2021 16:55:42 GMT -5
Walt, that DLL sounds very impressive. Do you have a demo? r.m. No, but I will work one up; possibly post it tomarrow (10-28-21) along with the specs.
|
|
Dennis
Full Member
Old but still active
Posts: 147
|
Post by Dennis on Oct 28, 2021 4:35:14 GMT -5
Hi Alincon I am already doing that but when you are dealing with a large number of windows and files, it can become cumbersome. I have successfully converted all my commercial software using the "switch" approach. My suggestion was for a simple statement that obviated the need for switches, etc. Brandon's solution will also work but again, I am looking for a "lazy" solution.The BASIC I was using before had commands to do what I am looking for. I wait in suspense for the DLL Regards Dennis
|
|
|
Post by Brandon Parker on Oct 28, 2021 9:24:09 GMT -5
Brandon's solution will also work but again, I am looking for a "lazy" solution. For starters and no offense, the program logic should be designed such that handles are not attempted to be closed unless they are known to be open. In the event that a program error occurs resulting in the need to close any & all handles possibly open, the LB-only solution I posted is sufficient for the job. What would be a "lazy" solution; relying on LB to close all of your handles by itself without displaying any message? If you are just looking for an API solution for checking whether windows are actually open then you can use this one. Function IsWindow(hWnd) 'Return value is nonzero if the window handle exists 'Return value is zero if the window handle does not exist CallDLL #user32, "IsWindow", hWnd As ulong, _ IsWindow As long End Function {:0) Brandon Parker
|
|
|
Post by Walt Decker on Oct 28, 2021 12:17:51 GMT -5
I spoke too soon. My DLL will not work with Liberty Basic. Basically the dll works on two levels, one for systems that equate files to file numbers and one that equates files to file handles. Both those systems use standard I/O attributes. Like menus, LB does not provide any information about the file nor does it allow one to specify file I/O attributes. And LB does not even check on the open status of a file if the app opens the same file again before it is closed. I should not be able to do this without setting I/O attributes: ' Txt$ = "#1" OPEN "TEST.TXT" FOR OUTPUT AS #Txt$ PRINT #Txt$, Txt$ Txt2$ = "#2" OPEN "TEST.TXT" FOR BINARY AS #Txt2$ A = LOF(#Txt2$) print A Txt3$ = "3" OPEN "TEST.TXT" FOR RANDOM AS #Txt3$ LEN = 128
END '
I could, however, write a dll specifically for LB that check open status only, but it would have to be on a file name basis.
Another work-around based on native LB would be something like this: ' Txt$ = "#1" OPEN "TEST.TXT" FOR OUTPUT AS #Txt$
ON ERROR GOTO [NAME.ERROR] NAME "TEST.TXT" AS "TEST.DTA" '#################################################### 'LB DOES NOT HAVE AN ERROR CODE FOR THIS 'IT DOES PRODUCE THE MESSAGE "ISEMPTY NOT UNDERSTOOD ' SEE ERROR LOG" 'BUT IT INDICATES THAT AN OPEN FILE CANNOT BE RENAMED '####################################################
NAME "TEST.DTA" AS "TEST.TXT" [CLOSE.CONT] END
[NAME.ERROR]
PRINT "CAN'T RENAME A FILE THAT IS OPEN" GOTO [CLOSE.CONT]
[NAME.ERROR.END] '
|
|
Dennis
Full Member
Old but still active
Posts: 147
|
Post by Dennis on Oct 30, 2021 0:29:28 GMT -5
Hi Brandon
No offense taken, but I think you misread my original post. I DO have switches etc. to make sure that I close all open files but it becomes cumbersome AND, I do not have a current issue i.e., the program works fine. As I said in my original post, I am probably pushing it but the thread is titled "What I would like to see in LB5" and I offered a suggestion of what I would like to see.
The program that I have has over 5000 lines of code and 14 files and windows which are dynamically set up using variables and options specified by the user. Keeping track of them becomes cumbersome especially when you need to "crash" the program at some point because some or other option or variable is invalid. At that point, I need to be able to close all the open files and windows and terminate the program. Using switches, it works perfectly. Using your approach could obviate the "switches" but the "lazy approach" would be a simple "close all open" type statement.
The previous BASIC I used before LB had a "close all" statement and I was offering a suggestion but not insisting on it.
Thanks for your suggestions on using an API - I will definitely look at it. I know which files are open as I keep the handles/switches in a table of sorts.
Regards Dennis
|
|
|
Post by alincon on Oct 31, 2021 19:26:18 GMT -5
Dennis, have you tried putting the file names in an array and using one of the loop structures to query the file status?
r.m.
|
|
Dennis
Full Member
Old but still active
Posts: 147
|
Post by Dennis on Nov 1, 2021 2:17:48 GMT -5
Hi
Exactly what I am doing see "table of sorts" in my last post.
Seriously though, I made a suggestion about "what you would like to see in LB5" and not because my program was not working. A "close all" was suggested as a "lazy way" without using API, tables, etc.
Thanks for responding!
Dennis
|
|
|
Post by MrHiggins on Dec 16, 2021 5:04:59 GMT -5
Bitshift operators like >>, << and += -= assignment operators would also be nice.
|
|
|
Post by Marco Kurvers on Aug 12, 2022 11:56:53 GMT -5
Thanks for all your suggestions. I will continue to be very conservative about what I add to Liberty BASIC. Too many features will cause LB to lose its essential character of BASIC. Liberty BASIC will never look like C. I know Carl, but not all looks like C. For example, function UBound() and LBound() and a = -a. That line, a = -a, was already exist on the Commodore 128 BASIC 7.0. Indeed, not everything fits into Liberty BASIC, but we shouldn't shout C-like too quickly.
|
|
|
Post by Carl Gundel on Aug 12, 2022 12:15:58 GMT -5
Thanks for all your suggestions. I will continue to be very conservative about what I add to Liberty BASIC. Too many features will cause LB to lose its essential character of BASIC. Liberty BASIC will never look like C. I know Carl, but not all looks like C. For example, function UBound() and LBound() and a = -a. That line, a = -a, was already exist on the Commodore 128 BASIC 7.0. Indeed, not everything fits into Liberty BASIC, but we shouldn't shout C-like too quickly. I am always open minded, but it doesn't have to look like C for me to shy away from it.
|
|
|
Post by Marco Kurvers on Aug 12, 2022 12:36:28 GMT -5
Hi Thanks for responding and agreeing! The insertMid$ function is something that I will use in the interim (assuming that LB5 will have mid$ as a statement ) I have added it to my common routines library. Regarding a string$ function, as I wrote in my post, I used a FOR/NEXT workaround using a function exactly as you did. The mid$ workaround you suggested is great, but it would be neater to have mid$ as a statement embedded in the language. It is a statement and function in most BASICs that I have worked with. The string$ command is not that important and the string$ function is adequate as a workaround. Regards Dennis I have made my own mid$ subroutine. A name as insertMid$ is not necessary. With my mid$, I can type mid$ a$, 4, "Hi" and this does the same. I have made left$ and right$ too. I saw these statements in BBC BASIC for Windows and I have made them in Liberty BASIC.
|
|
|
Post by Carl Gundel on Aug 13, 2022 12:11:05 GMT -5
Hi Thanks for responding and agreeing! The insertMid$ function is something that I will use in the interim (assuming that LB5 will have mid$ as a statement ) I have added it to my common routines library. Regarding a string$ function, as I wrote in my post, I used a FOR/NEXT workaround using a function exactly as you did. The mid$ workaround you suggested is great, but it would be neater to have mid$ as a statement embedded in the language. It is a statement and function in most BASICs that I have worked with. The string$ command is not that important and the string$ function is adequate as a workaround. Regards Dennis I have made my own mid$ subroutine. A name as insertMid$ is not necessary. With my mid$, I can type mid$ a$, 4, "Hi" and this does the same. I have made left$ and right$ too. I saw these statements in BBC BASIC for Windows and I have made them in Liberty BASIC. Why do you need to make left$ and right$?
|
|
|
Post by Marco Kurvers on Aug 15, 2022 12:34:07 GMT -5
Yes, maybe only the sub mid$ is sufficient. When I finished the left$ and right$ subs, I discovered the replstr$( ) function in LB that does the same thing. And even instead of giving the position in the string, having it search for the part string that you want to replace is a bit easier.
Maybe, it's a good idea to make for LB5 a replace$ statement that does the same as the Commodore BASIC 7.0 and the QuickBASIC mid$ statement. The statement is very old and it is a pity that it was not further supported in all BASIC dialects.
But, so I can say: the function replstr$ does a lot of good!
|
|
|
Post by atomose on Aug 16, 2022 9:30:09 GMT -5
pls make the possibility to have multiple timer and add a syntax line to read easily .avi or .mp4 (or other) video file (something really easy like for playwave) :
exemples : timer(1) 100, goto [data] timer(2) 50, goto [loop] timer(3) 1000, goto [save]
playAVI or playMP4 "folder\name.mp4"
|
|
cor
New Member
Posts: 10
|
Post by cor on Aug 16, 2022 11:30:40 GMT -5
I would be very much in favor of seeing Bluatigro's suggestion of DIM()={1,2,3,etc.} honored and realized. I like the idea that you define limited array contents within the brackets on the right side of the equation. This would work for both numeric data and alphanumeric data. If you want a larger array than the limit allows - go the old fashion way.
|
|