Jump to content

Displaying computer name in message box


Recommended Posts

Hi there,

Unfortunately, it's been some time since I did any programming nevermind AutoIt so I have chosen this to get my teeth into.

I'm wondering where to start to just get the computer name displayed in a message box.

Thanks for any advice you could offer.

Devad

Link to comment
Share on other sites

Hi there,

Unfortunately, it's been some time since I did any programming nevermind AutoIt so I have chosen this to get my teeth into.

I'm wondering where to start to just get the computer name displayed in a message box.

Thanks for any advice you could offer.

Devad

MsgBox(0, "Computer Name", @ComputerName)

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Thanks George!

Now how would I remove the first three letters / characters off of the computer name? Our computer names are prefixed with department three character codes and it's the rest of the computer name that i need.

I'm thinking that I should read the computer name in as a string but then how i would take off the first three characters I don't know.

Thanks,

Devad

Link to comment
Share on other sites

Thanks George!

Now how would I remove the first three letters / characters off of the computer name? Our computer names are prefixed with department three character codes and it's the rest of the computer name that i need.

I'm thinking that I should read the computer name in as a string but then how i would take off the first three characters I don't know.

Thanks,

Devad

$sPrefix = StringRight(@ComputerName, 3)
MsgBox(Default, Default, $sPrefix)

Or

$sPrefix = StringTrimLeft(@ComputerName, StringLen(@ComputerName)-3)
MsgBox(Default, Default, $sPrefix)

Untested, but should work.

Edited by KentonBomb
Link to comment
Share on other sites

$sPrefix = StringRight(@ComputerName, 3)
MsgBox(Default, Default, $sPrefix)

Or

$sPrefix = StringTrimLeft(@ComputerName, StringLen(@ComputerName)-3)
MsgBox(Default, Default, $sPrefix)

Untested, but should work.

Cheers Kenton,

Thanks for pointing me in the right direction

$strAsset = StringTrimLeft(@ComputerName, 3)
MsgBox(64, "Asset No", $strAsset)

:)

Link to comment
Share on other sites

$cName = StringMid(@ComputerName, 4)

MsgBox(0, "", "This Computer is " & $cName)

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

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