Sign in to follow this  
Followers 0
clarkster26

Combining Variable problems

8 posts in this topic

When I hit button 1 the data it provides is 
 ' & $GlobalVar8 & '' & $GlobalVar1 & '' & $GlobalVar2 & '' & $GlobalVar3 & '' & $GlobalVar9 & '' & $GlobalVar4 & '' & $GlobalVar5 & '' & $GlobalVar6 & '' & $GlobalVar7 & '
Not the input data that is provided from the gui. I have tried to find examples and have tried this line as well with no luck.
$CompName=$GlobalVar8 & $GlobalVar1 & $GlobalVar2 & $GlobalVar3 & $GlobalVar9 & $GlobalVar4 & $GlobalVar5 & $GlobalVar6 & $GlobalVar7
 
How can I call all these variables together?
 
 
$GlobalVar1 = GUICtrlRead($GlobalInput1, 1)
$GlobalVar2 = GUICtrlRead($GlobalInput2, 1)
$GlobalVar3 = GUICtrlRead($GlobalInput3, 1)
$GlobalVar4 = GUICtrlRead($GlobalInput4, 1)
$GlobalVar5 = GUICtrlRead($GlobalInput5, 1)
$GlobalVar6 = GUICtrlRead($GlobalInput6, 1)
$GlobalVar7 = GUICtrlRead($GlobalInput7, 1)
$GlobalVar8=("S")
 
ElseIf $GlobalInput1 = 0 And $GlobalInput2 = 9 And $GlobalInput3 = 9 Then
$GlobalVar9 = ("UAS")
 
ElseIf $GlobalInput1 <> "0" And $GlobalInput2 <> "9" And $GlobalInput3 <> "9" Then
$GlobalVar9 = ("POS")
 
 
$GlobalInput1 = GUICtrlCreateInput( "", 90, 110, 20, 24)
GUICtrlSetBkColor( -1, 0xFF0000)
$GlobalInput2 = GUICtrlCreateInput( "", 90, 110, 20, 24)
GUICtrlSetBkColor( -1, 0xFF0000)
$GlobalInput3 = GUICtrlCreateInput( "", 120, 110, 20, 24)
GUICtrlSetBkColor( -1, 0xFF0000)
$GlobalInput4 = GUICtrlCreateInput( "", 150, 110, 20, 24)
GUICtrlSetBkColor( -1, 0xFF0000)
$GlobalInput5 = GUICtrlCreateInput( "", 121, 140, 20, 24)
GUICtrlSetBkColor( -1, 0xFF0000)
$GlobalInput6 = GUICtrlCreateInput( "", 150, 140, 20, 24)
GUICtrlSetBkColor( -1, 0xFF0000)
$GlobalInput7 = GUICtrlCreateInput( "", 181, 140, 20, 24)
GUICtrlSetBkColor( -1, 0xFF0000)
 
 
Func Button1Click()
 
$CompName =  ' & $GlobalVar8 & '' & $GlobalVar1 & '' & $GlobalVar2 & '' & $GlobalVar3 & '' & $GlobalVar9 & '' & $GlobalVar4 & '' & $GlobalVar5 & '' & $GlobalVar6 & '' & $GlobalVar7 & '
 
    RegWrite ("HKEY_USERS.DefaultSoftwareMicrosoftWindows MediaWMSDKGeneral", "Computername", "REG_SZ", $CompName)
 
EndFunc

Share this post


Link to post
Share on other sites



I'm not real sure what you are asking, but here's something that may or may not help you.

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$Form2 = GUICreate("", 267, 152)
$Input1 = GUICtrlCreateInput("ComputerName", 16, 16, 121, 21)
$Input2 = GUICtrlCreateInput("NetworkAddress", 16, 48, 121, 21)
$Input3 = GUICtrlCreateInput("IPAddress", 16, 80, 121, 21)
$Input4 = GUICtrlCreateInput("Location", 16, 112, 121, 21)
$Button1 = GUICtrlCreateButton("Read", 168, 64, 75, 25)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            $readInput1 = GUICtrlRead($Input1)
            $readInput2 = GUICtrlRead($Input2)
            $readInput3 = GUICtrlRead($Input3)
            $readInput4 = GUICtrlRead($Input4)
            $outputString = $readInput1 & " - " & $readInput2 & " - " & $readInput3 & " - " & $readInput4
            MsgBox(0, "", $outputString)
    EndSwitch
WEnd

RAID Calculator | Software Installer

The truth has been suppressed since the dawn of time.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Hi,

Few things:

Instead of:

$CompName =  ' & $GlobalVar8 & '' & $GlobalVar1 & '' & $GlobalVar2 & '' & $GlobalVar3 & '' & $GlobalVar9 & '' & $GlobalVar4 & '' & $GlobalVar5 & '' & $GlobalVar6 & '' & $GlobalVar7 & '

You should doing like this way:

$CompName =  $GlobalVar8 & $GlobalVar1 & $GlobalVar2 & $GlobalVar3 & $GlobalVar9 & $GlobalVar4 & $GlobalVar5 &  $GlobalVar6 & $GlobalVar7

Instead of:

$GlobalVar9 = ("UAS")
$GlobalVar9 = ("POS")

It should be

$GlobalVar9 = "UAS"
$GlobalVar9 = "POS"

Anyway, you start "ElseIf" without "If"

Good luck! :)

Edited by michaelslamet
1 person likes this

Share this post


Link to post
Share on other sites
 I have tried to find examples and have tried this line as well with no luck.

Why not show what you have tried so that we can correct for what isn't .


My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

@clarkster26 - Your code is awful to read like that and is not helpful to those who want to help, so please re-post the code in the provided 'AutoIt Code' quotes, which can be accessed via the Code button beneath the Smiley one.

Some code seems to be missing too, and I don't understand why you start and finish your line with

$CompName =  ' & .................................. & '

Remove those elements ( ' &   and  & ' ) and you might get what you want?

However, if not, then fix the code as I said, and I'll have another look.

Edited by TheSaint

AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Share this post


Link to post
Share on other sites

Sorry for not including enough information. I followed michaelslamet's post which was exactly what I was looking for it to do. If you do not mind me asking what does this  & '' &  actually do? Thanks for all your help it is amazing the amount of people on here willing to help.  

Share this post


Link to post
Share on other sites

Sorry for not including enough information. I followed michaelslamet's post which was exactly what I was looking for it to do. If you do not mind me asking what does this  & '' &  actually do? Thanks for all your help it is amazing the amount of people on here willing to help.  

I would imagine that is just providing a space between every piece of data returned by each variable.


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Share this post


Link to post
Share on other sites

I would imagine that is just providing a space between every piece of data returned by each variable.

I think he is talking about the code from the first post, and in that case the ampersands would do nothing since they are inside the strings.

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