Skip to content

Latest commit

 

History

History
150 lines (103 loc) · 8 KB

README.md

File metadata and controls

150 lines (103 loc) · 8 KB

Create-GHS-Phrases

A small script for automatically inserting Hazard-, Precautionary- and EUH-phrases according from file.

How to use this

  1. Write down all Phrase-Keys (H202,P304,etc) of a chemical below each other. Combinations are connected by +:
Stannous Octaoate:
H317
H318
H361
H412
P273
P280
P305+P351+P338
  1. Then, highlight all the phrase-keys you want to translate, and press Alt + 0 (on the number row, not on the numpad). Alternatively, press Numpad0

Stannous Octaoate:

H317: May cause an allergic skin reaction.
H318: Causes serious eye damage.
H361: Suspected of damaging fertility or the unborn child <state specific effect if known> <state route of exposure if it is conclusively proven that no other routes of exposure cause the hazard>.
H412: Harmful to aquatic life with long lasting effects.
P273: Avoid release to the environment.
P280: Wear protective gloves/protective clothing/eye protection/face protection.
P305+P351+P338: IF IN EYES: Rinse cautiously with water for several minutes. Remove contact lenses, if present and easy to do. Continue rinsing.


ERROR LOG (REMOVE AFTERWARDS)
-----------------
-----------------

The error-log gives information on phrases whose Key (that is the H317, for instance could not be found in the library file). See Errors.

Errors

Using the following input

Stannous Octaoate
H317
H318
H361
H412
P2732
P280
P305+P3511+P338

will create an error:

Stannous Octaoate

H317: May cause an allergic skin reaction.
H318: Causes serious eye damage.
H361: Suspected of damaging fertility or the unborn child <state specific effect if known> <state route of exposure if it is conclusively proven that no other routes of exposure cause the hazard>.
H412: Harmful to aquatic life with long lasting effects.
	P2732: P2732 
P280: Wear protective gloves/protective clothing/eye protection/face protection.
	P305+P3511+P338: IF IN EYES: P3511 Remove contact lenses, if present and easy to do. Continue rinsing. 


ERROR LOG (REMOVE AFTERWARDS)
-----------------
Error 1: Key 'P2732' could not be found on file. Please search and insert manually. Specific phrase missing: P2732
Error 2: Key 'P305+P3511+P338' could not be found on file. Please search and insert manually. Specific phrase missing: P3511
-----------------

On the one hand, the error log will display all errors found in the file, and point you to whatever key is specifically missing. Lines with missing keys will be indented. The missing key will be displayed as Key: Key, e.g P3511: P3511, or inserted at the respective position if it is a multi-phrase statement, e.g. P305+P3511+P338:

P305+P3511+P338: IF IN EYES: P3511 Remove contact lenses, if present and easy to do. Continue rinsing. 

Known limitations and bugs

  1. The following two keys have slightly differemt wording:
H360FD=May damage fertility. May damage the unborn child.
H360Fd=May damage fertility. Suspected of damaging the unborn child.

However, because the programm cannot distinguish between lowercase and uppercase letters in the key, both keys result in May damage fertility. Suspected of damaging the unborn child.. As both phrases are extremely similar, I am currently not focussing to fix this. I have some approaches to do it, but no time as of right now.


Requirements

Requires the GHS phrases in specific format. The file can be retrieved either from this directory, or it is automatically downloaded if missing from this gist. The phrases were retrieved from https://ec.europa.eu/taxation_customs/dds2/SAMANCTA/EN/Safety/HP_EN.htm on 02.12.2021. I do not take responsibility for keeping the gist up-to-date. Neither does the script check for changes. The file can be redownloaded by deleting the ini-file located at A_ScriptDir\INI-Files\CreateGHSPhrases.ini, where A_ScriptDir is the location of the Script/Executable.

Also requires the scriptObj-File. Original by RaptorX, modified version used in this project by myself. Should be located at the default library location for autohotkey, that being %A_MyDocuments%\AutoHotkey\Lib\. For more info, see the documentation on #include. Note that this is only required when using the non-compiled .ahk-version, and is not required when using the .exe-executable

Executing the program.

Be mindful to keep the folderstructure of the script and the settings-file.

If you have Autohotkey installed

Just launch the script file the same way you launch any other. Then use the hotkey outlined at the beginning.

If you don't have Autohotkey installed

Launch the executable. Then use the hotkey outlined at the beginning.

A small note about languages and regions of validity.

The library-file stored at the address mentioned above, as well as the version contained in the code for the case the hosted gist isn't available only contain the english GHS phrases for the EU. I do not claim them to be complete, or valid for other regions. For the EU, I could not find a more comprehensive collection elsewhere at the time of writing this. If you live elsewhere, please check if the phrases apply in the same way to your location. If you want a translated version, replace the phrases in the settings-file (basically everything behind the "="-sign) with your equivalent. Note that if the file is restored, you'll have to redo it again.

If you are editing this intending to use this program with phrases in a different language, please note that the section titles in the settings file must remain the same. That includes only:

  • H-Phrases
  • P-Phrases
  • Physical Properties
  • Environmental Properties
  • Supplemental label elements/information on certain substances and mixtures

In principle, these sections are superfluous when it comes to finding a phrase. You could just as easily have only one section called "P-Phrases" and easily push all phrases in there, regardless of wether or not they are actually P-Phrases. That is solely to make it easier for the user. HOWEVER... it is not possible to create a new section and have it read as well - at least not without some additions to the script.

Therefore, when translating the phrases please do not change any section title, those being "[H-Phrases]","[P-Phrases]" etc in the library file. You can change, remove or add any key-value line to any of these sections, by simply writing in the following way into the library file: YourKeyHere=YourPhraseHere, e.g.

When using this script then, the phrase "YourKeyHere" will then be changed to "YourKeyHere=YourPhraseHere", the same way it is outlined in the documentation.

Example: H229=Pressurised container: May burst if heated.This Is a technically valid key...=...and this is a technically valid phrase.

In the above example, the result of executing Alt+0 on the following line of selected text

This Is a technically valid key...

will result in the following line:

This Is a technically valid key......and this is a technically valid phrase.

Code by others

All code below is already included into the script as of 13.12.2021.

  • fClip.ahk, original by berban, used version by me.
  • scriptObj.ahk, original by RaptorX, used version heavily modified by me.
  • f_TrayIconSingleClickCallBack, adopted from Lexikos
  • HasVal, original from jNizM
  • wolf_II's ReadINI-function
  • fIsConnected, retrieved from lxiko's "AHKRare", a collection of useful snippet functions.