Jump to content
Sign in to follow this  
WeMartiansAreFriendly

IsIdent

Recommended Posts

WeMartiansAreFriendly

i got inspiration from this topic http://www.autoitscript.com/forum/index.php?showtopic=44055..

it's kind of like === operater, if you used javascript, or others you'll know that it compares values not by just if there equal.. but if there the same value type, string, number ect.. maybe autoit developers will implement the === operater, until then you could try this.. suggestions??

ver 2 (4/12/2007)

i changed the number checking, it checks length as well, so 1.0, and 1 should return false... now.

ConsoleWrite(IsIdent(1,1)&@LF); true
ConsoleWrite(IsIdent(false,false)&@LF); true
ConsoleWrite(IsIdent(1,true)&@LF); false
ConsoleWrite(IsIdent(1,'1')&@LF) ; false
ConsoleWrite(IsIdent(true,'true')&@LF) ; false
ConsoleWrite(IsIdent('hello','hellO')&@LF) ; false
ConsoleWrite(IsIdent('Hello','Hello')&@LF) ; true
ConsoleWrite(IsIdent(1, 1.0) & @LF) ;false
ConsoleWrite(IsIdent(default, 'default') & @LF) ;false


Func IsIdent($bVal1, $bVal2)
    If IsString($bVal1) And IsString($bVal2) Then
        If ($bVal1 == $bVal2) Then Return True
        Return False
    ElseIf IsNumber($bVal1) And IsNumber($bVal2) Then
        If ($bVal1 == $bVal1) _
            And StringLen(Binarystring($bVal1)) == _
            StringLen(Binarystring($bVal2)) Then Return True
        Return False
    ElseIf IsKeyWord($bVal1) And IsKeyWord($bVal2) Then
        If ($bVal1 == $bVal2) Then Return True
        Return False
    ElseIf IsBool($bVal1) And IsBool($bVal2) Then
        If ($bVal1 == $bVal2) Then Return True
        Return False
    ElseIf IsBinaryString($bVal1) And IsBinaryString($bVal2) Then
        If ($bVal1 == $bVal2) Then Return True
        Return False
    EndIf
    Return False
EndFunc
oÝ÷ Ú]z»Þ®È¨Ç(uæèÆ÷«Õ«­¢+Ø)
½¹Í½±]ɥѡ%Í%¹Ð İĤµÀí1¤ìÑÉÕ)
½¹Í½±]ɥѡ%Í%¹Ð¡±Í±±Í¤µÀí1¤ìÑÉÕ)
½¹Í½±]ɥѡ%Í%¹Ð ıÑÉÕ¤µÀí1¤ì±Í)
½¹Í½±]ɥѡ%Í%¹Ð Ä°ÌäìÄÌä줵Àí1¤ì±Í)
½¹Í½±]ɥѡ%Í%¹Ð¡ÑÉÕ°ÌäíÑÉÕÌä줵Àí1¤ì±Í)
½¹Í½±]ɥѡ%Í%¹Ð Ìäí¡±±¼Ìäì°Ìäí¡±±

Edited by mrRevoked

Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet()

Share this post


Link to post
Share on other sites
MrCreatoR

Hi,

Nice function...

But with this one not return false :shocked: :

ConsoleWrite(IsIdent(1, 1.0) & @LF)

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites
Valuater

Maybe...

ConsoleWrite(IsIdent(1,1)&@LF); true
ConsoleWrite(IsIdent(false,false)&@LF); true
ConsoleWrite(IsIdent(1,true)&@LF); false
ConsoleWrite(IsIdent(1,'1')&@LF) ; false.... THIS SHOWS TRUE
ConsoleWrite(IsIdent(true,'true')&@LF) ; false
ConsoleWrite(IsIdent('hello','hellO')&@LF) ; false
ConsoleWrite(IsIdent('Hello','Hello')&@LF) ; true


Func IsIdent($bVal1, $bVal2)
    Return $bVal1 == $bVal2
EndFunc

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites
MrCreatoR

ConsoleWrite(IsIdent(1,'1')&@LF) ; false.... THIS SHOWS TRUE

Yes, so this is not quite correct checking if given variables is ident.

My example is short, and correct enough to do the job :shocked:


 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites
piccaso

ConsoleWrite(_IsIdentic(1, 1) & @LF); true
ConsoleWrite(_IsIdentic(False, False) & @LF); true
ConsoleWrite(_IsIdentic(1, True) & @LF); false
ConsoleWrite(_IsIdentic(1, '1') & @LF) ; false
ConsoleWrite(_IsIdentic(True, 'true') & @LF) ; false
ConsoleWrite(_IsIdentic('hello', 'hellO') & @LF) ; false
ConsoleWrite(_IsIdentic('Hello', 'Hello') & @LF) ; true
ConsoleWrite(_IsIdentic(1, 1.0) & @LF) ;false
ConsoleWrite(_IsIdentic(Default, 'default') & @LF) ;false


Func _IsIdentic($vVariable_A, $vVariable_B)
    If (IsString($vVariable_A) And IsString($vVariable_B)) _
            Or (IsNumber($vVariable_A) And IsNumber($vVariable_B)) _
            Or (IsKeyword($vVariable_A) And IsKeyword($vVariable_B)) _
            Or (IsBool($vVariable_A) And IsBool($vVariable_B)) _
            Or (IsBinaryString($vVariable_A) And IsBinaryString($vVariable_B)) Then
        If ($vVariable_A == $vVariable_B) _
                And (StringLen(BinaryString($vVariable_A)) == StringLen(BinaryString($vVariable_B))) Then Return True
    EndIf
    Return False
EndFunc   ;==>_IsIdentic

a bit smaller :shocked:

Mybe its a silly question but...

what happend to Object, hWnd and Struct ?


CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map

Share this post


Link to post
Share on other sites
therks

Func _IsIdent($vVar1, $vVar2)
    If (IsArray($vVar1) And IsArray($vVar2)) Or _
        (IsKeyword($vVar1) And IsKeyword($vVar2)) Or _
        (IsBool($vVar1) And IsBool($vVar2)) Or _
        (IsBinaryString($vVar1) And IsBinaryString($vVar2)) Or _
        (IsHWnd($vVar1) And IsHWnd($vVar2)) Or _
        (IsNumber($vVar1) And IsNumber($vVar2)) Or _
        (IsObj($vVar1) And IsObj($vVar2)) Or _
        (IsDllStruct($vVar1) And IsDllStruct($vVar2)) Or _
        (IsString($vVar1) And IsString($vVar2)) Then
        If ($vVar1 == $vVar2) And (StringLen(BinaryString($vVar1)) = StringLen(BinaryString($vVar2))) Then Return True
    EndIf
    Return False
EndFunc

I think I'm gonna use this one until (if) the === operator gets added.

*Edit: Double equals between StringLen(BinaryString()) wasn't necessary.

Edited by Saunders

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.