Sign in to follow this  
Followers 0
FuryCell

UDF : _Picture

19 posts in this topic

#1 ·  Posted (edited)

I created this UDF after looking through my Computer Desktop Enclopeda when i found this article. (I can't link to it just look up picture at )http://www.computerlanguage.com/webexamples.htm

(I have the stand-alone version but its in the web version too.)

The UDF takes a number and formats it how you want it.

For example:

_Picture("(999)999-9999",2152971234)
would return (215)297-1234.

Here is the header:

CODE
Removed

Please let me know what you think.

Old version removed.Scroll down for the new version.

Edited by SolidSnake

HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.

Share this post


Link to post
Share on other sites



Interesting... Kind of reminds me of COBOL. Why is this? Nice error checking..

I will have to look into it further... Thx!

Cheers.. :)

Share this post


Link to post
Share on other sites

Interesting... Kind of reminds me of COBOL. Why is this? Nice error checking..

I will have to look into it further... Thx!

Cheers.. :)

<{POST_SNAPBACK}>

Thanks for the Feedback. I have never used COBOL but I know it stands For Common Bussiness Orenented Laungauge. Do you know where I can download a free version of COBOL. I would like to see what it is like even though it is probably horribly outdated. :evil:

HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.

Share this post


Link to post
Share on other sites

Thanks for the Feedback. I have never used COBOL but I know it stands For Common Bussiness Orenented Laungauge. Do you know where I can download a free version of COBOL. I would like to see what it is like even though it is probably horribly outdated.  :D

<{POST_SNAPBACK}>

COBOL is not out-dated, sad to say. It is used in the world of banking so where there is money???? :)

Here are some COBOL links to check out:

Tiny Cobol - Sourceforge.net

Listing of Cobol sites & Compilers

Cobol for GCC - Sourceforge.net

Freebyte Cobol Goodies

You will like this site most of all it has some of the above links but a lot more.. :evil:

Free Programmers Resource

Based on these links COBOL is still alive and kicking. Why you may ask? I cannot answer that question. It did have some really nice aspect when I used to use it. I have not check out any improvements it may have now days.

Have fun. If you learn something from all this, please share it.. :mad:

Cheers.. :D

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

*gets out COBAL manual printed before his birth*

umm yeah exactly like the COBAL PICTURE, except it doesn't support all of the features.

why not write a sprintf function (or do we have one, not really interested just asking)?

I keep the COBAL manual because it has great pictures of historical computer machinary, like cylinder drives, core memory, bunch card machines.

Edited by BlindWanderer

Share this post


Link to post
Share on other sites

*gets out COBAL manual printed before his birth*

umm yeah exactly like the COBAL PICTURE, except it doesn't support all of the features.

why not write a sprintf function (or do we have one, not really interested just asking)?

I keep the COBAL manual because it has great pictures of historical computer machinary, like cylinder drives, core memory, bunch card machines.

<{POST_SNAPBACK}>

Never used COBOL but maybe you could tell what extra features its Picture fucntion had and I can try to add them.

Thanks for the Feedback

-SolidSnake


HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

COBOL is not out-dated, sad to say. It is used in the world of banking so where there is money???? :)

Here are some COBOL links to check out:

Tiny Cobol - Sourceforge.net

Listing of Cobol sites & Compilers

Cobol for GCC - Sourceforge.net

Freebyte Cobol Goodies

You will like this site most of all it has some of the above links but a lot more..  :evil:

Free Programmers Resource

Based on these links COBOL is still alive and kicking. Why you may ask? I cannot answer that question. It did have some really nice aspect when I used to use it. I have not check out any improvements it may have now days.

Thanks I Will have to try these out especally to get more info about picture so i can add more features like Blind Wanderer said it had in COBOL.

Thanks.

P.S. I can't belive COBOL is still used. I thought they stopped using it in the late eighties. LOL  :D

Have fun. If you learn something from all this, please share it..  :mad:

Cheers..  :D

<{POST_SNAPBACK}>

Thanks will have to check those out. Edited by SolidSnake

HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)


HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

The new version is done. :)

Here is the header:

CODE
;===============================================================================

;

; Description: Formats a string according to the way specified by $sPicture

; Syntax: _Picture($sPicture, $sString2Format, $sAPriority = "DL", $sXPriority = "DLC")

;

; Parameter(s): $sPicture = The picture to use for formatting the string. See notes for details.

; $iNumber = The string to be formatted.

;

;

;

; Requirement(s): None

; Return Value(s): On Success - Returns a string representation of $iNumber formatted according to $sPicture

; On Failure - Returns an empty string "" if no files are found and sets @Error on errors

; @Error=1 $sPicture length is zero

; @Error=2 $sString2Format length is zero

; @Error=3 $sAPriority is invalid (must have a length of 2 and contain both an N and an L)

; @Error=4 $sXPriority is invalid (must have a length of 3 and contain an N , an L , and a C)

; @Error=5 More digit requests in $sPicture than digits in $sString2Format

; @Error=6 More letter requests in $sPicture than digits in $sString2Format

; @Error=7 "a" request failed because no more letters or digits were available

; @Error=8 "X" request failed because no more letters, digits, or numbers were available

; Author(s): SolidSnake <MetalGX91 at GMail dot com>

;

; Note(s): a capital A in $sPicture would be replaced with a numeric character from $sString2Format

; a lowercase a in $sPicture would be replaced with an alphanumeric character from $sString2Format in the precedence specified by $iAPriority

; an uppercase X in $sPicture would be replaced with an any character from $sString2Format in the precedence specified by $iXPriority

; a C in $sPicture would be replaced by a nonalphanumeric character from $sString2Format

; a slash / specified that the next character is to be taken literally and not to be replaced.

; For example _Picture("AAAC999","123ABC-") would return ABC-123

; Version : 2.0

;===============================================================================

Edit:Added a version number so it won't be confused with the older version.

Edit:Changed header to reflect my new email address. (Previous downloads 108)

PictureExample.au3

PictureUDF.au3

Edited by SolidSnake

HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.

Share this post


Link to post
Share on other sites

The new version is done.  :D

<{POST_SNAPBACK}>

Thanks for the new post. I will give it a try. Also, just as a note that you should add version numbers to your fuctions. ;-) It could be easily mistaken for your older function.

Just a thought.. :)

Cheer.. :evil:

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Thanks for the new post. I will give it a try. Also, just as a note that you should add version numbers to your fuctions. ;-) It could be easily mistaken for your older function.

Just a thought..  :)

Cheer..  :evil:

<{POST_SNAPBACK}>

Thanks for the feedback.

Will add a version number to my UDF.

Edit:Done... I added a version number to my UDF.

Edited by SolidSnake

HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.

Share this post


Link to post
Share on other sites

So, after you get done reviewing the COBOL _Picture function it would be great to see what functionality you have added.

Cheers :)

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

So, after you get done reviewing the COBOL _Picture function it would be great to see what functionality you have added.

Cheers :)

<{POST_SNAPBACK}>

Yeah. Right now it is is similar alphanumeric picture. I plan to add date picture and Number picture too. I think I might make The Alphanumeric and Numeric into one UDF but the date one will be a seperate UDF.

Thanks for the feedback.

-SolidSnake

Edited by SolidSnake

HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.

Share this post


Link to post
Share on other sites

Yeah. Right now it is is similar alphanumeric picture. I plan to add date picture and Number picture too. I think I might make The Alphanumeric and Numeric into one UDF but the date one will be a seperate UDF.

Thanks for the feedback.

-SolidSnake

<{POST_SNAPBACK}>

I like your :). Can wait to see what you come up with.. :D

Cheers.. :evil:

Share this post


Link to post
Share on other sites

I created this UDF after looking through my Computer Desktop Enclopeda when i found this article. (I can't link to it just look up picture at )http://www.computerlanguage.com/webexamples.htm

(I have the stand-alone version but its in the web version too.)

The UDF takes a number and formats it how you want it.

For example:

_Picture("(999)999-9999",2152971234)
would return (215)297-1234.

I think it's a very misleading name,even though the feature is useful. It implies some sort of graphics feature

Why not use a name that tells you what it does, like Format(), printf(), etc ??

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

I think it's a very misleading name,even though the feature is useful. It implies some sort of graphics feature

Why not use a name that tells you what it does, like Format(), printf(), etc ??

In COBOL and possibly some other langauges it also called Picture and I was just following the way other languages name it.

Thanks for the feedback.

Edited by SolidSnake

HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.

Share this post


Link to post
Share on other sites

Excellent work SolidSnake. I too was confused by the name, but I understood as soon as I saw the function. I havent messed with many other languages that have such a function, but I see where the idea came from. Excellent work.

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

Excellent work SolidSnake. I too was confused by the name, but I understood as soon as I saw the function. I havent messed with many other languages that have such a function, but I see where the idea came from. Excellent work.

JS

Thanks for the feedback.

Glad you liked the UDF.


HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.

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