Double Quotes Bug

Just starting out? Need help? Post your questions and find answers here.
User avatar
Piero
Addict
Addict
Posts: 874
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

Double Quotes Bug

Post by Piero »

This is really annoying!
I already emailed support, posting here so you can avoid unexpected problems!

Code: Select all

FilePath$ = #DQUOTE$+ OpenFileRequester("","","",0) +#DQUOTE$
;  Enclosed in #DQUOTE$ for paths with spaces etc…

RunProgram("open",FilePath$,"") ; Will open as if double-clicked
;  Paths with double quotes will not open!
No way to escape double quotes on RunProgram parameter!!!

Other problems (Mac M1 Monterey):
No Sound!!!
Toolbar: no text, keeps customization only if made on prefs…
 
// Moved from "Bugs - Mac OSX" to "Coding Questions" (Kiffi)
Last edited by Piero on Wed May 03, 2023 4:50 am, edited 2 times in total.
BarryG
Addict
Addict
Posts: 4140
Joined: Thu Apr 18, 2019 8:17 am

Re: Double Quotes Bug

Post by BarryG »

Why have you got "open" there? That's not the file from OpenFileRequester().
Last edited by BarryG on Sun Apr 30, 2023 11:23 am, edited 1 time in total.
User avatar
Piero
Addict
Addict
Posts: 874
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

Re: Double Quotes Bug

Post by Piero »

BarryG wrote: Sun Apr 30, 2023 10:27 am Why have you got "open" there? That's not the file from OpenFileRequester().
I used "open" so you can test the RunProgram parameter bug.
open is a "Terminal Command" to open files (like a Finder double-click) used here with the file from OpenFileRequester() as parameter.
BarryG
Addict
Addict
Posts: 4140
Joined: Thu Apr 18, 2019 8:17 am

Re: Double Quotes Bug

Post by BarryG »

Okay, that answers that. But you don't have to come in here as a newbie and start yelling at us in big text.

Now, does this topic help your question? -> viewtopic.php?t=68147
User avatar
Piero
Addict
Addict
Posts: 874
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

Re: Double Quotes Bug

Post by Piero »

BarryG wrote: Sun Apr 30, 2023 11:21 am Okay, that answers that. But you don't have to come in here as a newbie and start yelling at us in big text.
Now, does this topic help your question? -> viewtopic.php?t=68147
Forgive me for the "yelling".
No, that doesn't help; the problem is not the program, it's the parameter string.
User avatar
mk-soft
Always Here
Always Here
Posts: 6212
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Double Quotes Bug

Post by mk-soft »

Solution

Code: Select all

FilePath$ = OpenFileRequester("","","",0)
If FilePath$
  RunProgram("open",#DQUOTE$ + FilePath$ + #DQUOTE$,"")
EndIf
Last edited by mk-soft on Sun Apr 30, 2023 11:44 am, edited 2 times in total.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
Piero
Addict
Addict
Posts: 874
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

Re: Double Quotes Bug

Post by Piero »

mk-soft wrote: Sun Apr 30, 2023 11:35 am Please move to 'Code Question'
Why please? I consider this a bug... try open a file named 'this "is" text.txt' with the code above and you will see…
Same applies if the containing folder has double quotes on name...
User avatar
mk-soft
Always Here
Always Here
Posts: 6212
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Double Quotes Bug

Post by mk-soft »

Welcome Piero
The bug forum pages are about bugs found in the IDE or compiler. But only after confirmation from experienced users.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
mk-soft
Always Here
Always Here
Posts: 6212
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Double Quotes Bug

Post by mk-soft »

File names must not have a dquote because these are separators when parameters are passed.
Rule on the OS and is not due to PB

Try it in the terminal. it doesn't work there either.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
Piero
Addict
Addict
Posts: 874
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

Re: Double Quotes Bug

Post by Piero »

mk-soft wrote: Sun Apr 30, 2023 11:45 am Welcome Piero
The bug forum pages are about bugs found in the IDE or compiler. But only after confirmation from experienced users.
Hi! I'm "experienced" in this kind of stuff (but I can make mistakes…)
PLEASE test and tell me, but believe me: do not waste too much time trying to escape the string… I tried all I could…
User avatar
Piero
Addict
Addict
Posts: 874
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

Re: Double Quotes Bug

Post by Piero »

mk-soft wrote: Sun Apr 30, 2023 11:51 am Try it in the terminal. it doesn't work there either.
It works in Terminal if you enclose in single quotes:
open '/Users/username/Desktop/New Folder/"Hello World".txt'
User avatar
mk-soft
Always Here
Always Here
Posts: 6212
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Double Quotes Bug

Post by mk-soft »

Interesting problem ;)

But not with complex filename as 'this "is" text.txt'
But i found a solution as url path

Code: Select all

FilePath$ = OpenFileRequester("","","",0)
If FilePath$
  Debug FilePath$
  fileUrl$ = "file://" + URLEncoder(FilePath$)
  Debug fileUrl$
  RunProgram("open","-u " + fileUrl$,"")
EndIf
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
Piero
Addict
Addict
Posts: 874
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

Re: Double Quotes Bug

Post by Piero »

mk-soft wrote: Sun Apr 30, 2023 12:20 pm Interesting problem ;)

But not with complex filename as 'this "is" text.txt'
But i found a solution as url path

Code: Select all

FilePath$ = OpenFileRequester("","","",0)
If FilePath$
  Debug FilePath$
  fileUrl$ = "file://" + URLEncoder(FilePath$)
  Debug fileUrl$
  RunProgram("open","-u " + fileUrl$,"")
EndIf
Many thanks for the solution!!!
But I still consider it a bug, because it affects the parameter string, e.g. if you want to run program osascript with parameter "tell app "Finder" to activate"... or any other "Console" command that needs double quotes on parameters...
User avatar
mk-soft
Always Here
Always Here
Posts: 6212
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Double Quotes Bug

Post by mk-soft »

I don't see it as a bug, as a problem.

Double quotes is always the indication that the following parameter contains blanks and interpreted within double quotes as a single parameter.
Last edited by mk-soft on Sun Apr 30, 2023 1:14 pm, edited 2 times in total.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
Piero
Addict
Addict
Posts: 874
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

Re: Double Quotes Bug

Post by Piero »

mk-soft wrote: Sun Apr 30, 2023 12:46 pm I don't see it as a bug, as a problem.
Double quotes is always the indication that the following parameter contains blanks and interpreted within double quotes as a single parameter.
Then let's see it as a BIG problem that just needs at least one way to "escape" double quotes for some "console commands"...

…like this "Terminal Magic":
open "/Users/user/Desktop/New Folder/'this \"is\" text'.txt"

 :wink:

...and THANKS AGAIN!
Post Reply