AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

add delimeter when string not found

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
birchy1978



Joined: 16 Jul 2008
Posts: 18

PostPosted: Thu Jul 31, 2008 2:45 pm    Post subject: add delimeter when string not found Reply with quote

I have a script that extracts text from files in a folder based on key words found in the files. I'm trying to keep the output file aligned with each files text placed on a new line and the data separated by a delimeter. my problem is some files don't contain all of the key words. is it possible to add a delimeter when the key word is not found?



Code:
FileSelectFolder, OutputVar, , 3
if OutputVar =
    MsgBox, You didn't select a folder.
else
SetWorkingDir, %OutputVar%


Loop, %OutputVar%\*.txt ; loop through .txt files in the folder

Loop, read, %A_LoopFileLongPath%, C:\Users\chrisb\Desktop\SigmaExtracted_Data.txt
{

StringCaseSense, On

    IfInString, A_LoopReadLine, Date Updated:, FileAppend, %A_LoopReadLine% `|

    IfInString, A_LoopReadLine, Product Name, FileAppend, %A_LoopReadLine% `|

    IfInString, A_LoopReadLine, Hazardous, FileAppend, %A_LoopReadLine% `|

    IfInString, A_LoopReadLine, DISCLAIMER, FileAppend, %A_LoopReadLine% `n

}


file output
Date Updated: 08/NOV/2006 Hazardous|Product Name 1-BROMO-2-ETHYLBENZENE|DISCLAIMER
Date Updated: 27/DEC/2007 |Hazardous|Product Name AMMONIA SOLUTION|DISCLAIMER
Date Updated: 10/AUG/2007 |Hazardous|Product Name 2,6-DIMETHYL-2,4,6-OCTATRIENE|DISCLAIMER
Date Updated: 12/FEB/2006 |Hazardous|Product Name ALLYL BUTYL ETHER|DISCLAIMER
Date Updated: 11/FEB/2006 |Hazardous|Product Name 2-AMINO-3-HYDROXYPYRIDINE|DISCLAIMER
Date Updated: 05/MAY/2006 |Product Name BENZIMIDAZOLE| DISCLAIMER

I tried adding the following with no luck


Code:

else
 IfNotInString, A_LoopReadLine, Classified as Hazardous, FileAppend, None `|


I have been working on this for a while so any help would be appreciated
Back to top
View user's profile Send private message
scottmattes



Joined: 21 May 2007
Posts: 98
Location: USA

PostPosted: Thu Jul 31, 2008 3:38 pm    Post subject: Reply with quote

from the ifinstring help entry

Quote:

Example
Haystack = abcdefghijklmnopqrs
Needle = abc
IfInString, Haystack, %Needle%
{
MsgBox, The string was found.
return
}
else
Sleep, 1

_________________
-------------
Scott Mattes

My small, but growing, collection of scripts.
Back to top
View user's profile Send private message Visit poster's website
BoBoČ
Guest





PostPosted: Thu Jul 31, 2008 3:58 pm    Post subject: Reply with quote

Code:
Loop, Read, Input.txt, Output.txt
{
   StringReplace, Line, A_LoopReadLine, |, |, UseErrorLevel ; get # of delimiters
   If (ErrorLevel < 3) {
      StringReplace, Line, Line, |, ||
      FileAppend, % Line
     }
   }
Not tested.
Back to top
birchy1978



Joined: 16 Jul 2008
Posts: 18

PostPosted: Fri Aug 01, 2008 2:12 am    Post subject: Reply with quote

Sorry guys i should have included the text file i am processing.
Below is a snippet of the text in one of the files i have the lines i need to grab in bold
Some files have all the imformation others have some of the imformation i require, I'm trying to keep the results in columns.
Code:

Date Printed: 22/JUN/2008
Date Updated: 08/NOV/2006
Version 1.7
Regulation (EC) No 1907/2006
Classified as Hazardous
1 - Product and Company Information
Product Name 1-BROMO-2-ETHYLBENZENE
Product Number 03125
Formula C8H9BrMolecular Weight 185.07 AMU
Appearance Physical State: Liquid
Color: Colorless
Form: Clear liquid
Property Value At Temperature or Pressure
pH N/A
BP/BP Range 74.0 - 76.0 °C 11 mmHg
MP/MP Range N/A
Flash Point 77 °C Method: closed cup
Flammability N/A
Autoignition Temp N/A
Oxidizing Properties N/A
Explosive Properties N/A
Explosion Limits N/A
Vapor Pressure N/A
SG/Density 1.358 g/cm3
Partition Coefficient Log Kow: 3.783
Viscosity N/A
Vapor Density N/A
Saturated Vapor Conc. N/A
Evaporation Rate N/A
Bulk Density N/A
Decomposition Temp. N/A
Solvent Content N/A
Water Content N/A
Surface Tension N/A
Conductivity N/A
Miscellaneous Data N/A
Solubility N/A
10 - Stability and Reactivity
STABILITY
Stable: Stable.
Materials to Avoid: Strong oxidizing agents.
HAZARDOUS DECOMPOSITION PRODUCTS
Hazardous Decomposition Products: Carbon monoxide, Carbon dioxide,
Hydrogen bromide gas.
HAZARDOUS POLYMERIZATION
Hazardous Polymerization: Will not occur


[Moderator's Note: changed bold to red to allow use of code tags]
Back to top
View user's profile Send private message
BoBoČ
Guest





PostPosted: Fri Aug 01, 2008 12:14 pm    Post subject: Reply with quote

Code:
LinesToGet = 2,5,7,8,9,11,14,18,22,26,32,37
Loop, Read, MyFile.txt, MyNewFile.txt
{
  If A_Index not in %LinesToGet%
    Continue
  Else {
    If InStr(A_LoopReadLine,"N/A")
      FileAppend, % "|"
    Else
      FileAppend, % A_LoopReadLine "|"
    }
  }
SoundBeep
Run, MyNewFile.txt
Tested. Anyway, high risk to be useless. Be aware. Cool And yes, any geek can code it more complex. I can't. Sad
Back to top
birchy1978



Joined: 16 Jul 2008
Posts: 18

PostPosted: Fri Aug 01, 2008 3:59 pm    Post subject: Reply with quote

Thanks BoBoČ the problem is the files are never the same and contain vaious feilds.
If i could add a delimiter when the text is not found it would work.

Code:
FileSelectFolder, OutputVar, , 3
if OutputVar =
    MsgBox, You didn't select a folder.
else
SetWorkingDir, %OutputVar%

Loop, %OutputVar%\*.txt ; loop through .txt files in the folder
Loop, read, %A_LoopFileLongPath%, C:\Output.txt
{
    If InStr(A_LoopReadLine, "Classified as Hazardous")
   FileAppend, %A_LoopReadLine%`|
else
here i want to Add one delimiter to the output file not one for every line that doesn't contain "Classified as Hazardous"

}
Back to top
View user's profile Send private message
BoBoČ
Guest





PostPosted: Fri Aug 01, 2008 4:15 pm    Post subject: Reply with quote

Would you mind to explain it again (I'm a Germ[an], so bare with me).
The input file you provided is a file (of several) which always contains a static number of lines? yes/no
You always have to get the (values of the) 'red' lines? yes/no
If one of the values isn't given ("N/A") the resulting 'field' should be empty? yes/no
The output format should contain a static number of fields? yes/no

Is it something like this "if number of delimiters is < n add a delimiter at pos n"

*BoBo is getting completely lost*

Last attempt to feed the BoBo-Noob. You'll provide a 'before' and 'after'-file. Go for it ...
Back to top
birchy1978



Joined: 16 Jul 2008
Posts: 18

PostPosted: Sat Aug 02, 2008 2:49 am    Post subject: Reply with quote

Thanks for your patience Bobo

The input file you provided is a file (of several) which never contains a static number of lines
I have to retrieve the lines that contain these strings

Product Name
Product Number
Classified as Hazardous
Date Updated
etc

If one of the strings isn't found ("Classified as Hazardous") the resulting 'field' should be Not Found
The output format should contain a static number of fields
The output file should look like this

File 1|Product Name 1-BROMO-2-ETHYLBENZENE|Product Number 03125|Classified as Hazardous according to the criteria of EU Annex 1 and|Date Updated: 08/NOV/2006
File 2|Product Name BENZIMIDAZOLE|Product Number 12250|Not found|Date Updated: 05/MAY/2006

Code:
File 1
Material Safety Data Sheet
Date Printed: 22/JUN/2008
Date Updated: 08/NOV/2006
Version 1.7
Regulation (EC) No 1907/2006
Classified as Hazardous according to the criteria of EU Annex 1 and
NOHSC.
1 - Product and Company Information
Product Name 1-BROMO-2-ETHYLBENZENE
Product Number 03125
Company Sigma-Aldrich Pty. Ltd.
12 Anella Avenue
Castle Hill NSW 2154
Australia
Technical Phone # +61 2 9841 0555 (1800 800 097)
Fax +61 2 9841 0500 (1800 800 096)
E-mail Address ausmail@sial.com
Emergency Phone # +44 8701906777 (1800 448 465)
2 - Hazards Identification
SPECIAL INDICATION OF HAZARDS TO HUMANS AND THE ENVIRONMENT
Irritating to eyes, respiratory system and skin. Toxic to aquatic
organisms, may cause long-term adverse effects in the aquatic
environment.
3 - Composition/Information on Ingredients
Product Name CAS # EC no Annex I
Index Number
1-BROMO-2-ETHYLBENZENE 1973-22-4 217-823-8 None
Formula C8H9Br
Molecular Weight 185.07 AMU
4 - First Aid Measures
AFTER INHALATION
If inhaled, remove to fresh air. If not breathing give
artificial respiration. If breathing is difficult, give oxygen.
AFTER SKIN CONTACT
In case of contact, immediately wash skin with soap and copious
amounts of water.
AFTER EYE CONTACT
In case of contact, immediately flush eyes with copious amounts
of water for at least 15 minutes.
AFTER INGESTION
If swallowed, wash out mouth with water provided person is
conscious. Call a physician.
5 - Fire Fighting Measures
EXTINGUISHING MEDIA
Suitable: For small (incipient) fires, use media such as
"alcohol" foam, dry chemical, or carbon dioxide. For large
fires, apply water from as far as possible. Use very large
quantities (flooding) of water applied as a mist or spray; solid
streams of water may be ineffective. Cool all affected
containers with flooding quantities of water.
SPECIAL RISKS
Specific Hazard(s): Combustible liquid. Emits toxic fumes under
fire conditions.
SPECIAL PROTECTIVE EQUIPMENT FOR FIREFIGHTERS
Wear self-contained breathing apparatus and protective clothing
to prevent contact with skin and eyes.
6 - Accidental Release Measures
PERSONAL PRECAUTION PROCEDURES TO BE FOLLOWED IN CASE OF LEAK OR SPILL
Evacuate area.
PROCEDURE(S) OF PERSONAL PRECAUTION(S)
Wear respirator, chemical safety goggles, rubber boots, and
heavy rubber gloves.
METHODS FOR CLEANING UP
Cover with dry-lime, sand, or soda ash. Place in covered
containers using non-sparking tools and transport outdoors.
Ventilate area and wash spill site after material pickup is
complete.
7 - Handling and Storage
HANDLING
Directions for Safe Handling: Avoid breathing vapor. Avoid
contact with eyes, skin, and clothing. Avoid prolonged or
repeated exposure.
STORAGE
Conditions of Storage: Keep tightly closed. Keep away from heat
and open flame.
8 - Exposure Controls / Personal Protection
ENGINEERING CONTROLS
Safety shower and eye bath. Mechanical exhaust required.
GENERAL HYGIENE MEASURES
Wash contaminated clothing before reuse. Wash thoroughly after
handling.
PERSONAL PROTECTIVE EQUIPMENT
Respiratory Protection: Use respirators and components tested and
approved under appropriate government standards such as NIOSH (US)
or CEN (EU). Where risk assessment shows air-purifying respirators
are appropriate use a full-face respirator with multi-purpose
combination (US) or type ABEK (EN 14387) respirator cartridges as
a backup to engineering controls. If the respirator is the sole
means of protection, use a full-face supplied air respirator.
Hand Protection: Compatible chemical-resistant gloves.
Eye Protection: Chemical safety goggles.
FLUKA - 03125 www.sigma-aldrich.com Page 2
9 - Physical and Chemical Properties
Appearance Physical State: Liquid
Color: Colorless
Form: Clear liquid
Property Value At Temperature or Pressure
pH N/A
BP/BP Range 74.0 - 76.0 °C 11 mmHg
MP/MP Range N/A
Flash Point 77 °C Method: closed cup
Flammability N/A
Autoignition Temp N/A
Oxidizing Properties N/A
Explosive Properties N/A
Explosion Limits N/A
Vapor Pressure N/A
SG/Density 1.358 g/cm3
Partition Coefficient Log Kow: 3.783
Viscosity N/A
Vapor Density N/A
Saturated Vapor Conc. N/A
Evaporation Rate N/A
Bulk Density N/A
Decomposition Temp. N/A
Solvent Content N/A
Water Content N/A
Surface Tension N/A
Conductivity N/A
Miscellaneous Data N/A
Solubility N/A
10 - Stability and Reactivity
STABILITY
Stable: Stable.
Materials to Avoid: Strong oxidizing agents.
HAZARDOUS DECOMPOSITION PRODUCTS
Hazardous Decomposition Products: Carbon monoxide, Carbon dioxide,
Hydrogen bromide gas.
HAZARDOUS POLYMERIZATION
Hazardous Polymerization: Will not occur
11 - Toxicological Information
SIGNS AND SYMPTOMS OF EXPOSURE
To the best of our knowledge, the chemical, physical, and
toxicological properties have not been thoroughly investigated.
ROUTE OF EXPOSURE
Skin Contact: Causes skin irritation.
Skin Absorption: May be harmful if absorbed through the skin.
Eye Contact: Causes eye irritation.
Inhalation: Material is irritating to mucous membranes and upper
respiratory tract. May be harmful if inhaled.
Ingestion: May be harmful if swallowed.
12 - Ecological Information
FLUKA - 03125 www.sigma-aldrich.com Page 3
No data available.
13 - Disposal Considerations
SUBSTANCE DISPOSAL
Contact a licensed professional waste disposal service to dispose
of this material. This combustible material may be burned in a
chemical incinerator equipped with an afterburner and scrubber.
Observe all federal, state, and local environmental regulations.
14 - Transport Information
RID/ADR
UN#: 3082
Class: 9
PG: III
Proper Shipping Name: Environmentally hazardous
substance, liquid, n.o.s.
IMDG
UN#: 3082
Class: 9
PG: III
Proper Shipping Name: Environmentally hazardous
substance, liquid, n.o.s.
Marine Pollutant: No
Severe Marine Pollutant: No
Technical Name: Required
IATA
UN#: 3082
Class: 9
PG: III
Proper Shipping Name: Environmentally hazardous
substance, liquid, n.o.s.
Inhalation Packing Group I: No
Technical Name: Required
15 - Regulatory Information
CLASSIFICATION AND LABELING ACCORDING TO EU DIRECTIVES
INDICATION OF DANGER: Xi-N
Irritant. Dangerous for the environment.
R-PHRASES: 36/37/38-51/53
Irritating to eyes, respiratory system and skin. Toxic to
aquatic organisms, may cause long-term adverse effects in the
aquatic environment.
S-PHRASES: 26-61
In case of contact with eyes, rinse immediately with plenty of
water and seek medical advice. Avoid release to the
environment. Refer to special instructions/safety data sheets.
COUNTRY SPECIFIC INFORMATION
Germany
WGK: 3
Self-Classification
16 - Other Information
WARRANTY
FLUKA - 03125 www.sigma-aldrich.com Page 4
The above information is believed to be correct but does not
purport to be all inclusive and shall be used only as a guide. The
information in this document is based on the present state of our
knowledge and is applicable to the product with regard to
appropriate safety precautions. It does not represent any
guarantee of the properties of the product. Sigma-Aldrich Inc.,
shall not be held liable for any damage resulting from handling or
from contact with the above product. See reverse side of invoice
or packing slip for additional terms and conditions of sale.
Copyright 2008 Sigma-Aldrich Co. License granted to make unlimited
paper copies for internal use only.
DISCLAIMER
For R&D use only. Not for drug, household or other uses.
FLUKA - 03125 www.sigma-aldrich.com Page 5


Code:
File 2
Material Safety Data Sheet
Date Printed: 19/JUN/2008
Date Updated: 05/MAY/2006
Version 1.4
Regulation (EC) No 1907/2006
1 - Product and Company Information
Product Name BENZIMIDAZOLE
Product Number 12250
Company Sigma-Aldrich Pty. Ltd.
12 Anella Avenue
Castle Hill NSW 2154
Australia
Technical Phone # +61 2 9841 0555 (1800 800 097)
Fax +61 2 9841 0500 (1800 800 096)
E-mail Address ausmail@sial.com
Emergency Phone # +44 8701906777 (1800 448 465)
2 - Hazards Identification
SPECIAL INDICATION OF HAZARDS TO HUMANS AND THE ENVIRONMENT
Not hazardous according to Directive 67/548/EEC.
3 - Composition/Information on Ingredients
Product Name CAS # EC no Annex I
Index Number
BENZIMIDAZOLE 51-17-2 200-081-4 None
Formula C7H6N2
Molecular Weight 118.14 AMU
Synonyms 3-Azaindole * Azindole * Benziminazole *
1H-Benzimidazole (9CI) * o-Benzimidazole *
1,3-Benzodiazole * Benzoglyoxaline *
Benzoimidazole * BZI * 1,3-Diazaindene *
N,N'-Methenyl-o-phenylenediamine * NSC 759
4 - First Aid Measures
AFTER INHALATION
If inhaled, remove to fresh air. If not breathing give
artificial respiration. If breathing is difficult, give oxygen.
AFTER SKIN CONTACT
In case of contact, immediately wash skin with soap and copious
amounts of water.
AFTER EYE CONTACT
In case of contact, immediately flush eyes with copious amounts
of water for at least 15 minutes.
AFTER INGESTION
If swallowed, wash out mouth with water provided person is
conscious. Call a physician.
5 - Fire Fighting Measures
EXTINGUISHING MEDIA
Suitable: Water spray. Carbon dioxide, dry chemical powder, or
appropriate foam.
SPECIAL RISKS
Specific Hazard(s): Emits toxic fumes under fire conditions.
SPECIAL PROTECTIVE EQUIPMENT FOR FIREFIGHTERS
Wear self-contained breathing apparatus and protective clothing
to prevent contact with skin and eyes.
6 - Accidental Release Measures
PROCEDURE(S) OF PERSONAL PRECAUTION(S)
Wear respirator, chemical safety goggles, rubber boots, and
heavy rubber gloves.
METHODS FOR CLEANING UP
Sweep up, place in a bag and hold for waste disposal. Avoid
raising dust. Ventilate area and wash spill site after material
pickup is complete.
7 - Handling and Storage
HANDLING
Directions for Safe Handling: Avoid contact and inhalation. Do
not get in eyes, on skin, on clothing.
STORAGE
Conditions of Storage: Keep tightly closed. Store in a cool dry
place.
8 - Exposure Controls / Personal Protection
ENGINEERING CONTROLS
Safety shower and eye bath. Mechanical exhaust required.
GENERAL HYGIENE MEASURES
Wash thoroughly after handling. Wash contaminated clothing before
reuse.
PERSONAL PROTECTIVE EQUIPMENT
Respiratory Protection: Use respirators and components tested and
approved under appropriate government standards such as NIOSH (US)
or CEN (EU). Where risk assessment shows air-purifying respirators
are appropriate use a dust mask type N95 (US) or type P1 (EN 143)
respirator.
Hand Protection: Rubber gloves.
Eye Protection: Chemical safety goggles.
9 - Physical and Chemical Properties
Appearance Color: Light brown
Form: Fine crystals
Property Value At Temperature or Pressure
pH N/A
BP/BP Range 360 °C
MP/MP Range 171 °C
FLUKA - 12250 www.sigma-aldrich.com Page 2
Flash Point N/A
Flammability N/A
Autoignition Temp N/A
Oxidizing Properties N/A
Explosive Properties N/A
Explosion Limits N/A
Vapor Pressure N/A
SG/Density N/A
Partition Coefficient N/A
Viscosity N/A
Vapor Density N/A
Saturated Vapor Conc. N/A
Evaporation Rate N/A
Bulk Density N/A
Decomposition Temp. N/A
Solvent Content N/A
Water Content N/A
Surface Tension N/A
Conductivity N/A
Miscellaneous Data N/A
Solubility N/A
10 - Stability and Reactivity
STABILITY
Materials to Avoid: Strong oxidizing agents.
HAZARDOUS DECOMPOSITION PRODUCTS
Hazardous Decomposition Products: Carbon monoxide, Carbon dioxide,
Nitrogen oxides.
HAZARDOUS POLYMERIZATION
Hazardous Polymerization: Will not occur
11 - Toxicological Information
RTECS NUMBER: DD5425000
ACUTE TOXICITY
LD50
Intraperitoneal
Rat
385 MG/KG
Remarks: Peripheral Nerve and Sensation:Flaccid paralysis
without anesthesia (usually neuromuscular blockage).
LD50
Oral
Mouse
2910 mg/kg
Remarks: Lungs, Thorax, or Respiration:Other changes.
LD50
Intraperitoneal
Mouse
445 MG/KG
LD50
Intravenous
Mouse
280 MG/KG
FLUKA - 12250 www.sigma-aldrich.com Page 3
SIGNS AND SYMPTOMS OF EXPOSURE
To the best of our knowledge, the chemical, physical, and
toxicological properties have not been thoroughly investigated.
ROUTE OF EXPOSURE
Skin Contact: May cause skin irritation.
Skin Absorption: May be harmful if absorbed through the skin.
Eye Contact: May cause eye irritation.
Inhalation: Material may be irritating to mucous membranes and
upper respiratory tract. May be harmful if inhaled.
Ingestion: May be harmful if swallowed.
12 - Ecological Information
No data available.
13 - Disposal Considerations
SUBSTANCE DISPOSAL
Contact a licensed professional waste disposal service to dispose
of this material. Dissolve or mix the material with a combustible
solvent and burn in a chemical incinerator equipped with an
afterburner and scrubber. Observe all federal, state, and local
environmental regulations.
14 - Transport Information
RID/ADR
Non-hazardous for road transport.
IMDG
Non-hazardous for sea transport.
IATA
Non-hazardous for air transport.
15 - Regulatory Information
Not hazardous according to Directive 67/548/EEC.
COUNTRY SPECIFIC INFORMATION
Germany
WGK: 3
Self-Classification
16 - Other Information
WARRANTY
The above information is believed to be correct but does not
purport to be all inclusive and shall be used only as a guide. The
information in this document is based on the present state of our
knowledge and is applicable to the product with regard to
appropriate safety precautions. It does not represent any
guarantee of the properties of the product. Sigma-Aldrich Inc.,
shall not be held liable for any damage resulting from handling or
from contact with the above product. See reverse side of invoice
or packing slip for additional terms and conditions of sale.
Copyright 2008 Sigma-Aldrich Co. License granted to make unlimited
paper copies for internal use only.
FLUKA - 12250 www.sigma-aldrich.com Page 4
DISCLAIMER
For R&D use only. Not for drug, household or other uses.
FLUKA - 12250 www.sigma-aldrich.com Page 5
Back to top
View user's profile Send private message
BoBoČ
Guest





PostPosted: Sat Aug 02, 2008 1:40 pm    Post subject: Reply with quote

Code:
Loop, %A_ScriptDir%\My*.txt
{
  Field1 = Not found
  Field2 = Not found
  Field3 = Not found
  Field4 = Not found
  FileRead, Content, %A_LoopFileLongPath%
  StringSplit, CArray, Content, `r`n
  Loop, %CArray0%
  {
    If InStr(CArray%A_Index%,"Product Name")
      Field1 := CArray%A_Index%
    If InStr(CArray%A_Index%,"Product Number")
      Field2 := CArray%A_Index%
    If InStr(CArray%A_Index%,"Classified as Hazardous")
      Field3 := CArray%A_Index%
    If InStr(CArray%A_Index%,"Date Updated")
      Field4 := CArray%A_Index%
    }
  FileAppend, %A_LoopFileName%|%Field1%|%Field2%|%Field3%|%Field4%`n, My.csv
  }
Run Notepad My.csv
Tested successfully. Nevertheless, I expect within 1h someone will show up with a rocket science code to do this. Stay tuned. Very Happy
Back to top
birchy1978



Joined: 16 Jul 2008
Posts: 18

PostPosted: Sun Aug 03, 2008 7:35 am    Post subject: Reply with quote

Thanks Bobo it works great your the best.

The problem i have now is it doesn't retrieve duplicate strings for example if i search for "Product Name" I should get 2 results
at the moment i only get 1?

Product Name 1-BROMO-2-ETHYLBENZENE
Product Name CAS # EC no Annex I



Quote:
File 1
Material Safety Data Sheet
Date Printed: 22/JUN/2008
Date Updated: 08/NOV/2006
Version 1.7
Regulation (EC) No 1907/2006
Classified as Hazardous according to the criteria of EU Annex 1 and
NOHSC.
1 - Product and Company Information
Product Name 1-BROMO-2-ETHYLBENZENE
Product Number 03125
Company Sigma-Aldrich Pty. Ltd.
12 Anella Avenue
Castle Hill NSW 2154
Australia
Technical Phone # +61 2 9841 0555 (1800 800 097)
Fax +61 2 9841 0500 (1800 800 096)
E-mail Address ausmail@sial.com
Emergency Phone # +44 8701906777 (1800 448 465)
2 - Hazards Identification
SPECIAL INDICATION OF HAZARDS TO HUMANS AND THE ENVIRONMENT
Irritating to eyes, respiratory system and skin. Toxic to aquatic
organisms, may cause long-term adverse effects in the aquatic
environment.
3 - Composition/Information on Ingredients
Product Name CAS # EC no Annex I
Index Number
Back to top
View user's profile Send private message
BoBoČ
Guest





PostPosted: Sun Aug 03, 2008 10:02 am    Post subject: Reply with quote

Shocked . Well, it would make sense to know every case (pattern) you've to care about in advance! It makes no sense to create some code to handle a specific scenario, just to realize that you've to slightly/completely change the design of your code because the scenario changed. That's extra work. Only vampires are happy about that (because they live forever, and aren't afraid to waste their lifetime).
Are you a vampire? So, no?! OK, lets work smart - not hard! Wink

Currently Field1 will contain the latest found match.
Code:
Field1 := CArray%A_Index%

That will create a matchlist which contains all found matches in Field1
Code:
Field1 .= CArray%A_Index% "|"
... so you've to split that variable/matchlist afterwards ...

Good luck. Cool
Back to top
birchy1978



Joined: 16 Jul 2008
Posts: 18

PostPosted: Sun Aug 03, 2008 12:42 pm    Post subject: Reply with quote

Sorry About that Bobo thanks for all your help Smile
Your response made a lot of sense thanks again.
Back to top
View user's profile Send private message
BoBoČ
Guest





PostPosted: Mon Aug 04, 2008 7:18 am    Post subject: Reply with quote

@ birchy1978
what's the status? You solved it??
Back to top
birchy1978



Joined: 16 Jul 2008
Posts: 18

PostPosted: Tue Aug 05, 2008 5:31 am    Post subject: Reply with quote

Solved Thanks
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group