Double Quotes Bug
Re: Double Quotes Bug
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
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Re: Double Quotes Bug
I'm good with applescript, if you will ever need something…
-- by Piero
on roman2arabic(str)
set r to 0
repeat with i from 1 to (count str)
set r to r + (item (offset of (item i of str) in "mdclxvi") of {1000, 500, 100, 50, 10, 5, 1}) * (((((offset of (item (i + 1) of (str & "@")) in "mdclxvi@") ≥ (offset of (item i of str) in "mdclxvi")) as integer) * 2) - 1)
end repeat
end roman2arabic
on arabic2roman(n)
set r to ""
repeat with i from 1 to (count (n as string))
set r to item (((item -i of (n as string)) as integer) + 1) of item i of {{"", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"}, {"", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC"}, {"", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM"}, {"", "M", "MM", "MMM"}} & r
end repeat
end arabic2roman
display dialog arabic2roman(roman2arabic("xvi"))
…but not with all that mess where it's mixed with cocoa, objc and whatever...
Thanks again!
Perl Example
Code: Select all
; Some RTF text must be on clipboard...
; Applescript (no problem):
; display dialog "RTF Clipboard to HTML:" default answer do shell script "osascript -e 'the clipboard as \"RTF \"' | perl -ne 'print chr foreach unpack(\"C*\",pack(\"H*\",substr($_,11,-3)))' | textutil -stdin -stdout -convert html -format rtf"
; Terminal (no problem):
; osascript -e 'the clipboard as "RTF "' | perl -ne 'print chr foreach unpack("C*",pack("H*",substr($_,11,-3)))' | textutil -stdin -stdout -convert html -format rtf
; Purebasic console (double quotes error):
p$= ~"-e 'the clipboard as \"RTF \"' | perl -ne 'print chr foreach unpack(\"C*\",pack(\"H*\",substr($_,11,-3)))' | textutil -stdin -stdout -convert html -format rtf"
RunProgram("osascript", p$, "", #PB_Program_Wait)
Re: Double Quotes Bug
RunProgram not start multipli programs like terminal. Bind "|"
-> osascript -> perl -> textutil
-> osascript -> perl -> textutil
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
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Re: Double Quotes Bug
Code: Select all
prog = RunProgram("echo", ~"\"can you get a nicely \"double quoted\" output?\"", "", #PB_Program_Open | #PB_Program_Read)
Output$ = "" : If prog
While ProgramRunning(prog) : If AvailableProgramOutput(prog):Output$ + ReadProgramString(prog) + Chr(13)
EndIf : Wend : CloseProgram(prog) : EndIf : MessageRequester("Output", Output$)
Forgive the """indentation""" :)
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Re: Double Quotes Bug
I had some laughs re-reading this thread after some time passed...
Anyway, to summarize, the problem is:
Runprogram parameter is always considered as """literal""", no way to get results from """complex""" shell commands…
That's a big, BIG limitation…
PS: Fred, you're interesting

Anyway, to summarize, the problem is:
Runprogram parameter is always considered as """literal""", no way to get results from """complex""" shell commands…
That's a big, BIG limitation…
PS: Fred, you're interesting


-
- Addict
- Posts: 4779
- Joined: Thu Jun 07, 2007 3:25 pm
- Location: Berlin, Germany
Re: Double Quotes Bug
Here you go!

-
- Addict
- Posts: 4779
- Joined: Thu Jun 07, 2007 3:25 pm
- Location: Berlin, Germany
Re: Double Quotes Bug
Oh well ...
Re: Double Quotes Bug
I'm jealous!

Re: Double Quotes Bug
There is a "workaround"!!! (THANKS deseven!!!):
viewtopic.php?p=605503&sid=7aa7f71171f2 ... 1c#p605503
viewtopic.php?p=605503&sid=7aa7f71171f2 ... 1c#p605503