Sign in to follow this  
Followers 0
CrazyU

Beginner's two question

5 posts in this topic

1.How alone obtains IP address fourth section of ?

192.168.1.22,So long as 22 does not want 192.168.1.22

2.

$var = DriveGetDrive( "CDROM" )

RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE", "TestKey", "REG_SZ", "$var")

Why after run this script the TestKey value is the blank, but is not CDROM path?

English not good ^-^

Share this post


Link to post
Share on other sites



1. I do not understand the question.

2. DriveGetDrive returns an array

$var = DriveGetDrive( "CDROM" )
If Not @error Then
    RegWrite("HKLM\SOFTWARE", "TestKey", "REG_SZ", $var[1])
EndIf

Notice no quotes around the array (or a variable).

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

1.How alone obtains IP address fourth section of ?

192.168.1.22,So long as 22 does not want 192.168.1.22

2.

$var = DriveGetDrive( "CDROM" )

RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE", "TestKey", "REG_SZ", "$var")

Why after run this script the TestKey value is the blank, but is not CDROM path?

English not good ^-^

I have no clue what you are asking in your first question - but your second question should put the work $var in the key as you have it in quotes - variables should not be used in quotes. Your other issue if you use msgbox() to check and see what $var is you will see nothing as the DriveGetDrive returns an array. Try $var[1] that should give you the drive letter.

-EDIT - Beat again :0

Edited by nitekram

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Share this post


Link to post
Share on other sites

1.How alone obtains IP address fourth section of ?

192.168.1.22,So long as 22 does not want 192.168.1.22

English not good ^-^

I think he wants to know how to keep only the fourth part of an IP address (trim off the first three).

$number= StringSplit($YourIP, ".")

$number[4] will contain your number.

English not so bad :whistle:


"When I get angry, Mr. Bigglesworth gets upset. And when Mr. Bigglesworth gets upset... people die!" --DrEvil

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

or:

MsgBox(0, "", StringTrimLeft(@IPAddress1, StringInStr(@IPAddress1, ".", 0, -1)))oÝ÷ ØGb·Z+jëh×6MsgBox(0, "", StringRight(@IPAddress1, StringInStr(@IPAddress1, ".", 0, 1) - 1))

Edit2: StringSplit works well enough - I was just attempting to throw @IPAddress1 into the mix and I thought while I was at it, I would show those string functions as well.

Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
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
Sign in to follow this  
Followers 0