Page 1 of 1 1
Topic Options
#81697 - 2003-06-24 11:53 AM @TAB; new macro
creutz Offline
Fresh Scripter

Registered: 2000-06-14
Posts: 32
Loc: Helsinki, Finland
we already have the @CRLF macro, how about a @TAB macro (one wouldn´t have to do $TAB = CHR(9) in the beginning)

it would be needed for me
Creutz

[ 24. June 2003, 11:54: Message edited by: creutz ]

Top
#81698 - 2003-06-25 11:44 AM Re: @TAB; new macro
ChristopheM Offline
Hey THIS is FUN
*****

Registered: 2002-05-13
Posts: 309
Loc: STRASBOURG, France
I think it's not usefull to add many macros in the language definition. You can create a constantes file and call it in your script.

See my code below (sorry for comments in french)
I keep many variable name from vbs so translation is easier

code:
if isdeclared($ConstantesAlreadyLoaded)
return 0
endif

;-- constantes definition (messagebox) --
$vbOKOnly = 0 ;Affiche uniquement le bouton OK.
$vbOKCancel = 1 ;Affiche les boutons OK et Annuler.
$vbAbortRetryIgnore = 2 ;Affiche les boutons Abandon, Réessayer et Ignorer.
$vbYesNoCancel = 3 ;Affiche les boutons Oui, Non et Annuler.
$vbYesNo = 4 ;Affiche les boutons Oui et Non.
$vbRetryCancel = 5 ;Affiche les boutons Réessayer et Annuler.
$vbCritical = 16 ;Affiche l'icône Message critique.
$vbQuestion = 32 ;Affiche l'icône Demande d'avertissement.
$vbExclamation = 48 ;Affiche l'icône Message d'avertissement.
$vbInformation = 64 ;Affiche l'icône Message d'information.
$vbDefaultButton1 = 0 ;Le premier bouton est le bouton par défaut.
$vbDefaultButton2 = 256 ;Le deuxième bouton est le bouton par défaut.
$vbDefaultButton3 = 512 ;Le troisième bouton est le bouton par défaut.
$vbDefaultButton4 = 768 ;Le quatrième bouton est le bouton par défaut.
$vbApplicationModal = 0 ;Boîte modale pour l'application. L'utilisateur doit répondre à la boîte de message avant de poursuivre le travail dans l'application courante.
$vbSystemModal = 4096 ;Boîte modale pour le système

$vbOK = 1 ;L'utilisateur a cliqué sur OK.
$vbCancel = 2 ;L'utilisateur a cliqué sur Annuler.
$vbAbort = 3 ;L'utilisateur a cliqué sur Abandon.
$vbRetry = 4 ;L'utilisateur a cliqué sur Réessayer.
$vbIgnore = 5 ;L'utilisateur a cliqué sur Ignorer.
$vbYes = 6 ;L'utilisateur a cliqué sur Oui.
$vbNo = 7 ;L'utilisateur a cliqué sur Non.

;-- constantes definition (date) --
$vbSunday = 1 ;Dimanche
$vbMonday = 2 ;Lundi
$vbTuesday = 3 ;Mardi
$vbWednesday = 4 ;Mercredi
$vbThursday = 5 ;Jeudi
$vbFriday = 6 ;Vendredi
$vbSaturday = 7 ;Samedi
$vbUseSystemDayOfWeek = 0 ;Utilise le jour de la semaine spécifié dans les paramètres régionaux de votre système pour le premier jour de la semaine.
$vbFirstJan1 = 1 ;Utilise la semaine dans laquelle tombe le 1er janvier (par défaut).
$vbFirstFourDays = 2 ;Utilise la première semaine comportant au moins quatre jours dans la nouvelle année.
$vbFirstFullWeek = 3 ;Utilise la première semaine complète de l'année.

;-- constantes definition (string) --
$vbCr = Chr(13) ; Retour chariot.
$VbCrLf = @crlf ; Combinaison de retour chariot et de saut de ligne.
$vbFormFeed = Chr(12) ; Saut de page ; pas pratique dans Microsoft Windows.
$vbLf = Chr(10) ; Saut de ligne.
$vbNewLine = @crlf ; Caractère de nouvelle ligne spécifique à la plate-forme ; adapté à celle-ci.
$vbNullChar = Chr(0) ; Caractère ayant la valeur 0.
$vbNullString = Nothing ; Chaîne ayant la valeur 0. Différent d'une chaîne de longueur nulle ("") ; utilisé pour l'appel de procédures externes.
$vbTab = Chr(9) ; Tabulation horizontale.
$vbVerticalTab = Chr(11) ; Tabulation verticale ; non utilisée dans Microsoft Windows.

;-- constantes definition (general) --
$vbUseDefault = -2 ; Utiliser la valeur par défaut des paramètres régionaux.
$vbTrue = -1 ; True
$vbFalse = 0 ; False

;-- constantes definition (datatype) --
$vbEmpty = 0 ; Non initialisé (par défaut)
$vbNull = 1 ; Ne contient pas de données valides
$vbInteger = 2 ; Sous-type Integer
$vbLong = 3 ; Sous-type Long
$vbSingle = 4 ; Sous-type Single
$vbDouble = 5 ; Sous-type Double
$vbCurrency = 6 ; Sous-type Currency
$vbDate = 7 ; Sous-type Date
$vbString = 8 ; Sous-type String
$vbObject = 9 ; Objet
$vbError = 10 ; Sous-type Error
$vbBoolean = 11 ; Sous-type Boolean
$vbVariant = 12 ; Variant (utilisé uniquement pour les tableaux de données de type Variant)
$vbDataObject = 13 ; Objet d'accès aux données
$vbDecimal = 14 ; Sous-type Decimal
$vbByte = 17 ; Sous-type Byte
$vbArray = 8192 ; Tableau

;-- constantes definition (file attribute) --
$vbReadOnly = 1 ; The file or directory is read-only. Applications can read the file but cannot write to it or delete it. In the case of a directory, applications cannot delete it.
$vbHidden = 2 ; The file or directory is hidden. It is not included in an ordinary directory listing.
$vbSystem = 4 ; The file or directory is part of, or is used exclusively by, the operating system.
$vbDirectory = 16 ; The filename identifies a directory.
$vbArchive = 32 ; The file or directory is an archive file or directory. Applications use this attribute to mark files for backup or removal.
$vbEncrypted = 64 ; The file or directory is encrypted. For a file, this means that all data streams are encrypted. For a directory, this means that encryption is the default for newly created files and subdirectories.
$vbNormal = 128 ; The file or directory has no other attributes set. This attribute is valid only if used alone.
$vbTemporary = 256 ; The file is being used for temporary storage. File systems attempt to keep all of the data in memory for quicker access rather than flushing the data back to mass storage. A temporary file should be deleted by the application as soon as it is no longer needed.
$vbSparseFile = 512 ; The file is a sparse file.
$vbReparsePoint = 1024 ; The file has an associated reparse point.
$vbCompressed = 2048 ; The file or directory is compressed. For a file, this means that all of the data in the file is compressed. For a directory, this means that compression is the default for newly created files and subdirectories.
$vbOffline = 4096 ; The data of the file is not immediately available. Indicates that the file data has been physically moved to offline storage.


;-- constantes definition (logevent type) --
$vblogeventSuccess = 0
$vblogeventError = 1
$vblogeventWarning = 2
$vblogeventInformation = 4
$vblogeventAuditSuccess = 8
$vblogeventAuditFailure = 16


;-- constantes definition (openfile) --
$vbOpen = 0 ; If the file does not exist, Open( ) fails with return code 2 (default).
$vbCreate = 1 ; If the file does not exist, Open( ) will create a new file.
$vbForReading = 2 ; Opens the file for read access (default).
$vbForWriting = 4 ; Opens the file for write access.

;-- constantes definition (system state) --
$vbSystemLock = 0 ; Lock system (only supported on Windows 2000 or newer)
$vbSystemStandBy = 1 ; Standby
$vbSystemHibernate = 2 ; Hibernate
$vbSystemPowerOff = 3 ; Power Off


$ConstantesAlreadyLoaded = 1
return 0

_________________________
Christophe

Top
#81699 - 2003-06-25 02:39 PM Re: @TAB; new macro
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Yes, I would vote against the macro. Not worth the bloat to save 2 keystrokes.
@TAB = 4
CHR(9) = 6
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#81700 - 2003-06-25 03:53 PM Re: @TAB; new macro
creutz Offline
Fresh Scripter

Registered: 2000-06-14
Posts: 32
Loc: Helsinki, Finland
ok, I give up
No need for a TAB macro

Christophe had a good enough solution

thanks anyhow
Creutz

Top
#81701 - 2003-06-26 04:52 PM Re: @TAB; new macro
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
hmm...
indeed, you can even type it:
$tab="	"


the difference with crlf is that you can't actually type it in your script (kix strips the CR then as it's not needed [LF is sufficient]) and it's shorthand for the little tricky "end-of-line" spec by MS for text-files.

indeed, the case is more than different.
thanks for the suggestion though... [Wink]
_________________________
!

download KiXnet

Top
#81702 - 2003-06-26 05:07 PM Re: @TAB; new macro
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
I dont know, I kinda like the idea of an @TAB macro, couple of other macros too. Pretty sure they wouldn't add any bloat. Other languages have them AFIAK and makes the code more readable.
Top
#81703 - 2003-06-26 06:41 PM Re: @TAB; new macro
creutz Offline
Fresh Scripter

Registered: 2000-06-14
Posts: 32
Loc: Helsinki, Finland
Yes Shawn, that was why I was asking for the macro, other languages have them, but on the other hand Christophers suggestion was so simple and could be developed further so I settle for that.

Creutz

Top
#81704 - 2003-06-26 06:57 PM Re: @TAB; new macro
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
What about @NOW? In VB, it shows both @TIME and @DATE together.

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#81705 - 2003-06-26 07:09 PM Re: @TAB; new macro
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
or even @commandline [Big Grin]
_________________________
!

download KiXnet

Top
Page 1 of 1 1


Moderator:  Lonkero, ShaneEP, Jochen, Radimus, Glenn Barnas, Allen, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 259 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.057 seconds in which 0.024 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org