Page 1 of 4

Sharing some things I've learned

Posted: Wed May 03, 2023 6:36 am
by Piero
If you cannot sign your PureBasic apps (not an Apple certified developer) but want to publish them for download, you better advise that:
— For Silicon apps they may need to open Terminal and write or paste xattr -cr ~/Downloads/YourApp.app (then press Return)
…they can also paste "xattr -cr " then drop the app on Terminal and press Return…
— For Intel apps they may need to open it using control-click —> open

When posting code on this Forum, replace the opening code tag [code] with [code=purebasic]

Code: Select all

Debug "Hello World!"
 
That's All! (for now…)
Noob Piero :mrgreen:

PureBasic code in Html

Posted: Wed May 03, 2023 7:56 am
by Piero
If you need to publish your PureBasic code (and not only!) on a web page, I suggest Highlight
Image

Screen Space!

Posted: Wed May 03, 2023 9:17 am
by Piero
If you want/need a LOT more screen space (with native resolution, but you can also set up an enormous virtual screen)
I suggest BetterDisplay
It still works when trial ends! (trial is only for the "pro" features)
Be SURE you have set up zoom on system preferences/accessibility before using it!!!

If you want to run an Applescript…

Posted: Wed May 03, 2023 2:02 pm
by Piero
I'm kidding!
This is a joke for mk-soft!

P.S.: THANK YOU!

Re: Sharing some things I've learned

Posted: Wed May 03, 2023 7:14 pm
by benubi
I don't own a Mac but I didn't know the code tag trick.
Thank you!

Re: Sharing some things I've learned

Posted: Thu May 04, 2023 10:20 am
by Piero
benubi wrote: Wed May 03, 2023 7:14 pm Thank you!
You are very welcome!
In case you may need it, there are Highlight "versions" for other OSs; it's not only for Mac!

Re: Sharing some things I've learned

Posted: Thu May 04, 2023 8:30 pm
by Demivec
You can also use [code-pb] to do the same thing.

Only for AppleScripters?

Posted: Fri May 05, 2023 9:45 am
by Piero
This script uses BBEncoder and must be launched from script menu (or another "global launcher" like FastScripts) because it copies selection (must be an app that copies in RTF text, like Safari or Script Editor) and formats the clipboard in BBcode so you can paste on this Forum:

on findAndReplaceInText(theText, theSearchString, theReplacementString)
       set AppleScript's text item delimiters to theSearchString
       
set theTextItems to every text item of theText
       
set AppleScript's text item delimiters to theReplacementString
       
set theText to theTextItems as string
       
set AppleScript's text item delimiters to ""
       
return theText
end findAndReplaceInText

property dspc : (ASCII character 202) & (ASCII character 202) -- in case use 160

tell application "System Events"
       set currapp to path to frontmost application as text
       
keystroke "c" using command down
       
delay 0.2
       
tell application "BBEncoder" to launch
       
tell application "BBEncoder" to activate
       
tell process "BBEncoder"
              if value of checkbox "Enclose in code tags." of window "BBEncoder" is 1 then tell checkbox "Enclose in code tags." of window "BBEncoder" to perform action "AXPress"
              
if value of checkbox "Replace tabs with 4 spaces" of window "BBEncoder" is 0 then tell checkbox "Replace tabs with 4 spaces" of window "BBEncoder" to perform action "AXPress"
              
set value of text area 1 of scroll area 1 of window "BBEncoder" to ""
              
set focused of text area 1 of scroll area 1 of window "BBEncoder" to true
              
keystroke "v" using command down
              
delay 0.2
              
set c to value of text area 1 of scroll area 2 of window "BBEncoder" as text
              
set c to my findAndReplaceInText(c, {"[left]", "[/left]"}, "")
              set c to my findAndReplaceInText(c, "    ", dspc & dspc)
              set c to my findAndReplaceInText(c, "[size=", "[size=10")
              
set the clipboard to c
       end tell
       
activate application currapp
       
quit application "BBEncoder"
end tell

Re: Only for AppleScripters?

Posted: Fri May 05, 2023 10:20 am
by Kiffi
Piero wrote: Fri May 05, 2023 9:45 am[...] so you can paste on this Forum:
But that's quite a lot of overhead. ~ 10 KB (your version) against 2 KB ('normal' code tags)

Re: Only for AppleScripters?

Posted: Fri May 05, 2023 10:56 am
by Piero
Kiffi wrote: Fri May 05, 2023 10:20 am But that's quite a lot of overhead. ~ 10 KB (your version) against 2 KB ('normal' code tags)
Is there an applescript code tag? I tried some but they didn't work :(
Anyway with that script you can also copy e.g. portions of web pages...

Re: Sharing some things I've learned

Posted: Fri May 05, 2023 11:05 am
by AZJIO

Re: Sharing some things I've learned

Posted: Fri May 05, 2023 11:16 am
by Piero
AZJIO wrote: Fri May 05, 2023 11:05 am Piero, look at this.
viewtopic.php?t=39499&start=45
viewtopic.php?p=591608#p591608
Thanks! Interesting!
PS:
But isn't that only for the IDE?
If not, forgive me! I will read it all later when I'm less busy!

Re: Sharing some things I've learned

Posted: Fri May 05, 2023 6:27 pm
by Piero
AZJIO wrote: Fri May 05, 2023 11:05 am Piero, look at this.
I now saw, and, as I already said, it's interesting!
But from my point of view (at least for now: I'm a PB noob) it's easier for me to find a solution like passing thru RTF (as you saw)
You have no idea of what I did with "syntax stuff" in TextMate...

You made me remember this; I hope you will find it interesting:
https://morioh.com/p/7720382fffb8

PS: Thanks!

Re: Sharing some things I've learned

Posted: Fri May 05, 2023 7:49 pm
by AZJIO
Piero wrote: Fri May 05, 2023 6:27 pm RTF
I also wrote programs with RTF, but in a different language. Binding to Windows is less interesting to me now, in this regard, Scintilla is free and cross-platform. For example, using RTF, I made regular expression highlighting in RegExp, as well as congratulatory texts with a spectral gradient (RTFtoBBCode, RTFtoHTML), as well as a program for creating code highlighting themes.
I can convert code to html in many ways using Notepad++ plugin and AkelPad plugin

Re: Sharing some things I've learned

Posted: Fri May 05, 2023 8:51 pm
by Piero
AZJIO wrote: Fri May 05, 2023 7:49 pm Binding to Windows is less interesting to me now
It's generally easy to find "console/unix" tools, like code highlighters etc…
What I suggest you from my experience is:
First, "install the installers" with homebrew https://brew.sh (like pip environment etc...)
THEN make your experiments!
Or you can end up with a mess!
I was very concise, believing you will understand me ;)