Jump to content

StringSplit


Recommended Posts

The following code works.

Its purpose is to extract the name of the executable [OUTLOOK. or MSISM.EXE] from this data returned by RegRead PROGRA~1\MICROS~2\OFFICE11\OUTLOOK.EXE -c IPM.Note /m "%1"

You will notice that I have nested two processes into the second line of the code which incorporates both the first StringSplit and the RegRead.

My question is it possible to nest the three [line 2-4 inclusive] lines of code into one statement in order to obtain [in this example] OUTLOOK.EXE as the value for $dEMail

or alternatively is there some other AutoIT function/s that are better designed to achieve the same result.

CODE

dim $dEMail

$dEMail = StringSplit(RegRead("HKCR\mailto\shell\open\command",""),".exe"); Read the Default Email Client and Split on ".exe" value[1] is everything left of .exe

$dEMail = stringsplit($dEmail[1],"\") ;Split previous item [1] on "\"

$deMail = $dEMail[$dEmail[0]] & ".EXE" ;Read the number of items [nn] in the previous split and the executables name has the highest number in that split + add ".EXE"

Ant..

Link to comment
Share on other sites

The following code works.

Its purpose is to extract the name of the executable [OUTLOOK. or MSISM.EXE] from this data returned by RegRead PROGRA~1\MICROS~2\OFFICE11\OUTLOOK.EXE -c IPM.Note /m "%1"

You will notice that I have nested two processes into the second line of the code which incorporates both the first StringSplit and the RegRead.

My question is it possible to nest the three [line 2-4 inclusive] lines of code into one statement in order to obtain [in this example] OUTLOOK.EXE as the value for $dEMail

or alternatively is there some other AutoIT function/s that are better designed to achieve the same result.

CODE

dim $dEMail

$dEMail = StringSplit(RegRead("HKCR\mailto\shell\open\command",""),".exe"); Read the Default Email Client and Split on ".exe" value[1] is everything left of .exe

$dEMail = stringsplit($dEmail[1],"\") ;Split previous item [1] on "\"

$deMail = $dEMail[$dEmail[0]] & ".EXE" ;Read the number of items [nn] in the previous split and the executables name has the highest number in that split + add ".EXE"

Ant..
The geeky RegExp answer:
Global $sRegKey = "HKCR\mailto\shell\open\command", $sRegValue = ""
Global $sEMailApp = RegRead($sRegKey, $sRegValue)
$avEMailApp = StringRegExp($sEMailApp, "(?i)\w*+\.EXE", 1)
MsgBox(64, "Results", "Registered 'MailTo' app is:  " & $avEMailApp[0])

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

The geeky RegExp answer:

Global $sRegKey = "HKCR\mailto\shell\open\command", $sRegValue = ""
 Global $sEMailApp = RegRead($sRegKey, $sRegValue)
 $avEMailApp = StringRegExp($sEMailApp, "(?i)\w*+\.EXE", 1)
 MsgBox(64, "Results", "Registered 'MailTo' app is:  " & $avEMailApp[0])

:)

NERD
Link to comment
Share on other sites

  • Moderators

Oh, no! I'm posting gratuitous RegExp's... I'm becoming SmOke_N!

:)

Thanks... made me chuckle... but what does that make me? :P

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

The geeky RegExp answer:

Global $sRegKey = "HKCR\mailto\shell\open\command", $sRegValue = ""
Global $sEMailApp = RegRead($sRegKey, $sRegValue)
$avEMailApp = StringRegExp($sEMailApp, "(?i)\w*+\.EXE", 1)
MsgBox(64, "Results", "Registered 'MailTo' app is:  " & $avEMailApp[0])

:)

Unlike others I will talk about you in the most favourable terms. Thanks for unvailing the mystery of (?i)\w*+\

Ant..

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