Sign in to follow this  
Followers 0
omnomnom

New to autoit... please help =)

14 posts in this topic

Hey there. Basically I have known about autoit for a while but only stumbled upon how powerful it was last night.

I installed it, and have had a look around. I have a small amount of programming experience and managed to work out some stuff, and the scite editor having the pre-entered commands is helpful...

Basically, i develop basic software using the windows batch language (using other cmd line utilities to make it more powerful) and have noticed that autoit is simple enough to learn and to do what i want with it and is probably much quicker...

I was wondering if there is somewhere that i can find a list of all available commands (pressing each key and taking a look in scite is very time consuming) and if i use the #include command will that still load that module even if i have compiled it and put it on a new computer without autoit?

Many thanks!

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hey there. Basically I have known about autoit for a while but only stumbled upon how powerful it was last night.

I installed it, and have had a look around. I have a small amount of programming experience and managed to work out some stuff, and the scite editor having the pre-entered commands is helpful...

Basically, i develop basic software using the windows batch language (using other cmd line utilities to make it more powerful) and have noticed that autoit is simple enough to learn and to do what i want with it and is probably much quicker...

I was wondering if there is somewhere that i can find a list of all available commands (pressing each key and taking a look in scite is very time consuming) and if i use the #include command will that still load that module even if i have compiled it and put it on a new computer without autoit?

Many thanks!

There are many online articles from the Home Page: www.Autoitscript.com

Or

You can open the editor and press "F1"

This will open the Help File and you could select the "Index" tab for a list of all the functions.

Edited by ericnail

Share this post


Link to post
Share on other sites

There are many online articles from the Home Page: www.Autoitscript.com

Or

You can open the editor and press "F1"

This will open the Help File and you could select the "Index" tab for a list of all the functions.

Thanks...

if i were to use this code (just an example)

#Include <WinAPI.au3>
_WinAPI_FatalAppExit("Example")

if i were to compile that and put it on a different computer without autoit or any libraries installed would it work or would i have to include something? Thanks

Share this post


Link to post
Share on other sites

Thanks...

if i were to use this code (just an example)

#Include <WinAPI.au3>
_WinAPI_FatalAppExit("Example")

if i were to compile that and put it on a different computer without autoit or any libraries installed would it work or would i have to include something? Thanks

No, <> tags look for the included .au3 file in the installation included file.

Furthermore, Au3 Scripts wont work unless AutoIt is installed on the computer.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

A compiled script will run on another computer without AutoIt installed.

edit: nothing has to be 'included' either, the compiled script only is needed.

Edited by snowmaker

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

No, <> tags look for the included .au3 file in the installation included file.

Furthermore, Au3 Scripts wont work unless AutoIt is installed on the computer.

Ok thanks...

I was also wondering, can you give a sample code which would have a gui with multiple buttons and depending on which one is pressed different code is executed...

for example, i need to create something for a friend which means that when he presses the button he needs it then deletes the files specified for that button... and the same for other buttons but with different files to delete.

Many thanks :(

Share this post


Link to post
Share on other sites

...

if i were to compile that and put it on a different computer without autoit or any libraries installed would it work or would i have to include something? Thanks

A compiled script contains all includes so it will run on other computers without AutoIt installed. I guess ericnail is referring to uncompiled au3 running or compiling on a computer without AutoIt installed (omitting the SFX of AutoIt which can be portable and used on other computers where you may go).

Share this post


Link to post
Share on other sites

A compiled script contains all includes so it will run on other computers without AutoIt installed. I guess ericnail is referring to uncompiled au3 running or compiling on a computer without AutoIt installed (omitting the SFX of AutoIt which can be portable and used on other computers where you may go).

So what your saying is that script would work ok if compiled? thanks!

Do you have an answer to my previous question? :(

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Every function (including all the GUI functions) in the help file has an example.

Edited by snowmaker

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Every function (including all the GUI functions) in the help file has an example.

I understand that, however i am unsure as to which commands i would need as i can not see anything obvious such as "Button"...

Thanks

EDIT:

Whilst looking through the form creator tool, i came up with this - however i do not know to link the button to some code...

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 625, 445, 192, 124)
$Button1 = GUICtrlCreateButton("Button1", 112, 64, 169, 33, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd
Edited by omnomnom

Share this post


Link to post
Share on other sites

Add another Case to the Switch.

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            ; more code
    EndSwitch
WEnd

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

try:

While 1
    $nMsg = GUIGetMsg()
    Switch 
        Case $nMsg=$GUI_EVENT_CLOSE
            Exit
Case $nMsg=$button1
;do stuff or go to func
    EndSwitch
WEnd

Func stuff()
;some stuff to do in the function
EndFunc

you can add as many cases as you want (1 for each button) in your while loop

*edit* crap, snow beat me to it.

Edited by kaotkbliss

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

Add another Case to the Switch.

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            ; more code
    EndSwitch
WEnd

Brilliant, it works!

next step, is that i need to a few processes before deleting the files so i know they arent locked... If they are locked (for example an antivirus process) is there any way to stop them? When i have tried in the past it has failed to kill locked processes but as is expected it killed the normal processes.

Many thanks!

EDIT: I have also spent the last 5 minutes trying to work out how to goto the func i have tried such things as goto func = "funcname" and goto func("funcname") with no success... What am i doing wrong? =)

I appreciate your help, i really do :(

Edited by omnomnom

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

EDIT: I have also spent the last 5 minutes trying to work out how to goto the func i have tried such things as goto func = "funcname" and goto func("funcname") with no success... What am i doing wrong? =)

I appreciate your help, i really do :(

You could also go about it a different way. Instead of using 'Case $Button1'

You can use the opt("GuiOnEventMode",1) function.

A small Example.

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Opt("GuiOnEventMode",1)

$Form1 = GUICreate("Form1", 625, 445, 192, 124)
GuiSetOnEvent($GUI_EVENT_CLOSE,"CLOSE")

$Button1 = GUICtrlCreateButton("Button1", 112, 64, 169, 33, $WS_GROUP)
 ;use -1 for the control ID directly above it. To set up another control simply put in its ID.
 ;Example GuiCtrlSetEvent($List1,"onclick") <--onclick would be the function to execute upon clicking inside a Listbox.
GuiCtrlSetOnEvent(-1, "Button1_Click")
GUISetState(@SW_SHOW)

Func Button1_Click()
    MsgBox(0,"Button1","You pressed the button !")
EndFunc


Func CLOSE()
    GuiDelete(WinGetHandle("Form1",""))
    Exit 0
EndFunc



While 1
 sleep(100)
WEnd

You may not be able to close a process, but you may be able to suspend it which will completely halt the process from everything. It basically freezes it as a cheat engine would freeze a memory address value. I have attached the au3 file used to do it. It comes with an example. A process list will open and you click the one you want to suspend, then press F1 to suspend it. Press F2 afterward to resume.

_ProcessSuspend.au3

_ProcessSuspend.au3

Edited by blinko2008

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