/* Personal Paint Amiga Rexx script - Copyright © 1999 dominique@hotbot.com */ /* $VER: ColorToHTML.pprx 1.0 (22 Sep 1999) */ /** ENG This script converts the current foreground color to a HTML color and then you can copy this hex value to the clipboard. */ IF ARG(1, EXISTS) THEN PARSE ARG PPPORT ELSE PPPORT = 'PPAINT' IF ~SHOW('P', PPPORT) THEN DO IF EXISTS('PPaint:PPaint') THEN DO ADDRESS COMMAND 'Run >NIL: PPaint:PPaint' DO 30 WHILE ~SHOW('P',PPPORT) ADDRESS COMMAND 'Wait >NIL: 1 SEC' END END ELSE DO SAY "Personal Paint could not be loaded." EXIT 10 END END IF ~SHOW('P', PPPORT) THEN DO SAY 'Personal Paint Rexx port could not be opened' EXIT 10 END ADDRESS VALUE PPPORT OPTIONS RESULTS OPTIONS FAILAT 10000 Version 'REXX' IF RESULT < 7 THEN DO RequestNotify 'PROMPT "This script requires Personal Paint 7"' EXIT 10 END LockGUI GetPen 'FOREGROUND' pen = RESULT GetColors 'FROM' pen 'TO' pen 'RGB' PARSE VAR RESULT r g b . hex = '#' || C2X(D2C(r)) || C2X(D2C(g)) || C2X(D2C(b)) Request '"Color To HTML" ' ||, '"TEXT = ""The Hex value is ' || hex || '""', 'ACTION = ""_Copy"" ACTION = ""_Ok"""' IF RC = 0 THEN DO IF RESULT = 1 THEN DO IF ~SHOW("L", "rmh.library") THEN DO IF ~ADDLIB("rmh.library", 0, -30) THEN DO RequestNotify 'PROMPT "Can''t copy to the clipboard."' UnlockGUI EXIT 10 END END CALL WriteTextClip(hex, 0) END END UnlockGUI