Jump to content

begginer


Recommended Posts

I started using AutoIt first two days ago though I didn't have much time, therefore I am a complete begginer. I will be glad if you just answer my questions as short as possible, hopefully I will end up with better understanding :)

I came across this script of monoscout999 in an earlier post in the forum.

#include <misc.au3>                         ; Load an UDF(User-Defined-Function) lirary.
HotKeySet("{esc}", "_exit")                 ; Bind ESC Key to Func _exit()
HotKeySet("{F2}", "_StartStop")             ; Bind F2 Key to Func _StartStop()
Global $Switch = False                      ; Declare a Global variable and set it as true
Global $dll = DllOpen("user32.dll")         ; Nedeed for the _IsPressed() Func
While Not $Switch                           ; Start loop. while Shitch is False.
    Sleep(4000)                             ; random sleep don`t mather.
WEnd                                        ; Close loop.
Func _exit()                                ; Start Func proc.
    DllClose($dll)                          ; Always close your Dlls when you finish with them.
    Exit                                    ; End Script Run.
EndFunc   ;==>_exit
Func _StartStop()
    $Switch = Not $Switch                   ; Logical way to set a variable for a condition.
    consolewrite("Function = "&$Switch&@CRLF)   ; Some console output text.
    While 1                                 ; While 1 = While true = Loop forever and ever.
        If Not $Switch Then ExitLoop            ; Condition, If $switch not true then, exit bucle.
        If _IsPressed("01", $dll) Then      ; Func _IsPressed, look the help file for more info.
                                            ; 01 = left mouse click.
            Sleep(100)                      ; Sleep for avoid multiple clicks.
            Mousemove(@DesktopWidth - Mousegetpos(0),@DesktopHeight - Mousegetpos(1),0)
        EndIf
    WEnd
EndFunc   ;==>_StartStop

I'll number so it's easier to answer!

1) Shall I use the same #include command everytime? How do I know what to include?

2) What is the diffrence between Dim/Local/Global?

3) What is the use of 'consolewrite("Function = "&$Switch&@CRLF)'?

4) What does @CRLF do?

Thanks for help!

Link to comment
Share on other sites

1) Shall I use the same #include command everytime? How do I know what to include?

2) What is the diffrence between Dim/Local/Global?

3) What is the use of 'consolewrite("Function = "&$Switch&@CRLF)'?

4) What does @CRLF do?

1) The #includes contains functions in another file which are needed to run the script.

2) Link

3) To run the script in the SciTE editor press F5 or select from the menu Tools => Go. A readout should appear in the lower panel.

4) Look up Macro Reference in the help file.

Link to comment
Share on other sites

Some other links with help-full information.

include

Dim

ConsoleWrite

macros + ascii

So much help, so little time. :)

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Link to comment
Share on other sites

Mmm. ido12357.

You know anything about this #1967 ticket ?

As it seems closely related to your previous topic ...

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Link to comment
Share on other sites

3) To run the script in the SciTE editor press F5 or select from the menu Tools => Go. A readout should appear in the lower panel.

4) Look up Macro Reference in the help file.

3) I kind of lost you here. I still don't understand why did monoscout999 put this line.

4) "CR = Carriage return, LF = Line Feed' is what written in the helpfile, apparently it does not tell me much. What was the role @CRLF do in the script above?

Link to comment
Share on other sites

Is an output for personal help... i use the consolwrite when i want to check the running of a script, know the variables values, or check if the script enter in some function..

consolewrite("Function = "&$Switch&@CRLF)

consolewrite = write something in the console of SciTe.

"Function = " is a string, if you look the console you will see that string.

& is the symbol to concadenate strings with another strings or values... for ex:

$var1 = "hello i`m"
$var2 = "monoscout999"
$var3 = " And i give you the welcome to the forum."
Consolewrite($var1 & " " &$var2&$var3) ; try to run this without the " " and also remove one of the &

Run this and read the console of autoit.

..... Do it now.......

If you see the console was writen!, but if you want to make that the next time, the console write from the beggining of a new line you need to add @CRLF

Consolewrite($var1 & " " &$var2&$var3&@CRLF)

@CRLF is like a character that it means start a new line and go to the start.

I´m not sure but i think you can search the @CRLF characters in any txt document and delete. the txt will be showed in one line then.

If you read the help file from the beggining or look the links that iEvKI3gv9Wrkd41u gave, you will find this kind of things.

About what the tikets says.. is normal to happpend that. :S

EDITED

Some misspelled, and my bad english.

Edited by monoscout999
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...