Jump to content
Sign in to follow this  
Neoborn

Why is there no.....

Recommended Posts

Neoborn

I am a new user to AutoIt and I firstly want to say that it's awesome. I would like to know why there is no documetation on the syntax / how to use the @macro commands? There is awesome instruction for almost everthing else such as

RunWait ( "filename" [, "workingdir" [, flag]] )

Why is there no such thing / explanation of the macro's and how to add them into the code? Am I missing some blatantly obvious thing that everyone else here knows?

Thanks.

btw keep up the awesome job on this nice software. :):D


~Projects~1. iPod Ejector 1.0 - Tool Used To Eject iPod in Windows - Uses DevEject.exe :P2. SmartFTP Close Popup Tool - Closes reminders from freeware SmartFTP.~Helpful Links For New Users~1. LXP's Learning AutoIT PDF Guide - <<< Go here for a PDF Guide on learning AutoIT from the ground up!<<<2. AutoIt 1-2-3 <<<Want to learn more about AutoIT quickly? Go Here<<<3. How To Install The Beta And Production Versions Of AutoIT / SciteAutoIT

Share this post


Link to post
Share on other sites
Insolence

Hrm, I wonder if there is? Yep :) Just searched for it

Language Reference - Macros
AutoIt has an number of Macros that are special read-only variables used by AutoIt.  Macros start with the @ character instead of the usual $ so are easy to tell apart.  As with normal variables you can use macros in exp[b][/b]ressions but you cannot assign a value to them.

 

The pre-defined macros are generally used to provide easy access to system information like the location of the Windows directory, or the name of the logged on user.

Go here for a complete list.

That might be a bit hard to understand, here's some code:

Run("Notepad.exe", "", @SW_MAXIMIZE)
Sleep(3000)
WinSetState("Untitled -", "", @SW_HIDE)
Sleep(3000)
WinSetState("Untitled -", "", @SW_SHOW)

If you need any of that explained, lemme know :D


"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.

Share this post


Link to post
Share on other sites
Neoborn

Hrm, I wonder if there is?  Yep :)  Just searched for it

That is clearly not the same thing. A little blurb about what macros are is not the same as how to use them and the correct syntax for using them, but thank you. What it doesn't tell you is things that are only found in this forum like @macro then '&' is to be used for some reason.


~Projects~1. iPod Ejector 1.0 - Tool Used To Eject iPod in Windows - Uses DevEject.exe :P2. SmartFTP Close Popup Tool - Closes reminders from freeware SmartFTP.~Helpful Links For New Users~1. LXP's Learning AutoIT PDF Guide - <<< Go here for a PDF Guide on learning AutoIT from the ground up!<<<2. AutoIt 1-2-3 <<<Want to learn more about AutoIT quickly? Go Here<<<3. How To Install The Beta And Production Versions Of AutoIT / SciteAutoIT

Share this post


Link to post
Share on other sites
KnowledgeSponge

Alternatively, you could search for @ in the helpfile to list macros available.

Share this post


Link to post
Share on other sites
steveR

...like @macro then '&' is to be used for some reason.

The & is an operator. It concatenates/joins two strings or in this case a macro. It's covered in the help file too. The & operator isn't found only in AutoIt. It's found in other languages as well such as vbscript.

Edited by steveR

AutoIt3 online docs Use it... Know it... Live it...MSDN libraryglobal Help and SupportWindows: Just another pane in the glass.

Share this post


Link to post
Share on other sites
Insolence

That is clearly not the same thing. A little blurb about what macros are is not the same as how to use them and the correct syntax for using them, but thank you. What it doesn't tell you is things that are only found in this forum like @macro then '&' is to be used for some reason.

<{POST_SNAPBACK}>

Run("Notepad.exe", "", @SW_MAXIMIZE)
Sleep(3000)
WinSetState("Untitled -", "", @SW_HIDE)
Sleep(3000)
WinSetState("Untitled -", "", @SW_SHOW)

Did you look at that?

If you don't understand something just ask :)


"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.

Share this post


Link to post
Share on other sites
Neoborn

If you don't understand something just ask :)

I did, apparently you are having a hard time answering, let me reiterate my question for you, why isn't the macro syntax covered like every other command / statement and function?

The only instruction listed is this from the helpfile:

AutoIt has an number of Macros that are special read-only variables used by AutoIt.  Macros start with the @ character instead of the usual $ so are easy to tell apart.  As with normal variables you can use macros in expressions but you cannot assign a value to them.

The pre-defined macros are generally used to provide easy access to system information like the location of the Windows directory, or the name of the logged on user.

Edited by Neoborn

~Projects~1. iPod Ejector 1.0 - Tool Used To Eject iPod in Windows - Uses DevEject.exe :P2. SmartFTP Close Popup Tool - Closes reminders from freeware SmartFTP.~Helpful Links For New Users~1. LXP's Learning AutoIT PDF Guide - <<< Go here for a PDF Guide on learning AutoIT from the ground up!<<<2. AutoIt 1-2-3 <<<Want to learn more about AutoIT quickly? Go Here<<<3. How To Install The Beta And Production Versions Of AutoIT / SciteAutoIT

Share this post


Link to post
Share on other sites
ChazFire's REVENGE

While we are on the subject of macros, how would you show a macros in a sentence(of a msg box/input box?) I alreday know you can do

$text = InputBox ( "TITLE", "PROMT" &MACRO [, "Default" [, "password char" [, Width, Height [, Left, Top [, TimeOut]]]]] )

Yet, I would like for the macro to be displayed in the "PROMT."(and not after) Is thier a way to do this? Do i have to set the macro as a &var = macro and place the $var into it?

Edited by ChazFire's REVENGE

[font="Arial"]--------When you go to jail a friend will bve thier to bail you out, but a best friend will be sitting right next to you saying, "D*** we F**ked up!"--------A friend helps you move, but a best friend helps you move dead bodies?Which brings me to my question, what kind of friend are you?[/font]

Share this post


Link to post
Share on other sites
MHz

Just replace "PROMT" with your macro.

$text = InputBox ( "TITLE", @MACRO [, "Default" [, "password char" [, Width, Height [, Left, Top [, TimeOut]]]]] )

:)

Share this post


Link to post
Share on other sites
Valik

I did, apparently you are having a hard time answering, let me reiterate my question for you, why isn't the macro syntax covered like every other command / statement and function?

The only instruction listed is this from the helpfile:

<{POST_SNAPBACK}>

Let's break this down.

Macros start with the @ character instead of the usual $ so are easy to tell apart.

Okay, this line right here tells us the syntax. Instead of using $var, we use @macro notation according to this sentence.

As with normal variables you can use macros in expressions but you cannot assign a value to them.

Okay, so this means, anywhere I can use a variable, I can use a macro, unless I'm assigning something to a variable.

The pre-requisite for using a macro is a small understanding of how a variable works, since a macro is just a special read-only variable denoted via different syntax. Or, as the helpfile says:

AutoIt has an number of Macros that are special read-only variables used by AutoIt.

I have to say, the helpfile is quite clear on how to use a macro. It just requires stopping for a couple seconds and processing the information which was just read.

Edit: Fixed incorrect quote (copy & paste mistake).

Edited by Valik

Share this post


Link to post
Share on other sites
ChazFire's REVENGE

Just replace "PROMT" with your macro.

$text = InputBox ( "TITLE", @MACRO [, "Default" [, "password char" [, Width, Height [, Left, Top [, TimeOut]]]]] )

:)

<{POST_SNAPBACK}>

Yes, that is one way to do, and i know of that. I think i mistated or did not state clear enough of what i want to do.

$text = InputBox ( "TITLE", @MACRO [, "Default" [, "password char" [, Width, Height [, Left, Top [, TimeOut]]]]] )

Would display an input box with the macro written inside(by itself)

Where as

$text = InputBox ( "TITLE", "PROMT" &MACRO [, "Default" [, "password char" [, Width, Height [, Left, Top [, TimeOut]]]]] )

would display somthing i want to say then the macro.

I want to display somthing i want to say then the macro then more of what i want to say.

Such as, having the the inputbox display "Hello, @USERNAME. If this is...."

other words

$text = InputBox ( "TITLE", "PROMT MACRO MORE PROMT"[, "Default" [, "password char" [, Width, Height [, Left, Top [, TimeOut]]]]] )

Am I making sense? Sorry if in any way i am seeming rude.


[font="Arial"]--------When you go to jail a friend will bve thier to bail you out, but a best friend will be sitting right next to you saying, "D*** we F**ked up!"--------A friend helps you move, but a best friend helps you move dead bodies?Which brings me to my question, what kind of friend are you?[/font]

Share this post


Link to post
Share on other sites
phillip123adams

Such as, having the the inputbox display "Hello, @USERNAME. If this is...."

other words

$text = InputBox ( "TITLE", "PROMT MACRO MORE PROMT"[, "Default" [, "password char" [, Width, Height [, Left, Top [, TimeOut]]]]] )

<{POST_SNAPBACK}>

In the following, note the placement of the quotes, the &'s, and macros always begin with @. This technique is used anywhere a string is to be concatenated with another string.

$text = InputBox ( "TITLE", "some PROMT " & @someMACRO & " some MORE PROMT"[, "Default" [, "password char" [, Width, Height [, Left, Top [, TimeOut]]]]] )

For example:

$text = InputBox("Greetings", "Hello " & @username & "!  I'ts nice to see you again." & @LF & @LF & "Please enter you password:", "", "*")
MsgBox(4096, "You Password", "Your password is " & $text)
Exit

Phillip

Share this post


Link to post
Share on other sites
ChazFire's REVENGE

$text = InputBox("Greetings", "Hello " & @username & "!  I'ts nice to see you again." & @LF & @LF & "Please enter you password:", "", "*")

Ok thanks. I wasn't putting the last & in. Stupid mistakes lol.


[font="Arial"]--------When you go to jail a friend will bve thier to bail you out, but a best friend will be sitting right next to you saying, "D*** we F**ked up!"--------A friend helps you move, but a best friend helps you move dead bodies?Which brings me to my question, what kind of friend are you?[/font]

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  

×