Setting up Pascal on Windows

M S
M S used Ask the Experts™
on
I have a need to write some Pascal programs, after several decades' hiatus.  I downloaded a free version of Pascal from www.freepascal.org.  I also found https://www.freepascal.org/docs-html/current/user/user.html#userch2.html.  

My helloworld program is working nicely, but it was stored to an awkward location: C:\FPC\3.0.4\bin\i386-win32.  Is it possible to save my files to a subdirectory?

When I start the program, I get a very old-fashioned kind of window.  I can't figure out how to close a program after I've saved it (except for killing Pascal entirely).

I would rather use notepad++ for editing my programs.

There is mention of Lazarus but I don't have any experience with that.  I have downloaded and installed it but am not sure what to do next with it.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Developer
Fellow 2017
Most Valuable Expert 2018
Commented:
> Is it possible to save my files to a subdirectory?

Yes. Do a File>Change dir... and set whatever folder you want. It doesn't have to be a subfolder of C:\FPC. Can be anywhere!

> I can't figure out how to close a program after I've saved it (except for killing Pascal entirely).

Click the small, green bar in the upper left (underneath the File menu). Looks like this:

fpc close
> I would rather use notepad++ for editing my programs.

Absolutely! I use my fav text editor instead of FPC's basket-case editor. Do all your editing in NPP, save the file, then do File>Reload in FPC. You'll get this:

fpc reload
Of course, click Yes. Regards, Joe
bbaoIT Consultant

Commented:
i am wondering if Joe and the author are talking about the same Pascal product. obviously Joe's screenshots indicate he is referring to Turbo Pascal from Borland (is it still alive?).
Joe WinogradDeveloper
Fellow 2017
Most Valuable Expert 2018

Commented:
Hi bbao,
Nope! We're talking about the same product, Free Pascal. What's confusing you is that the path to the source file is in a folder called J:\Turbo\TURBOFIL where I stored all my Borland Turbo Pascal programs from yesteryear. It is not still alive, which is why I switched to Free Pascal. However, in recent years, I've rewritten all my important Turbo Pascal programs in AutoHotkey. Regards, Joe
Acronis in Gartner 2019 MQ for datacenter backup

It is an honor to be featured in Gartner 2019 Magic Quadrant for Datacenter Backup and Recovery Solutions. Gartner’s MQ sets a high standard and earning a place on their grid is a great affirmation that Acronis is delivering on our mission to protect all data, apps, and systems.

M S

Author

Commented:
Thank you, Joe.  I'm making good progress.  Not sure if I need to write a new question for this: I would like to set the .pas files to open with notepad++.  However, there is no "open with" in the context menu, and .pas doesn't appear in the default list.  (For now I've been opening notepad++ and using the Open feature.)

I remembered that to run the program I can double-click on the executable (after the program has compiled).  Within Windows Explorer, that is.

Should I write a separate question about Lazarus?

I
Joe WinogradDeveloper
Fellow 2017
Most Valuable Expert 2018

Commented:
> there is no "open with" in the context menu

I  can't imagine why there wouldn't be an "Open with..." when you right-click on a .PAS file in whatever file manager you use. I get one here and, in fact, I've done the same thing that you want to do...I associated .PAS with my fav text editor. But if you're not getting the "Open with..." in your file manager, try this alternate way:

Control Panel
Default Programs
Associate a file type or protocol with a program

Btw, as an ex-Pascal programmer myself, I switched to writing my programs in AutoHotkey, as I mentioned above, and have never looked back. You may want to give it a spin. This EE article will get you started on it:

AutoHotkey - Getting Started

Yes, you should open a separate question for Lazarus. Regards, Joe
M S

Author

Commented:
It is weird.  I tried the Windows->Start method as well.  But .pas didn't appear in the list.
Joe WinogradDeveloper
Fellow 2017
Most Valuable Expert 2018

Commented:
Post a screen shot of the context menu when you right-click on a . PAS file. Since W7 is one of the Topics for this question, I presume you're using Windows Explorer as your file manager, but if not, let me know what file manager you're using. Oh, one other idea. Right-click on a .PAS file and click Properties. You should see an "Opens with:" item. Click the "Change..." button next to it.

Btw, the AutoHotkey language that I mentioned above can very likely help you with your automation of tedious web queries question. Regards, Joe
M S

Author

Commented:
Yes, Windows Explorer.  I was able to do Open With now.  I had the bright idea of CLOSING PASCAL and then trying again.  I should have thought of this before....

I found a tutorial about getting started with Lazarus at schoolfreeware.com.  I'm thinking Lazarus might be more than I need.  I'm just going to be doing text processing.

How do you go about debugging Free Pascal?
Joe WinogradDeveloper
Fellow 2017
Most Valuable Expert 2018

Commented:
> I had the bright idea of CLOSING PASCAL and then trying again.

Well, I can't imagine that would affect the file extensions shown in the context menu or in Control Panel>Default Programs>Associate a file type or protocol with a program.

> I'm just going to be doing text processing.

I suspect NPP will be fine for you.

> How do you go about debugging Free Pascal?

I suggest a new question for that. This question is "Setting up Pascal on Windows". Now that it is set up on Windows, this question is answered. Coding/debugging with it is a big subject and worthy of a new question...or questions. Regards, Joe
bbaoIT Consultant

Commented:
thanks for your clarification and further information Joe.
Joe WinogradDeveloper
Fellow 2017
Most Valuable Expert 2018

Commented:
You're welcome, bbao...happy to help. Regards, Joe

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial