au3scr Posted September 10, 2008 Share Posted September 10, 2008 Need help with getting this if sentence working. $current_title "Is text" $modified = 0 ;ATM If sentence have no effect, how i make that if sentence do action when string's 1-st symbol is not *? ($is_star) Func do_Func () $is_star = StringLeft($current_title, 1) If NOT $is_star = "*" Then WinSetTitle($current_title,"","*"&$current_title) $current_title = "*"&$current_title $modified = 1 EndIf EndFunc Link to comment Share on other sites More sharing options...
Richard Robertson Posted September 10, 2008 Share Posted September 10, 2008 Why not just use "If StringLeft($current_title, 1) <> '*' Then"? Link to comment Share on other sites More sharing options...
DW1 Posted September 10, 2008 Share Posted September 10, 2008 If NOT $is_star = "*" Then should be If $is_star <> "*" Then AutoIt3 Online Help Link to comment Share on other sites More sharing options...
PsaltyDS Posted September 10, 2008 Share Posted September 10, 2008 If NOT $is_star = "*" Thenshould beIf $is_star <> "*" ThenBecause I was bitten by this myself once I would add WHY: Look in the help file under Operators at the Order of Operations.NOT has an earlier place than variable assignment. In fact is comes first in the list.So this code: If NOT $is_star = "*" ThenIs equivalent to this: If (NOT $is_star) = "*" ThenYou could make it work with this: If NOT ($is_star = "*") ThenBut the correct usage (as previously pointed out) is just: If $is_star <> "*" Then 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 Link to comment Share on other sites More sharing options...
trancexx Posted September 10, 2008 Share Posted September 10, 2008 Because I was bitten by this myself once I would add WHY: Look in the help file under Operators at the Order of Operations.NOT has an earlier place than variable assignment. In fact is comes first in the list.So this code: If NOT $is_star = "*" ThenIs equivalent to this: If (NOT $is_star) = "*" ThenYou could make it work with this: If NOT ($is_star = "*") ThenBut the correct usage (as previously pointed out) is just: If $is_star <> "*" Then And if you are "speed fan" you will use If $is_star <> "*" Then because it will return faster.Or use Switch...Case...EndSwitch -that is the fastest way. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now