Author Topic: Color labels  (Read 245 times)

Devid

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 9
    • View Profile
Color labels
« on: October 12, 2019, 11:47:28 pm »
Hi
there is a way to label (for example with a color) or mark (with an icon/image) a file like Mac does?
Maybe reading/setting a sort of EA?

For example on XFCE (linux) I wrote a little shell script (in the popup menu) that mark the file icon.
Is it possible with AOS?

D.

André Heldoorn

  • Hero Member
  • *****
  • Thank You
  • -Given: 117
  • -Receive: 19
  • Posts: 776
    • View Profile
Re: Color labels
« Reply #1 on: October 13, 2019, 01:56:35 pm »
a way to label (for example with a color) or mark (with an icon/image) a file like Mac does?
Maybe reading/setting a sort of EA?

I'm not aware of what a Mac does nor what it looks like, but you can use a file type to set an icon if the file name has no fixed pattern. You may need something in the middle to assign the right marked icon.

I can create a "PDF file" called "C:\I_hate_file_extensions!!!" with a PDF icon because of the file type (EA), but I'll need something extra to change the file type to "Printed PDF file" with a matching marked PDF icon later. Without using CGI to modify and replace an existing icon, that is.
« Last Edit: October 13, 2019, 02:47:55 pm by André Heldoorn »

Laurence Pithie

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1
    • View Profile
Re: Color labels
« Reply #2 on: October 14, 2019, 02:52:09 am »
You can set a file's icon with the SysSetIcon function in the RexxUtil library. Just feed it the file name and the icon file name. The WPS can be a bit picky about the format of the icon though, if it isn't happy it will display the default icon instead of the new one. The details of the format can be found in the Control Program Guide in the toolkit information.

André Heldoorn

  • Hero Member
  • *****
  • Thank You
  • -Given: 117
  • -Receive: 19
  • Posts: 776
    • View Profile
Re: Color labels
« Reply #3 on: October 14, 2019, 05:03:15 am »
You can set a file's icon with the SysSetIcon function in the RexxUtil library.

He should be able to do that with OO.EXE, which may avoid or postpone a REXX.DLL crash. Setup string "ICONFILE=C:\FOO\BAR.ICO". A disadvantage can be that the original icon may be unknown. He wants to "mark" an existing icon, so this will only work if the existing icon is known and BAR.ICO is its marked version.

For example, you can assign the file type ScanMe to all files in a folder, and associate those ScanMe files with a VIR-SCAN.CMD file (and its matching VIR-SCAN.ICO file). Let VIR-SCAN.CMD scan the files and change the file's type from ScanMe to MarkAsScanned (or delete the file type EA, to restore an original icon). Untested and FWIW.
« Last Edit: October 14, 2019, 05:10:03 am by André Heldoorn »

André Heldoorn

  • Hero Member
  • *****
  • Thank You
  • -Given: 117
  • -Receive: 19
  • Posts: 776
    • View Profile
Re: Color labels
« Reply #4 on: October 14, 2019, 06:58:32 am »
An untested and modified existing sample of a part of the .type EA route, FWIW, with one added line:

Code: [Select]
/* REXX SetType.cmd */
/* only used during installation */
call RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'
call 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

Associate the type with a single executable-file-with-an-own-icon, e.g. a SUDOKU.EXE.

Next associate the type with data files, like unsolved puzzles.

Finally create a SOLVED.CMD file with a SOLVED.ICO file, which changes the type of a data file from "Sudoku" to "SolvedPuzzle", with an icon which looks like a marked icon of SUDOKU.EXE.