Jump to content
Sign in to follow this  
nokia6300

How to interrelate one variable to another?

Recommended Posts

nokia6300
Can U people tell me any easy way or concept through which I can interrelate one variable with other because every time when I try to interrelate any variable with other I face confusuion what to do & how to interrelate one variable to an other if U provide any example & explain step by step it will be much appreciated

Share this post


Link to post
Share on other sites
MrMitchell

Can you explain a little bit more in depth about what you need? Preferably provide an idea or concept...

Share this post


Link to post
Share on other sites
nokia6300

Can you explain a little bit more in depth about what you need? Preferably provide an idea or concept...

For example I want to 1st get the drive type of any Drive & then want to relate it with "CDTray" command how can I do that??

Share this post


Link to post
Share on other sites
BlackDragonBE

I'm not entirely sure what you mean, but if you mean making sure variable a is always equal to variable b, you'll need to have a main while-loop like this:

While 1
   ;Your code...
    b = a

    Sleep(300)
Wend

This will make sure that the variable b will be equal to variable a.

If you mean to check if it's equal:

If b=a Then
   ;Do some fancy stuff here
Endif

Share this post


Link to post
Share on other sites
nokia6300

This is not my requirement.

Dear friend for example I want to 1st get title for a windo of any window by using "WinGetTitle" & it is $a then I want to set a title for a window "Nokia6300" which is $b how can I inerrelate $a with $b what is the logic behind that?

Share this post


Link to post
Share on other sites
BlackDragonBE

What exactly dou you mean by interrelate?

Getting and setting text from/for a window can be done with WinGetText and WinSetText respectively.

Share this post


Link to post
Share on other sites
SmOke_N

This is not my requirement.

Dear friend for example I want to 1st get title for a windo of any window by using "WinGetTitle" & it is $a then I want to set a title for a window "Nokia6300" which is $b how can I inerrelate $a with $b what is the logic behind that?

?? :D ?? My suggestion is to do:

This: http://www.autoitscript.com/forum/index.ph...c=84960&hl=

And then this: http://www.autoitscript.com/forum/index.php?showtopic=21048

For some basic idea on how to use autoit.

I'd also search google for "How to post good questions".


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.

Share this post


Link to post
Share on other sites
nokia6300

Please dear members I only need basic concept of interrelating or merging one variable with other I just need concept or idea how U people link one variable with other?

Share this post


Link to post
Share on other sites
Malkey

Please dear members I only need basic concept of interrelating or merging one variable with other I just need concept or idea how U people link one variable with other?

This script shows the interrelated relationship between a variable and the contents of that variable.

Hope this helps, U people, you,

Note: All this and more is in the AutoIt help file. Plus, there are copious examples on these forums.

Suggestions:-

Look up ByRef in help file, see the example; and,

http://www.autoitscript.com/wiki/Tutorial_...guage#Variables

;
#include <GUIConstantsEx.au3> ; Include files found in C:\Program Files\AutoIt3\Include directory, normal AutoIt installation.
#include <WindowsConstants.au3>
; This particular script does not need these include files. They do add a little colour to top of this script when in SciTE.

Opt('MustDeclareVars', 1)
Local $msg, $a, $b ; Declare variables

GUICreate("My GUI") ; Will create a GUI (Graphic User Interface) or window.
GUISetState(@SW_SHOW) ; Show GUI.

; Variable $a is assigned the GUI window title as a string from the return value of the WinGetTitle() function.
$a = WinGetTitle("My GUI", "")

MsgBox(0, "Full title read was:", "The $a variable contains : " & $a) ; Show contents of variable $a with a message box.

$b = "Nokia6300" ; Assign the string, "Nokia6300", to the variable $b.

; Set the window title of the window with the title matching the string in the $a variable, to the string in the variable, $b.
WinSetTitle($a, "", $b) 

MsgBox(0, "New title set to:", "Title was    : " & $a & @CRLF & "Now title is : " & $b); Message box showing a concatenated string,

#cs ; Start of block comment
    
    ; Run the GUI until the dialog is closed
    While 1
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
    
#ce ; End of block comment
;

Share this post


Link to post
Share on other sites
xXUlTiMaTeSiNXx

This is not my requirement.

Dear friend for example I want to 1st get title for a windo of any window by using "WinGetTitle" & it is $a then I want to set a title for a window "Nokia6300" which is $b how can I inerrelate $a with $b what is the logic behind that?

i think i understand so, the value of first variable, lets call it $var1 is "123" and the value of our second variable, $var2 is "456" what you want is a variable called $var3 that will result in 123456?

this can be achived two ways, the first is relitivly simple, rather than actuly haveing a $var3 you would simple write

$var1 & $var2oÝ÷ ÚØ^±ç(جjZ(¥Ê'µ¨§Ø^m«"qÊ'qêm¡ûayø«²ÜÊ0z÷«r·¶)àÓ~¯j½ÚºÚ"µÍÚ[HBÖSÕTÓÑHTB   ÌÍÝH [È ÌÍÝH ÌÍÝÂÛY
L
BÙ[

I'm new to AutoIT, please help me where you can.[size=10]Profanity is the one language that all programmers understand[/size]

Share this post


Link to post
Share on other sites
Malkey

the second is a loop, containg the basic concept of the first way, however creating $var3

While 1
  ;YOUR CODE HERE
    $var1 & $var2 = $var3

    Sleep(500)
Wend
xXUlTiMaTeSiNXx

Instead of your quoted method above, try this. And forget about the loop.

;
Local $var1 = "123", $var2 = "456", $var3

$var3 = $var1 & $var2

MsgBox(0, "", "$var3 contains : " & $var3)
;

Malkey

Share this post


Link to post
Share on other sites
nokia6300

To xXUlTiMaTeSiNXx

U got my point I really want to know the same thing but can U explain with a little complex example but not that much complex example whih I won't even understand as I am very new to programming

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  

×