Author Topic: WPS File Types. What do you think?  (Read 1653 times)

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 251
  • -Receive: 46
  • Posts: 1674
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
WPS File Types. What do you think?
« on: October 25, 2017, 06:04:44 pm »
Hi

I was wondering the other day about OS/2's WPS File Types that are installed by default. There are several ones like "COBOL code", "Fortran Code", "Webexplorer URL" and others (it is just an example, COBOL lovers please don't freak out) that I don't think should be on the base OS, but it should be optionally installed if the program that manages that types is installed too.

A "File Type" is a definition that can be created on OS/2 and associated to several file extensions and different software to open it.
Here I wrote a little articles about playing with those "File Types" and file extensions.

Do you think it make sense to update that "File Types" and try to make it more current? or maybe that "File Types" was not a good idea on the first place and should not be touched anymore?

Regards
« Last Edit: October 25, 2017, 06:20:03 pm by Martin Iturbide »


Martin Iturbide
OS2World NewsMaster
... just share the dream.

André Heldoorn

  • Full Member
  • ***
  • Thank You
  • -Given: 37
  • -Receive: 8
  • Posts: 222
    • View Profile
Re: WPS File Types. What do you think?
« Reply #1 on: October 25, 2017, 08:40:49 pm »
</silence>An ASSOCTYPE is not an "alternative". You can associate the individual files "FOO.BAR", "FCUK.RPM" and "Wednesday week 41" with a SUDOKU.EXE by using an ASSOCTYPE, while no ASSOCFILTER is associated with SUDOKU.EXE. Fixed (HPFS/JFS-quotes parsing), untested sample Rexx code to set the file type of a dropped file to Sudoku:

Code: [Select]
/* REXX SetType.cmd */
/* only used during installation */

rcode = RxFuncAdd( 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs' )
rcode = SysLoadFuncs()
parse arg fn
if left(fn,1)='"' THEN PARSE VAR fn '"' fn '"' .
/* set Sudoku .TYPE EA for the file */
type = 'Sudoku'
typeEA = 'DFFF00000100FDFF'x || d2c( length( type ) ) || '00'x || type
call SysPutEA fn, '.TYPE', typeEA

exit
<silence>
« Last Edit: October 26, 2017, 01:55:53 pm by André Heldoorn »

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 251
  • -Receive: 46
  • Posts: 1674
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: WPS File Types. What do you think?
« Reply #2 on: October 26, 2017, 07:11:20 pm »
Thanks for the reply.

I'm not a REXX developers so I'm not sure how to use that script.

I will like to have an script to associate in batch to some "*.zip" files to the "Zip File" WPS file type.

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

André Heldoorn

  • Full Member
  • ***
  • Thank You
  • -Given: 37
  • -Receive: 8
  • Posts: 222
    • View Profile
Re: WPS File Types. What do you think?
« Reply #3 on: October 27, 2017, 01:52:12 pm »
I'm not a REXX developers so I'm not sure how to use that script.

I will like to have an script to associate in batch to some "*.zip" files to the "Zip File" WPS file type.

</silence>As a drop target?

I'm not developing the programming language Rexx too, nor the script of one of the Sudoku distributions, nor customized Rexx apps.

But I guess ShowSub is sample code which probably uses SysFileTree() to support wildcards. In the case of ShowSub it will be used to support one file only, without always having to type the whole name of the file. Like typing *.PDF instead of "List of hotels in Quito - verified reviews (concept X).PDF", if that's the only file which does match the pattern *.PDF indeed.

A simple DO-loop can be used to set the EAs for all qualifying files. The posted script requires replacing the type's name Sudoku by your "Zip File" type name. If you want CLI with wildcards, instead of a drop target, then ShowSub is a sample. Learning the syntax of DO-loops is easy for you.

FWIW: just one of the reasons to not deliver a Rexx script for Zip File types is that my copy of 7-Zip, un-OS/2'ífied Unix software, doesn't really support wildcards, and despite of having full disks I don't want to procuce a wrapper and support un-OS/2'ified Unix software. A 7-Zip wildcards wrapper, e.g. to extract all *.7Z files, would use about the same technique.<silence>

Andreas Kohl

  • Full Member
  • ***
  • Thank You
  • -Given: 4
  • -Receive: 9
  • Posts: 169
    • View Profile
    • warpserver.de
Re: WPS File Types. What do you think?
« Reply #4 on: October 27, 2017, 09:48:30 pm »
Hi

I was wondering the other day about OS/2's WPS File Types that are installed by default. There are several ones like "COBOL code", "Fortran Code", "Webexplorer URL" and others (it is just an example, COBOL lovers please don't freak out) that I don't think should be on the base OS, but it should be optionally installed if the program that manages that types is installed too.
PMWP is part of OS/2 since version 2.0 so everything is fine. You can alter the settings from within the Workplace Shell so there's no problem. Simple use the settings page of the data file template to add or remove association types.

Quote
A "File Type" is a definition that can be created on OS/2 and associated to several file extensions and different software to open it.
Here I wrote a little articles about playing with those "File Types" and file extensions.
That's a complete different thing. WP_ASSOC_TYPE is not WP_ASSOC_FILTER to keep it simple. With association types it's possible to handle file objects with the same extension in different ways, or even better you don't have to care about a file name extension or file type at all.

Quote
Do you think it make sense to update that "File Types" and try to make it more current? or maybe that "File Types" was not a good idea on the first place and should not be touched anymore?
"File_Type" has no direct relation to WP_ASSOC_TYPE or WP_ASSOC_FILTER. A filter has not to be specific only to an extension. There's no reason to break compatiblity for Workplace aware applications by default.

Andreas Kohl

  • Full Member
  • ***
  • Thank You
  • -Given: 4
  • -Receive: 9
  • Posts: 169
    • View Profile
    • warpserver.de
Re: WPS File Types. What do you think?
« Reply #5 on: October 28, 2017, 01:26:50 pm »
</silence>An ASSOCTYPE is not an "alternative". You can associate the individual files "FOO.BAR", "FCUK.RPM" and "Wednesday week 41" with a SUDOKU.EXE by using an ASSOCTYPE, while no ASSOCFILTER is associated with SUDOKU.EXE. Fixed (HPFS/JFS-quotes parsing), untested sample Rexx code to set the file type of a dropped file to Sudoku:

Code: [Select]
/* REXX SetType.cmd */
/* only used during installation */

rcode = RxFuncAdd( 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs' )
rcode = SysLoadFuncs()
parse arg fn
if left(fn,1)='"' THEN PARSE VAR fn '"' fn '"' .
/* set Sudoku .TYPE EA for the file */
type = 'Sudoku'
typeEA = 'DFFF00000100FDFF'x || d2c( length( type ) ) || '00'x || type
call SysPutEA fn, '.TYPE', typeEA

exit
In most cases there's no reason for low level file handling done by REXX. RexxUtil has SysSetObjectData to change objects' settings. Unfortunately in the above sample the resulting EAs are incomplete and can cause undefined behaviour. So better avoid manipulating EAs directly without verification.

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 251
  • -Receive: 46
  • Posts: 1674
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: WPS File Types. What do you think?
« Reply #6 on: October 31, 2017, 01:14:04 pm »
</silence>As a drop target?

Not as a drop target. Just as a command that script where you can say "Assign the "Zip file" file type to all *.zip files".  Is it something like that?

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Andreas Kohl

  • Full Member
  • ***
  • Thank You
  • -Given: 4
  • -Receive: 9
  • Posts: 169
    • View Profile
    • warpserver.de
Re: WPS File Types. What do you think?
« Reply #7 on: October 31, 2017, 06:13:52 pm »
</silence>As a drop target?

Not as a drop target. Just as a command that script where you can say "Assign the "Zip file" file type to all *.zip files".  Is it something like that?

That's not the way PMWP handles file types. Why should a text file named "text.zip" be the same association as an Zip archive with the name "Ziparchive"? If somebody wants this way of misbehaviour association filters can be used. Every OS/2 in the last 25 years came with MAKEINI and INI.RC to change the assoc types and filters on the desktop en bloc.

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 251
  • -Receive: 46
  • Posts: 1674
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: WPS File Types. What do you think?
« Reply #8 on: October 31, 2017, 11:25:01 pm »
That's not the way PMWP handles file types. Why should a text file named "text.zip" be the same association as an Zip archive with the name "Ziparchive"? If somebody wants this way of misbehaviour association filters can be used. Every OS/2 in the last 25 years came with MAKEINI and INI.RC to change the assoc types and filters on the desktop en bloc.

Hi Andreas. The question is not why?

I have a directory full of *.zip files (not text files) and I just want to assign the "Zip File" file type to them. Instead of associating the *.zip files to a program, I want to assign the "*.zip" files on that directory to the "Zip file" type.

My issue is that I only know how to assign "File Types" to a file one by one and I want to assign it in batch.

Regards
« Last Edit: October 31, 2017, 11:27:36 pm by Martin Iturbide »
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Andreas Kohl

  • Full Member
  • ***
  • Thank You
  • -Given: 4
  • -Receive: 9
  • Posts: 169
    • View Profile
    • warpserver.de
Re: WPS File Types. What do you think?
« Reply #9 on: November 01, 2017, 01:10:49 pm »
I have a directory full of *.zip files (not text files) and I just want to assign the "Zip File" file type to them. Instead of associating the *.zip files to a program, I want to assign the "*.zip" files on that directory to the "Zip file" type.

My issue is that I only know how to assign "File Types" to a file one by one and I want to assign it in batch.

As long the directory is situated on a file system supporting extended attributes simple tools like "FT.CMD - File Type Modifier" (from Lachlan O'Dea) can do this job.
To show all types in a directory structure you can invoke:
FT.CMD *.asm /l /s
Which results in:
Code: [Select]
***** FT.CMD - File Type Modifier V1.0 *****
Copyright (c) Lachlan O'Dea 1994

Processing: D:\Projekt\WPS\test.asm
  1 Types present:
    Assembler Code

Processing: D:\Projekt\WPS\subdir\ext1.asm
  1 Types present:
    Assembler Code

*** Finished ***
Or to change all files: FT.CMD *.asm /a "Assembler Code" /r "Plain Text" /s
Code: [Select]
Processing: D:\Projekt\WPS\test.asm
  * The type "Assembler Code" was not added, as it was already present
  Deleted: Plain Text

Processing: D:\Projekt\WPS\subdir\ext1.asm
  Added: Assembler Code
  Deleted: Plain Text

*** Finished ***

Hobbes: ft.zip

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 251
  • -Receive: 46
  • Posts: 1674
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: WPS File Types. What do you think?
« Reply #10 on: November 06, 2017, 10:49:50 pm »
Thanks Andreas. FT.cmd worked as expected. I just wanted to turn a batch of zip files into "Compressed File" file type and it worked ok.

Code: [Select]
[C:\DESKTOP\ZipFiles]FT *.zip /a "Compressed File"
***** FT.CMD - File Type Modifier V1.0 *****
Copyright (c) Lachlan O'Dea 1994

Processing: C:\DESKTOP\ZipFiles\21uprt64.zip
  Added: Compressed File

Processing: C:\DESKTOP\ZipFiles\apcodec6.zip
  Added: Compressed File

Processing: C:\DESKTOP\ZipFiles\colortool-1.0-os2.zip
  Added: Compressed File

Processing: C:\DESKTOP\ZipFiles\conrt-1-0-3.zip
  Added: Compressed File

*** Finished ***

I also wrote it down on the wiki since I forget things from time to time.

Regards
« Last Edit: November 06, 2017, 11:32:33 pm by Martin Iturbide »
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Andreas Kohl

  • Full Member
  • ***
  • Thank You
  • -Given: 4
  • -Receive: 9
  • Posts: 169
    • View Profile
    • warpserver.de
Re: WPS File Types. What do you think?
« Reply #11 on: November 07, 2017, 03:51:31 am »
Thanks Andreas. FT.cmd worked as expected. I just wanted to turn a batch of zip files into "Compressed File" file type and it worked ok.
I would recommend a name for the file type that would be more logical. Typical Zip archived files cannot be compressed files. Zip is a container format that can contain a compressed file or even more of them. It can also contain uncompressed (stored) files or a mixture of different compression methods. It's easy to create a simple text file with only 10 times "0" and make a Zip archive of it. The resulting archive file will be larger than the compressed content. "Compressed file" would fit better to all this *.z, *.Z (hard to distinguish under OS/2), *.gz or *.bz2 stuff - or generally to all file formats that use some kind of compression (so most of all image or audio files).

André Heldoorn

  • Full Member
  • ***
  • Thank You
  • -Given: 37
  • -Receive: 8
  • Posts: 222
    • View Profile
Re: WPS File Types. What do you think?
« Reply #12 on: November 07, 2017, 12:06:46 pm »
There are several ones like "COBOL code", "Fortran Code", "Webexplorer URL" and others (it is just an example, COBOL lovers please don't freak out) that I don't think should be on the base OS

</silence>An advantage of some (!) useless ASSOCTYPEs/templates is that it promotes using ASSOCTYPEs. No selectable existing file types could be possible, but you may still want to show new users what's possible.

So perhaps your outdated "Webexplorer URL" file type has to be modernized/renaqmed. To show that a file called "martinus.com" possibly is a working URL object, to be executed by Firefox, instead of some executable *.COM DOS file which will be executed by a COMMAND.COM.

Andreas' fine FT is, if anything, an overengineered and improved version of the earlier, simple drag & drop code or of the same drag & drop code with a loop to process all matching file names.

"Compressed File" is a generic description indeed. Yet another reincarnation of RAR-archive can be processed by some 7Z WPS object, but I'm not sure that this 7Z WPS object will support my own, compressed *.8Z file format properly. The name of the file type may be too generic, like "Vector image", albeit so far you're the only user and you're aware of what this file type represents.<silence>

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 251
  • -Receive: 46
  • Posts: 1674
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: WPS File Types. What do you think?
« Reply #13 on: November 07, 2017, 08:03:17 pm »
Hi André

I think that it can be interesting for ArcaOS to update the WPS file types, but I'm almost sure we could never get a consensus of which should the be the base set of WPS File Types that should be predefined on the OS. On the other hand there are users that complete ignore the WPS File Types, find it irrelevant or think it will only help to increase the size of the INI files.

General Question: Should the "WPS File Types" be left on the oblivion ?

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

André Heldoorn

  • Full Member
  • ***
  • Thank You
  • -Given: 37
  • -Receive: 8
  • Posts: 222
    • View Profile
Re: WPS File Types. What do you think?
« Reply #14 on: November 10, 2017, 11:32:16 am »
I think that it can be interesting for ArcaOS to update the WPS file types, but I'm almost sure we could never get a consensus of which should the be the base set of WPS File Types that should be predefined on the OS. On the other hand there are users that complete ignore the WPS File Types, find it irrelevant or think it will only help to increase the size of the INI files.

</silence>You can delete yours, the unused ones obviously, after having created a WPS back-up. But ...

Code: [Select]
/**/

CALL RxFuncAdd 'SysIni','RexxUtil','SysIni'

key.0=0
CALL SysIni 'USER','PMWP_ASSOC_TYPE','ALL:','key.'

DO i=1 TO key.0
  value='12'
  value=SysIni('USER','PMWP_ASSOC_TYPE',key.i)
  IF Length(value)<2 THEN DO
    CALL SysIni 'USER','PMWP_ASSOC_TYPE',key.i,'DELETE:'
    SAY 'Deleted ASSOCTYPE:' key.i
  END
END i

EXIT

... installed software may assume that you're using a legacy ASSOCTYPE, which untested Rexx code may have deleted for you. By accident, of course.

In general the manager of the product AN has the power to rename types, delete unused types during an upgrade, or to introduce even more renewed types to not break anything. Then it's a matter of documentation, and yet another avoidable difference.

I can image that reducing the number of ASSOCTYPEs is not a priority for AN. And an user can add, delete or edit existing type names, while being aware what may stop working correctly. Fortunately adding is easy, so breaking new software isn't that likely.<silence>