Jump to content

Search the Community

Showing results for tags 'assign eval isdeclared assoc'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. Never really had a need for IsDeclared or such-like, but came up with the following idea below. Anyone else have other ideas for usage? #include <Constants.au3> #cs Idea for appending $ to the variable name in Assign by Yashied. Topic: http://www.autoitscript.com/forum/topic/122192-arraysort-and-eliminate-duplicates/#entry849187 #ce Example() Func Example() AssocAdd('ExampleString', 'This is a sample string') AssocAdd('This is a random string with a number', 100) MsgBox($MB_SYSTEMMODAL, '', AssocGet('ExampleString')) MsgBox($MB_SYSTEMMODAL, '', AssocGet('This is a random string with a number')) MsgBox($MB_SYSTEMMODAL, '', AssocGet('String doesn''t exist')) EndFunc ;==>Example Func AssocAdd($sStringName, $vValue) Local Const $iGlobalVar = 2 ; Create in Global scope, as Local scope will be destroyed once returned from the function. Return Assign($sStringName & '$', $vValue, $iGlobalVar) = 1 ; Assign the string name with the desired value. EndFunc ;==>AssocAdd Func AssocGet($sStringName) If IsDeclared($sStringName & '$') = 0 Then Return SetError(1, 0, '') ; If the string name doesn't exist the return a blank string Return Eval($sStringName & '$') ; Return the value of the string name. EndFunc ;==>AssocGet
×
×
  • Create New...