topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Sunday December 15, 2024, 2:21 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Last post Author Topic: DONE: Generate sequential serial numbers  (Read 36482 times)

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,644
    • View Profile
    • Donate to Member
Re: DONE: Generate sequential serial numbers
« Reply #25 on: June 25, 2012, 07:54 PM »
I'm one of those strange people that always try to use the smallest amount of space possible: in electronics I pack components together on a board, (and then have fun finding the faults); packing items, I'll try to use the smallest practical space; in code, I'll look for less lines.

Easy to see it as boolean instead of string.) That's why I came up with _IniBool() function. It seems trivial but with it you can actually use Boolean values in AutoIt variables and True or False will be written to the .ini using IniWrite. If the user changes it to 1 for true and 0 for false, it still functions as expected.

Func _IniBool($val)
    If $val = "True" Or $val = "1" Then Return True
    Return False
EndFunc   ;==>_IniBool


Code: AutoIt [Select]
  1. Func _IniBool($temp)
  2.   Return ($temp = 1 Or (Not StringCompare($temp, "true")))
« Last Edit: June 26, 2012, 12:24 AM by 4wd, Reason: \'cos I\'m an idiot. »

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: DONE: Generate sequential serial numbers
« Reply #26 on: June 25, 2012, 11:17 PM »
Ways to skin cat > 1 :)

edit: I liked Pascal when I first started since it's nearly self-commenting. That's why I like it if my code "spells out" what I'm doing. If it works consistently I'm cool with it. :) Personal preference I guess. :)
« Last Edit: June 25, 2012, 11:58 PM by MilesAhead »

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: DONE: Generate sequential serial numbers
« Reply #27 on: June 25, 2012, 11:54 PM »
FWIW, I think there's been a genuine misunderstanding here. My impression is of two people intending to be helpful. I can learn a little something from either side of the discussion, so thank you both.

I don't think it's a matter of IQ. If another is better at something than I, that doesn't necessarily result from a higher IQ than mine (though in my own case it almost certainly does mean that — the "For Dummies" series was clearly written for those like me). It probably means that the other has more or different experience.
-cranioscopical (June 25, 2012, 07:00 PM)

I agree with you. In fact I have a sig I like to use sometimes "How come we don't know the I.Q. of the guy who invented the test?"

What I keep running into, even on scripting language forums is "using scripting language = beginner" assumptions. I was doing OOP over 20 years ago. For small utilities on Windows AHK_L and AutoIt3 are simpler and more fun. The hotkey functions in MS Windows API don't even work.  At least trying the simple mouse click ones I got zero functionality. A waste of time. For what I'm doing the scripting stuff is superior.

I suppose since I don't have a CS degree I should keep a reading list of all the text books I studied on my own when learning this stuff.  But then some nerd will  imply I copied the author's names and didn't read any of the material. You can't win with these types.
« Last Edit: June 26, 2012, 12:00 AM by MilesAhead »

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,644
    • View Profile
    • Donate to Member
Re: DONE: Generate sequential serial numbers
« Reply #28 on: June 26, 2012, 12:15 AM »
@4wd your version of _IniBool() would never return True. The reason is values read from ini files using IniRead are always strings.

It would have returned True if $val = 1, $val = '1' or $val = True - the only case it failed was if $val = 'True' because the implicit Number() call returns 0 for 'True'.

So yeah, my goof  :-[

Code: AutoIt [Select]
  1. Func _IniBool($temp)
  2.   Return ($temp = 1 Or (Not StringCompare($temp, "true")))

My excuse is I was writing it on my netbook, lying in bed, with less than 3 minutes of battery remaining  :)
« Last Edit: June 26, 2012, 12:23 AM by 4wd »

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: DONE: Generate sequential serial numbers
« Reply #29 on: June 26, 2012, 01:54 AM »
@4wd sorry. I tend to post, then go back and edit. I should proof my posts more thoroughly before hitting the button.  It contributes to confusion.  Trouble is I get so many typos that slip through the spell check that I seem to need to edit endlessly.  Sheesh. :)

« Last Edit: June 26, 2012, 02:03 AM by MilesAhead »

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: DONE: Generate sequential serial numbers
« Reply #30 on: July 05, 2012, 02:26 PM »
Hmm, seems I inadvertently posted bad info. According to AHK_L author himself, AHK_L doesn't use Variants for everything.  They are used in Object implementation. But evidently ahk cooked up its own scheme for variable storage.

http://www.autohotke...amp;p=548540#p548382

In any case, there is no "type" only fluid storage, outside of the Object implementation.

danlock77

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 6
    • View Profile
    • Donate to Member
Re: DONE: Generate sequential serial numbers
« Reply #31 on: July 12, 2012, 02:52 PM »
FWIW, I think there's been a genuine misunderstanding here. My impression is of two people intending to be helpful. I can learn a little something from either side of the discussion, so thank you both.

I don't think it's a matter of IQ. If another is better at something than I, that doesn't necessarily result from a higher IQ than mine (though in my own case it almost certainly does mean that — the "For Dummies" series was clearly written for those like me). It probably means that the other has more or different experience.
-cranioscopical (June 25, 2012, 07:00 PM)

I think you're correct (from what I've read) with your first paragraph and I would "+1" your post for that paragraph...

However, the second paragraph is a little confusing:  As it is most-commonly used (IMO), "IQ" is a number which indicates someone's "intelligence" (Intelligence Quotient, with average being 100 and many other words describing other ranges of IQ values).  I think that's how you are using it.  Anyway, the standard IQ test is pretty limited in scope and might result in widely-varying results for different people based only on how they cognitively interpret the questions (their method of attack or thought patterns while considering how to respond) and how well they can recall lists of items, for example.  Some people who score in the 70s on IQ tests can thumb through a book in a few seconds and then tell you immediately on which page such-and-such event in the book occurs, or how many times a word is used in the text, etc.  That's just one example of how IQ might misrepresent one aspect of the brain.  (I'm thinking loosely of Kim Peek, the person on whose life the movie "Rain Man" was based.)

My second paragraph above is merely 'food for thought', since the thread's topic has mutated a few times already...
« Last Edit: July 12, 2012, 02:57 PM by danlock77, Reason: final parenthetical sentence added. oi! »