Sign in to follow this  
Followers 0
FireFox

Get words attribued to variables

6 posts in this topic

Hi,

I want to get words attribued to variables for example :

$01="FireFox"
;If user enter "FireFox" so script will display $01

I know how to do conversely but im only interesed by this way...

Thanks for anyhelp :)


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites



Hi,

I want to get words attribued to variables for example :

$01="FireFox"
;If user enter "FireFox" so script will display $01

I know how to do conversely but im only interesed by this way...

Thanks for anyhelp :)

Sounds like an associative array (Scripting.Dictionary object). Search the forum for many examples.

:o


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

@PsaltyDS

Thanks for reply :)


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

Sounds like an associative array (Scripting.Dictionary object). Search the forum for many examples.

:)

I agree that a dictionary is probably the best route. But for some simple case it could be sufficient to use Assign and Eval.

;associate "FireFox" with some text or value

Assign("FireFox","$01");firefox is to be represented by "$01"
$text = "FireFox"
ConsoleWrite("method 1 gives " & Eval($text) & @CRLF)

;or if you want the value of variable $01 assigned to "FireFox" then
Assign("FireFox","01"); FireFox is associated with the value of $01

$01 = 245
$text = "FireFox"

ConsoleWrite("Method 2 gives " &Eval(Eval($text)) & @CRLF)

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

A slightly more dynamic version of the Assign/Eval idea.

Works if your variables are all numerically assigned

$01="FireFox"
$02 = "IE"
$03 = "Chrome"

;If user enter "FireFox" so script will display $01
For $i = 1 to 3
    ConsoleWrite(Eval("0" & $i) & @crlf)
    Assign(Eval("0" & $i),"0" & $i)
Next

While 1
$input = InputBox("Input","Type something")
If @error = 1 then Exit

If IsDeclared($input) Then
    MsgBox(0,"","You entered the text for the variable $" & Eval($input))
Else
    MsgBox(0,"","No matching variable found")
EndIf
WEnd

Share this post


Link to post
Share on other sites

@ResNullius

Thanks :)


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

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