Jump to content

How to interrelate one variable to another?


Recommended Posts

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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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?

Link to comment
Share on other sites

  • Moderators

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.

Link to comment
Share on other sites

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
;
Link to comment
Share on other sites

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]

Link to comment
Share on other sites

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

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