Jump to content

StringInStr Question


Recommended Posts

Hi, :) Still learning String commands 

 

I whould like to know if there is a way to search a word (Windows) in all my patterns. In one time. 

I know how to find the word in one line. ::

I made that : 

Func Copie()
       Send ("^c")
       $dData = ClipGet ()
       $aSplit = StringSplit($dData, @CRLF, 3)
;~     _ArrayDisplay ($aSplit)
       Local $WindowsHere = StringInStr(""&$aSplit[0], "Windows")
       If $WindowsHere <>  0 Then
       MsgBox($MB_SYSTEMMODAL, "Windows", "Windows word is here")
       EndIf
EndFunc

This is my input in my ClipGet () : 

Chacune des commandes suivantes peut être lancée via l'option "Exécuter" Windows 7. Ce menu peut également être ouvert à l'aide du raccourci clavier Touche Windows + R. A noter que les commandes peuvent-être directement tapées dans le champs "Rechercher" du menu démarrer.
Si vous utilisez Windows Vista, vous pouvez consulter l'astuce des commandes de Vista.
Activation de Windows L’assistant : dans <Exécuter> taper slui puis OK
Ajout/Fonctionnalité Windows : dans <Exécuter> taper optionalfeatures puis OK
Ou <Panneau de configuration> - <Programmes> dans < Programmes et Fonctionnalités> dans la partie gauche Activer ou désactiver des fonctionnalités Windows
Ajout/Suppression de programmes : dans <Exécuter> taper appwiz.cpl puis OK
Ou <Panneau de configuration> - <Programmes> Désinstaller un programme
Administrateur BDE : dans <Exécuter> taper bdeadmin.cpl puis OK
Ou dans C:\Programmes\Common Files\Borland

 

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

@FrancescoDiMuro Haha ok What is the command then with StringinStr ?  

       Local $WindowsHere = StringInStr(""&$dData, "Windows",0,1)

How can i check if i got 1 or more result ?

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

I am taking this as a challenge :evil: ok i come back with the correct syntaxt !!! 

 

@FrancescoDiMuro Just if you can learn me how to  to use another variable that counts how many occurrences are in the string.

 

I am checking myself with stringregexp

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

14 minutes ago, FrancescoDiMuro said:

Go for it! :cheer:

$aArray = StringRegExp(''&$dData, 'Windows', $STR_REGEXPARRAYGLOBALFULLMATCH)
 $aMatch = 0
For $i = 0 To UBound($aArray) - 1
    $aMatch = $aArray[$i]
    For $j = 0 To UBound($aMatch) - 1

        MsgBox($MB_SYSTEMMODAL, "RegExp Test with Option 4 - " & $i & ',' & $j, $aMatch[$j]&@CRLF&"Total = "&$Count + 1)

        $Count = $Count + 1
    Next
;~     $Total = $Count
;~    MsgBox($MB_SYSTEMMODAL, "Bumber of occurrence = "&$Total )
 Next
   $Total = $Count
   MsgBox($MB_SYSTEMMODAL, "Occurrence","Number of occurrence = "&$Total )
EndFunc


Working :D

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

FrancescoDiMuro Just if you can learn me how to  to use another variable that counts how many occurrences are in the string.

With the first methode i mean.

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

Func Copie()
       $Total = 0
       Send ("^c")
       $dData = ClipGet ()
 $aArray = StringRegExp(''&$dData, 'Windows', $STR_REGEXPARRAYGLOBALFULLMATCH)
 $aMatch = 0
For $i = 0 To UBound($aArray) - 1
    $aMatch = $aArray[$i]
    For $j = 0 To UBound($aMatch) - 1
        MsgBox($MB_SYSTEMMODAL, "RegExp Test with Option 4 - " & $i & ',' & $j, $aMatch[$j]&@CRLF&"Total = "&$Count + 1)
        $Count = $Count + 1
    Next
 Next
 $Total = $Count
 MsgBox($MB_SYSTEMMODAL, "Total","Total = "&$Total)
EndFunc

I never used For ... Next 

How to get that working ? 

$Total = $Count
 MsgBox($MB_SYSTEMMODAL, "Total","Total = "&$Total)

Becose it s nice but i whould like to not straying stuck in the while xD

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

thx :) 

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

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...