Jump to content

How to record a specific value in a text


Recommended Posts

@AutoBert Your exemple is imba :) I am working on it actualy. Thanks for that. Before trying to play with all these functions and variables. Can you help me on what could replace 

Global $sData = FileRead('Dossier.txt')

By somthing that can read all the text in my webpage ? Becose i think there is nothing to do that. 

If i scan my webpage with AU3info 

>>>> Control <<<<
Class:    Chrome_RenderWidgetHostHWND
Instance:    1
ClassnameNN:    Chrome_RenderWidgetHostHWND1
Name:    
Advanced (Class):    [CLASS:Chrome_RenderWidgetHostHWND; INSTANCE:1]
ID:    160547768
Text:    Chrome Legacy Window

Anywhere i click to scan my field i ll got the same results 

 

=====================================================================================

Also i whould like to know : 

If i do 

Global $aData3 = _StringBetween($aSplit[0], '[ANAH][88][', ']')

If the value 88 changing i wont be able to get again the value needed. in our Exemple : [Demandeur]

How to ask to AutoIT to give me the [Demandeur] Value anyway with what is the number between [88] 

Hope i am clear enouth :/ 

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

46 minutes ago, caramen said:

Can you help me on what could replace 


Global $sData = FileRead('Dossier.txt')

By somthing that can read all the text in my webpage ?

No:

  • as you mentioned, it isn't public:
On 31.7.2018 at 11:13 AM, caramen said:

no i am sorry it s à ticket on our ticketing software that is unreachable from internet.

 

  • and chrome isn't my browser
Link to comment
Share on other sites

@AutoBert or @FrancescoDiMuro

Ok then an other question: 

With this line : 

********** vous envoie ce message :

How to get only the stars? 

Becose i tryed that :

Global $aData4 = _StringBetween($aSplit[0], ' ', 'vous envoie')

and that : 

Global $aData4 = _StringBetween($aSplit[0], '', 'vous envoie')

But the return value is empty :'( 

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

37 minutes ago, mikell said:

Either there's a bug in your script, or you forgot that _StringBetween returns an array

#include <String.au3>
Msgbox(0,"", _StringBetween("********** vous envoie ce message : ", '', ' vous envoie')[0] )

 

Yeah it was on purpose. Becose i am keeping the exemple structure. But that work well :P Thanks you man. If you can give me some explanations ... To make me understand how you find that ? 

 

I got an other one that is also complicated for me : 

[ANAH][88][Demandeur][45896_1529768635] Question concernant mon dossier

With that line how to get the value [Demandeur] when 88 can be 01 to 99 

I know how to get it when 88 does not changing. But how to do when it s changing ?

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

1 hour ago, caramen said:

If you can give me some explanations ... To make me understand how you find that ? 

Hmmm. You've got a helpfile and a (theoretically) working brain
And @AutoBert gave you an example which already contains all needed clues provided that you tried to understand it

#include <String.au3>
$s = "[ANAH][88][Demandeur][45896_1529768635] Question concernant mon dossier "
Msgbox(0,"", _StringBetween($s, '[', ']')[1] & @crlf & _StringBetween($s, '[', ']')[2] )

 

Link to comment
Share on other sites

On 8/1/2018 at 5:12 AM, AutoBert said:

also right with one exception: if learning regex isn't succesfull.

learning how not to regex, is how i learned to regex.  :)

#include<array.au3>

$a = stringsplit(FileRead("test.txt") , "[], " , 2)

local $a2[5] = [$a[16] , $a[3] , $a[5] , $a[35] , $a[38]]

_ArrayDisplay($a2)

 

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

On 03/08/2018 at 5:56 PM, mikell said:

Hmmm. You've got a helpfile and a (theoretically) working brain
And @AutoBert gave you an example which already contains all needed clues provided that you tried to understand it

#include <String.au3>
$s = "[ANAH][88][Demandeur][45896_1529768635] Question concernant mon dossier "
Msgbox(0,"", _StringBetween($s, '[', ']')[1] & @crlf & _StringBetween($s, '[', ']')[2] )

 

I know it can looks ridiculus to help me when the help is saying everything... But for me it s hard... to understand. Man you give me a very good way to start with... thanks you!!

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

@mikell Man your help was imba :) Here is my script for furter user that whould like to understand easy script for starter... 

 

First of all i was needing that line to do same of you : 

$s = "[ANAH][88][Demandeur][45896_1529768635] Question concernant mon dossier "

So i did that : 

$Ligne = _GetValueInArray($aSplit, '[ANAH]')
$Dep  = _StringBetween($Ligne, '[', ']')[0]
       $Role = _StringBetween($Ligne, '[', ']')[1]

 

1000 Thx. 

@mikell My last question : 

In this line :

blablabla vous envoie ce message :

Particulary if the blablabla can be bliblibli blobloblo or unknow name. 

How to get blablabla in a $variable ?? 

 

Edit:

Answer : 

$pattern = '(?s).+?(\d+)\]\[([^\]]+).+?Bonjour,\s+(.+?) vous envoie.+?email : (\N+).+?tél. : (\N+)'
       $a = StringRegExp($DataLut, $pattern, 3)
       $Nom = $a [2]

 

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

@mikell I am learning StringRegExp can you just confirme you used these settings ?

$pattern = '(?s).+?(\d+)\]\[([^\]]+).+?Bonjour,\s+(.+?) vous envoie.+?email : (\N+)'

Mikell or someone else can explain me how to cut this ?

(?s).+?(\d+)\]\[([^\]]+)

So i can find each in help file

I got these

(?s)

.

+?

\d

+

Not the rest

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

7 hours ago, caramen said:

How to get blablabla in a $variable ?? 

Same way, use _StringBetween

#include <String.au3>
$s = "blablabla vous envoie ce message : "
Msgbox(0,"", _StringBetween($s, "", ' vous envoie')[0] )

It's a pretty nice solution if you don't feel sure with regex
 

2 hours ago, caramen said:

Not the rest

OK, here is an example

#include <Array.au3>
$s = "[ANAH][88][Demandeur][45896_1529768635] Question concernant mon dossier "
$a = StringRegExp($s, '\[([^\]]+)\]', 3)
_ArrayDisplay($a)

explanations :
the brackets are escaped when used as literals because they are special characters
In the capturing group, [...] is a character class (refer to the help file), and  ^\]  means "a char which is not a closing bracket"

So literally, the expression \[([^\]]+)\] means : "get one or more chars, included in brackets, which are not a closing bracket"
:)

 

Link to comment
Share on other sites

does seeing it many different ways help?

#include <Array.au3>
$s = "[ANAH][88][Demandeur][45896_1529768635] Question concernant mon dossier "
$a = stringsplit(stringreplace(stringtrimright($s , 1 + StringLen($s) - StringInStr($s , "]" , 0 , -1)) , "[" , "") , "]" , 2)
_ArrayDisplay($a)

 

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...