New FoxBin2Prg Tools

231 views
Skip to first unread message

Mike Potjer

unread,
Nov 25, 2014, 1:16:08 PM11/25/14
to FoxPr...@googlegroups.com
Hi All,

The attached file with the ZOP extension is a ZIP file containing 3 tools, and a plug-in shared by all 3, that I'm submitting for inclusion in the Thor repository.  These tools add some convenience features for using FoxBin2Prg.
To try out these tools, simply unzip the attached file into your Thor "My Tools" folder, and they will appear under a "FoxBin2Prg" sub-topic of "Applications".

The tools all appear highlighted in yellow indicating that they are custom tools.  If they become part of the official Thor repository, you will want to delete them from the "My Tools" folder so that you get the latest version through Thor updates.

The first tool, Create/Edit FoxBin2Prg "SendTo" shortcuts, displays a dialog that makes it easy to setup or remove Windows "Send to" shortcuts for the VB scripts included with FoxBin2Prg.  If you already manually created shortcuts in the standard user "Send to" folder, this tool should find them and allow you to edit them.

  1. A default name for the shortcut is displayed in a textbox, allowing you to edit the name directly in this form.  TAB out of the textbox when you finish editing the name, then either
  2. Click the Create button to add the shortcut, if it doesn't already exist, or
  3. Click the Save button to update the name if the shortcut already exists.

After clicking the Create button,

  1. The caption will change to Edit, allowing you to edit any other settings of the shortcut, and
  2. The shortcut will now appear under the "Send to" context menu in Windows Explorer.
The Edit button opens the Windows file properties dialog, where you can edit any settings of the shortcut.

The Remove button simply deletes the shortcut, moving it to the recycle bin.  There is a non-visual class in the Thor_Tool_FoxBin2PrgCreateShortcuts.PRG which performs all the real work of this tool, so if you want to create your own version of the tool with a different interface, or no interface at all, it should be pretty easy to do.  There is some code commented out in the .PRG which demonstrates creating all the shortcuts programmatically.

The other 2 tools are pretty straightforward and act on a VFP project.  Both will act on the ActiveProject in the IDE, if there is a project open in the Project Manager.  Otherwise, they will prompt you for a file.

Convert Project files to FoxBin2Prg text will convert a VFP .PJX file, and all the binary files in the project, to their FoxBin2Prg text format.  This conversion is done through the FoxBin2Prg.EXE, so all your FoxBin2Prg configuration settings will be respected.

Generate Project files from FoxBin2Prg text works in the other direction.  If there is an ActiveProject in the IDE, it assumes you want to regenerate the .PJX and other binary files for that project.  This tool currently assumes you are using the PJ2 extension for your project text file, but this easy enough to change via a constant in the tool code.  Perhaps in the future the tool can be enhanced to get the extension from an option setting or by reading FoxBin2Prg configuration settings.  All other extensions are handled according to the FoxBin2Prg configuration settings.  There are a couple limitations with this tool due to the way VFP leaves .VCX files in memory, which means that this tool is most effective when called from a menu or via hotkey.  The tool will run from the Tool Launcher or the Thor toolbar, but you will get a warning, and under certain conditions FoxBin2Prg might give you an error message and not regenerate your .VCX files.

Finally, there is the Get FoxBin2Prg Folder plug-in shared by all the tools.  This first looks for FoxBin2Prg under the Components folder where Thor installs it, then checks a couple other places, then finally prompts you for the folder if it is unsuccessful.  If you have installed FoxBin2Prg in a custom folder, you can edit the plug-in as needed.  The easiest way to customize it is to enter the folder path in the constant at the top of the .PRG.

If you have any questions or suggestions, I'll try to address them.

Enjoy!

SCM-Tools.zop

Jim Nelson

unread,
Nov 25, 2014, 2:39:44 PM11/25/14
to FoxPr...@googlegroups.com
Mike --

Looks like great stuff.  Thanks so much!  

I will incorporate them into the next Thor Repository update, presumably this weekend.



--
You received this message because you are subscribed to the Google Groups "Thor, the Tool Manager for FoxPro" group.
To unsubscribe from this group and stop receiving emails from it, send an email to FoxProThor+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Fernando D. Bozzo

unread,
Nov 26, 2014, 3:10:13 AM11/26/14
to FoxPr...@googlegroups.com
MIke, great work, thanks! :D



Mike Potjer

unread,
Nov 26, 2014, 8:13:55 AM11/26/14
to FoxPr...@googlegroups.com
Fernando,

These tools wouldn't exist without the great work you did on FoxBin2Prg, so thank YOU!  And of course thanks to Jim Nelson for producing Thor to help bring all these tools together.

I've attached another update to this tool set, just rename to .ZIP and extract into your My Tools folder.  The binary to text and text to binary tools now display an MRU list of projects if there is no ActiveProject in the IDE.  Note that the list includes a "Browse..." option at the bottom if the project you want doesn't happen to be in the list.

Displaying image.png

Jim intends to include these tools in the Thor repository soon, with some additional enhancements, of course.  Watch for that in the near future.

Mike
SCM-Tools.zop

Fernando D. Bozzo

unread,
Dec 14, 2014, 12:10:04 PM12/14/14
to FoxPr...@googlegroups.com
Hi Mike:

Just in case you are interested, starting from FoxBin2Prg v1.19.38 (latest version by now) the vbs scripts are no more necessary.

In example:
In previous versions you needed to make shortcuts of VBS scripts "Convert_VFP9_PRG_2_BIN.vbs" and "Convert_VFP9_BIN_2_PRG.vbs" for batch conversions

From v1.19.38:
You can make 3 shortcuts of foxbin2prg.exe, move them to "SendTo" folder on your Windows profile and rename and edit those shortcuts as this:

Name------------------------  Right-click/Properties/destination-----------
FoxBin2Prg - Binary2Text.lnk  <path>\foxbin2prg.exe "BIN2PRG-INTERACTIVE"
FoxBin2Prg - Text2Binary.lnk  <path>\foxbin2prg.exe "PRG2BIN-INTERACTIVE"
FoxBin2Prg.lnk                <path>\foxbin2prg.exe "INTERACTIVE"

  • With "BIN2PRG" or "PRG2BIN" options, you can process directories or individual files
  • With just FoxBin2Prg.exe you can process individual files
  • With the "INTERACTIVE" option, a confirmation dialog will be shown when done, and errors are automatically shown too

Pros of using the EXE directly without vbs scripts:
  • You run only one process
  • The processing inside the EXE and the progressbar functionallity is more homegeneous
  • There are no problems if VBS scripting is disabled by IT dept, because does not depend on it


Cons of using the EXE directly:
  • You can't process a selection of files, just one file or one directory (Whith VBS scripts you can select various files at a time with Ctrl-Click or Shift-Click)

About don't processing a selection of files and directories, this is really not a cons, because when you select a directory for conversion, this directory is configured as the base compile directory and all the processed files are compiled based on this directory, just as the PJX does.


Just want you to know this new functionallity. VBS Scripts can be used anyway.


Best regards! :)

Mike Potjer

unread,
Dec 16, 2014, 11:12:45 AM12/16/14
to FoxPr...@googlegroups.com
Thanks Fernando, those sound like good changes.  I plan to try the changes, then update the Thor FoxBin2Prg shortcut tool accordingly and submit the changes to Jim.  Hopefully I can get that done soon.

Mike

Mike Potjer

unread,
Dec 16, 2014, 11:30:01 AM12/16/14
to FoxPr...@googlegroups.com
Hi Fernando,

Using the new "BIN2PRG-INTERACTIVE" option, my "Send to" shortcut works fine if I right-click on a folder and use the option, but when I right click on an individual binary file, the process fails with an error like the following in the error log:
2014-12-16T11:10:18  2014-12-16T11:10:18  --------------------------------------------------------------------------------
2014-12-16T11:10:18  Error 1963, Directory is not found.
ejecutar, 1943
DO c:\work\vfp\shared\tools\thor\tools\components\foxbin2prg\foxbin2prg.exe WITH "BIN2PRG-INTERACTIVE", "C:\Work\VFP\Test\fb2p-test\fb2p_frm_1.scx"


tc_InputDir = [C:\Work\VFP\Test\fb2p-test\fb2p_frm_1.scx]

Source file: 
2014-12-16T11:10:18  

The "PRG2BIN-INTERACTIVE" option appears to work fine for both folders and individual files.

Thanks,
Mike

Mike Potjer

unread,
Dec 16, 2014, 11:36:29 AM12/16/14
to FoxPr...@googlegroups.com

Hi Fernando,

When I run the "INTERACTIVE" option for an individual file, it appears to perform the action appropriate for the selected -- if the file is binary, the text file is created; if the file is text, the binary is created.  That's good.  But what is it supposed to do if I run it on a folder?  My folder has both text and binary files, which I think will be common for most people, but when I run it on a folder, it doesn't appear to do anything, and the result is like the attached image.

Thanks,
Mike

Fernando D. Bozzo

unread,
Dec 16, 2014, 11:46:04 AM12/16/14
to FoxPr...@googlegroups.com

Hijo Mike:

With just FoxBin2Prg you can only process files, nota directories.

That's why in a previous email I said this:

With "BIN2PRG" or "PRG2BIN" options, you can process directories or individual files

With just FoxBin2Prg.exe you can process individual files

With the "INTERACTIVE" option, a confirmation dialog will be shown when done, and errors are automatically shown too

When I get at home I look at the last error you describe. Weird thing is I tested it :-(

--
You received this message because you are subscribed to a topic in the Google Groups "Thor, the Tool Manager for FoxPro" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/FoxProThor/q9dNsdh8Vt4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to FoxProThor+...@googlegroups.com.

Mike Potjer

unread,
Dec 16, 2014, 12:03:59 PM12/16/14
to FoxPr...@googlegroups.com
Ah, I understand it now.  When you wrote about the "INTERACTIVE" option, I thought you were only referring to the last example, but you were referring to ALL examples.
So we can use "BIN2PRG" for "quieter" processing, and "BIN2PRG-INTERACTIVE" to always show a message at the end, and the same with "PRG2BIN".

Thanks for clarifying that.  I can take that into account with the Thor tool revisions.
Mike

Fernando D. Bozzo

unread,
Dec 16, 2014, 12:54:41 PM12/16/14
to FoxPr...@googlegroups.com
Yeah, may be it's a little confusing the wording I selected, but INTERACTIVE really refers to the action of show the last status message.



Fernando D. Bozzo

unread,
Dec 16, 2014, 1:19:09 PM12/16/14
to FoxPr...@googlegroups.com
Hi Mike:

I've made a mistake in the description:

> Using BIN2PRG or PRG2BIN keywords it's thought to be used with directories only (batch processing)
> Using FoxBin2Prg alone is for single files, for binaries or texts, depending on the source

The fact that using PRG2BIN keyword have processed a single file in your case, is really an uncontrolled option that processed the file by mistake

Do you think that have any sense to allow processing a single file with  BIN2PRG or PRG2BIN options, knowing that they can be converted with foxbin2prg alone?

You let me thinking on the INTERACTIVE keyword, may be I better rename it to MESSAGE or SHOWSMG or somethin else, what do you think?

I appreciate your comments,


Thanks!





Mike Potjer

unread,
Dec 16, 2014, 2:59:28 PM12/16/14
to FoxPr...@googlegroups.com
Fernando,

I really like that you added these options for the EXE.  The VB scripts are not a problem for me, but having these options makes it easier to create additional Thor tools.

First of all, I think it would be good to keep the 3 options you created: BIN2PRG, PRG2BIN, and FoxBin2Prg alone.

I like the behavior of FoxBin2Prg alone, that it knows how to handle an individual file automatically, with only one shortcut.  But if we want to do text to binary and binary to text for both individual files and folders, we need 3 shortcuts now -- one for individual files, and 2 for folders.  It would be nice if BIN2PRG and PRG2BIN were smart enough that if you passed in a file name instead of a folder, then they would use the "FoxBin2Prg alone" behavior.  Then we would not need more than 2 shortcuts.

An enhancement that I think would be nice would be if you selected a folder with FoxBin2Prg alone, then a message would appear asking what conversion you want to perform, something like this:

That would allow us to create one shortcut to do everything.  I think you should still keep the BIN2PRG and PRG2BIN options so that if a developer only uses binary to text and doesn't want to see the dialog, then they would only need to create a shortcut with the BIN2PRG option.

Finally, I think using "SHOWMSG" as the keyword makes more sense to me.  "INTERACTIVE" made me think of a dialog that would give me some choice I had to make.

Sorry if that's more than you asked for, but as Jim knows, if you ask me a question that's the risk you take. :-)
Mike

Fernando D. Bozzo

unread,
Dec 16, 2014, 5:59:47 PM12/16/14
to FoxPr...@googlegroups.com
Mike, I love your feedback, and I think that are great ideas.

I thought that INTERACTIVE where more to something like the dialog you suggest. I'm gonna change this and let you know when a preview is available for more feedback :)

Thanks!



Fernando D. Bozzo

unread,
Dec 21, 2014, 11:44:18 AM12/21/14
to FoxPr...@googlegroups.com
Hi Mike!

Sorry for the delay, but I've been developing your suggestions and fixing a few other things that where broken, as the error autoreporting when there are errors in the conversions and the multi-configuration.

Here is the link to the v1.19.39 Preview with the fixes:
https://vfpx.codeplex.com/downloads/get/1159381

I think you are gonna like this. Test it with a directory and the "INTERACTIVE" keyword alone :D


Best Regards!

Mike Potjer

unread,
Dec 23, 2014, 9:09:51 AM12/23/14
to FoxPr...@googlegroups.com
Hi Fernando,

Using FoxBin2Prg.EXE with "INTERACTIVE" alone, or with no parameter, works fine for individual files, but does not do anything when selecting a folder.  With the "INTERACTIVE" keyword, the FoxBin2Prg progress bar flashes quickly, and I get a "End of Process" message, but no files are generated.  I assume I should also see a screen that asks whether I want to convert text to binary, or binary to text, but there is nothing like that.

It also looks like there is some debugging code in the end message.  Every "End of Process" message includes "[p:n]", where n is an integer, like this screenshot.

I also tested the "BIN2PRG" and "PRG2BIN" keywords again.  These are both working well with individual files or folders, which is nice.

Thanks,
Mike

Fernando D. Bozzo

unread,
Dec 23, 2014, 10:12:15 AM12/23/14
to FoxPr...@googlegroups.com

Hijo Mike:

You must provide a directory name as second parameter so INTERACTIVE give you the choice for the conversion.

Mike Potjer

unread,
Dec 23, 2014, 11:06:50 AM12/23/14
to FoxPr...@googlegroups.com
Fernando,

I was trying to run from a shortcut before, so I tried running it from the Command Window in VFP using this command:

DO "C:\Work\VFP\Shared\Tools\Thor\Tools\Components\FoxBin2Prg\foxbin2prg.exe" WITH "INTERACTIVE", "C:\Work\VFP\Test\fb2p-test"

I still had the same result - a quick flash of the progress form, and "End of Process", but no prompt asking what I wanted to do.  Am I still calling it wrong, or is the preview download possibly missing some files?

Thanks,
Mike

Fernando D. Bozzo

unread,
Dec 23, 2014, 12:05:30 PM12/23/14
to FoxPr...@googlegroups.com
Mike, I've retested again, and you are right. You can verify it using "SHOWMSG" keyword only, because by mistake I've taked out the "INTERACTIVE" keyword that I'm restoring now :-(


Fernando D. Bozzo

unread,
Dec 23, 2014, 12:17:10 PM12/23/14
to FoxPr...@googlegroups.com
I've uploaded the Preview b.2 at VFPx, with the INTERACTIVE keywork fixed, but it work with SHOWMSG keyword anyway. I will maintain the INTERACTIVE for compatibility with the earlier verion.


Regards.-

Mike Potjer

unread,
Dec 23, 2014, 1:49:12 PM12/23/14
to FoxPr...@googlegroups.com
Thanks, Fernando,

I did not know that you had added the "SHOWMSG" option.  I re-tested Preview 1 with "SHOWMSG", and selecting a folder I get a prompt that asks what kind of conversion to perform.  So that works, as you said.

I then installed Preview 2, and "SHOWMSG" and "INTERACTIVE" both work, and have the same behavior.

Now I just need to update the "Create Shortcuts" tool for Thor.

Mike

Fernando D. Bozzo

unread,
Dec 23, 2014, 1:54:46 PM12/23/14
to FoxPr...@googlegroups.com
Hi Mike, I have finally keep the things this way and will explain why:

SHOWMSG keyword: Used when it is wanted that FoxBin2Prg show the status messages (and not external scripts)

INTERACTIVE keyword: Used when it is wanted that FoxBin2Prg aks what to do when a directory is selected and sent to FoxBin2Prg.exe/prg directly, but don't want that FoxBin2Prg show the final status message (because will be shown by the vbs scripts)


What this means in practice:

Use Case 1: You don't want vbs scripts, just foxbin2prg.exe/prg and process a directory

DO foxbin2prg.exe WITH "SHOWMSG-INTERACTIVE", "<directory>"  && Selection message appears and status message too


Use Case 2: You don't want vbs scripts, and want regenerating binaries

DO foxbin2prg.exe WITH "SHOWMSG-INTERACTIVE-PRG2BIN", "<directory>"  && Selection message appears and status message too


Use Case 3: You want VFP9_FoxBin2Prg.vbs script to process a directory

(This script now use the "INTERACTIVE" keyword so FoxBin2Prg shows the new dialog but the message is displayed by this script)


If you have any question, please, ask whatever needed.


Warm regards!




Fernando D. Bozzo

unread,
Dec 23, 2014, 1:59:56 PM12/23/14
to FoxPr...@googlegroups.com
Ups, a mistake on use Case 2, sorry:


Use Case 2: You don't want vbs scripts, and want regenerating binaries

DO foxbin2prg.exe WITH "SHOWMSG-PRG2BIN", "<directory>"  && Selection message appears and status message too


In this case, because the conversion is predefined (PRG2BIN) the INTERACTIVE keyword doesn't do anything and can be excluded.


Fernando.-

Mike Potjer

unread,
Dec 23, 2014, 2:35:30 PM12/23/14
to FoxPr...@googlegroups.com
Hi Fernando,

I tried Preview 3, but the options with just "SHOWMSG" and/or "INTERACTIVE" are not doing any conversion.
If the keyword is only "SHOWMSG" or "SHOWMSG-INTERACTIVE", then I get a prompt to select the type of conversion, the progress form flashes quickly, and an "End of Process" message, but nothing is converted.
If the keyword is only "INTERACTIVE", I get the prompt to select the type of conversion, the progress form flashes quickly, there is no "End of Process" (as expected), but nothing is converted.

If I use just the keywords "BIN2PRG" or "PRG2BIN", the conversion works correctly.  If I use the keywords "SHOWMSG-BIN2PRG" or "SHOWMSG-PRG2BIN", then the progress form flashes quickly and the "End of Process" message is displayed, but nothing is converted.

Thanks,
Mike

Fernando D. Bozzo

unread,
Dec 23, 2014, 2:44:32 PM12/23/14
to FoxPr...@googlegroups.com
I will take a look, and back to you.




Fernando D. Bozzo

unread,
Dec 23, 2014, 3:02:29 PM12/23/14
to FoxPr...@googlegroups.com
Ok, I've found the problem. In last change I've replaced keyword evaluation from "KEYWORD" $ cParameter to ATC("KEYWORD", cParameter) > 1, but should be ATC("KEYWORD", cParameter) >= 1

I've uploaded Preview b.4 with the fix.

Thanks Mike.-



Mike Potjer

unread,
Dec 23, 2014, 3:55:49 PM12/23/14
to FoxPr...@googlegroups.com
Awesome!  I tested "INTERACTIVE", "BIN2PRG", and "PRG2BIN" alone, and with "SHOWMSG" included, and everything is working as expected.

Thanks,
Mike

Fernando D. Bozzo

unread,
Jan 2, 2015, 5:22:22 AM1/2/15
to FoxPr...@googlegroups.com
Hi Mike:

I've finally released version v1.19.39 with your suggestions and other fixes and enhancements:

https://vfpx.codeplex.com/wikipage?title=FoxBin2Prg

The final options for configuration is this, when not using the vbs scripts:

Name------------------------ Right-click/Properties/destination-----------
FoxBin2Prg - Binary2Text.lnk <path>\foxbin2prg.exe "BIN2PRG-SHOWMSG"
FoxBin2Prg - Text2Binary.lnk <path>\foxbin2prg.exe "PRG2BIN-SHOWMSG"
FoxBin2Prg.lnk <path>\foxbin2prg.exe "INTERACTIVE-SHOWMSG"


But with the 3rd.option alone you don't need the other 2, because you can do everything: convert one file to the other (bin2prg or prg2bin) and convert a directory to whatever you choose next.


Mike, very thanks for your suggestions and ideas, I think that the new options make FoxBin2Prg more easy for the end user and now only one option is needed to do everything.

Cheers! :D

Mike Potjer

unread,
Jan 5, 2015, 4:19:38 PM1/5/15
to FoxPr...@googlegroups.com
Hi Fernando,

I've updated the FoxBin2Prg shortcut creator tool in the Thor repository, and submitted the changes to Jim.  Here is a summary of the changes:
  • The default behavior is to create a shortcut that calls the FoxBin2Prg.EXE directly, rather than calling the VBS script as before.
  • The tool can locate FoxBin2Prg shortcuts whether the shortcut uses the VBS script or the EXE.  If the user prefers the VBS script, they will be able to view and manually edit it via the Edit button.  Otherwise, they will be able to easily replace an existing VBS shortcut with one that calls the EXE instead (just Remove then Create).
  • For shortcuts using the EXE, there is a checkbox to indicate whether the current shortcut is setup to show a FoxBin2Prg results message, and the current setting of the shortcut can be changed via the checkbox and the Save button.
  • In addition to the controls for creating "Binary to Text" and "Text to Binary" shortcuts, there is a new set of controls for creating a "2-Way Conversion" shortcut.  This corresponds to the new "INTERACTIVE" behavior of FoxBin2Prg.
  • There is a button to open the Windows "Send to" folder in Windows Explorer, so you can manually add, edit, or remove shortcuts.
If you (or anyone) wants to try them out, change the extension of the attached file to .ZIP, and extract the files into your Thor "My Tools" folder.  Just make sure you delete the files from the "My Tools" folder when the official version is released in a future Thor Repository update.

Thanks again!
Mike

FoxBin2Prg Shortcut Tool.zop

Fernando D. Bozzo

unread,
Jan 5, 2015, 6:49:36 PM1/5/15
to FoxPr...@googlegroups.com
Thanks Mike! I give it a try! :D


Jim Nelson

unread,
Jan 5, 2015, 9:21:07 PM1/5/15
to FoxPr...@googlegroups.com
Everybody --

The changes described by Mike Potjer (below) have been included in the current update to the Thor Repository.

In addition, there are some minor changes to the settings page of Super Browse, based on suggestions from Tore.

--
You received this message because you are subscribed to the Google Groups "Thor, the Tool Manager for FoxPro" group.
To unsubscribe from this group and stop receiving emails from it, send an email to FoxProThor+...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--

Fernando D. Bozzo

unread,
Jan 5, 2015, 9:49:06 PM1/5/15
to FoxPr...@googlegroups.com

Thanks Jim, that's great!

You received this message because you are subscribed to a topic in the Google Groups "Thor, the Tool Manager for FoxPro" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/FoxProThor/q9dNsdh8Vt4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to FoxProThor+...@googlegroups.com.

Mike Potjer

unread,
Jan 6, 2015, 11:15:40 AM1/6/15
to FoxPr...@googlegroups.com
Thanks Jim!
Reply all
Reply to author
Forward
0 new messages