Jump to content

Do I have the right editor?


Recommended Posts

I downloaded AutoIT and the editor and installed both (I think). Then I ran into a couple of snags, so I have a couple of questions.

After reading JohnOne's Absolute Beginner Tutorial, I started in on 403forbidden403's AutoIT Tutorial Part 1. Now I am wondering if I have the right editor, because my screen doesn't look anything like the one in the tutorial and when I right click anywhere, I don't get the dropdown list shown.

If I click on Help | About SciTE, I see a screen that starts like this:

 

SciTE
Version 3.3.0
    Mar 30 2013 17:50:01
by Neil Hodgson.
 Updated by Jos
Check the SciTE4AutoIt3 Homepage for Updates
December 1998-March 2013.
http://www.scintilla.org
Lua scripting language by TeCGraf, PUC-Rio
    http://www.lua.org

 

Question #1: Do I have the right editor? I assume that I do since the About text says SciTE4AutoIT3, but I want to check for sure.

If I do have the right editor, is the tutorial using a different one? That tutorial is over 4 years old (May 2009). Is it too old to be useful? Is there a better tutorial?

Next, I found the Running Scripts doc on the AutoIT Documentation page. The first line reads, "When you start AutoIt you will be asked to open a script file.". So I tried to "Start AutoIT". How do I do that? I clicked on Start | Programs | AutoIT V3, but I don't see any AutoIT entry.

Question #2: How do I "start AutoIT"? I assumed that I would write a script using the editor, then execute it by double-clicking on it, after setting up the proper associations, or by assigning it to a keyboard key combination. Is there some way to "start AutoIT"? If so, how?

Next, I found the "Hello, World" tutorial. The second line of that tutorial says, "First open a folder where you wish to create the script.".

Question #3: Is there some accepted strategy for where to store the scripts? Since they are "executables", not data, I would assume that they should be stored under Program Files, right? Should I create a My Scripts subdirectory under Program FilesAutoIT3? On the other hand, they may be associated with certain sets of data and should be stored with that data.

Question #4: I am looking for something that will get me started with a simple script. For example, I would like a script that will make a copy of a file selected in Windows Explorer, then rename it to include the date & time. So for example, if the selected file is named test.txt, Then the script would make a copy and, if run today at 2:45 pm, would rename it to test.20130826 1425.txt.

Is there a tutorial that will walk me through something like that?

Thanks

I am using Office 2007 on Windows XP.

Link to comment
Share on other sites

That's a lot of questions.

I don't know what you installed, but there should be a menu entry for AutoIt. Here's the download page for AutoIt Current version. http://www.autoitscript.com/site/autoit/downloads/ There is also a link for SciTE4AutoIT3 download page. After you install you will find some very basic tutorials in the helpfile. Your scripts are not considered exes until compiled. I would not put the projects you create in program files unless you have a good reason to do this. They should go in some kind of documents folder. If you double click a script it should run without needing to be compiled. First check you have the right software.

Edited by czardas
Link to comment
Share on other sites

That's a lot of questions.

I don't know what you installed, but there should be a menu entry for AutoIt. Here's the download page for AutoIt Current version. http://www.autoitscript.com/site/autoit/downloads/ There is also a link for SciTE4AutoIT3 download page. After you install you will find some very basic tutorials in the helpfile. Your scripts are not considered exes until compiled. I would not put them in program files unless you have a good reason to do this. They should go in some kind of documents folder. If you double click a script it should run without needing to be compiled. First check you have the right software.

I was trying to be compact. Would you prefer that I put each one in a separate post?

I meant to include the names of the download files. They are:

  1. autoit-v3-setup.exe, 7.206 KB
  2. SciTE4AutoIt3.exe, 6,153 KB

Well, my "good reason" was that they are executable (not that they are exe files). I think the theory behind putting executables in a different place from the data is that executables should not get modified, so do not need to be backed up in the same way or, in the olden days, could be in a different type of storage (read only). But I'm not a purist. I was just curious as to what most experienced scripters do.

I was able to get the Hello World script to work, so I think I have the right software.

I am using Office 2007 on Windows XP.

Link to comment
Share on other sites

Hi jennifer and welcome to the forum!

Short answer to questions:

1 - If you downloaded the full editor (2ND button down from the 1ST link that czardas posted) then you have the right editor.

2 - If you execute "autoit3.exe" you will be driven to the file selection dialog.  If you select an Autoit script (.au3) it will be executed.  This is NOT how     99.99%  of user invoke Autoit. 

    Generally Autoit scripts are invoked in one of three ways:

    a - through SciTE (F5 to run script) - this is best for developement as it reports any errors

    b - dbl clicking a .au3 file if you selected that option during install

    c - running an instance of autoit3.exe with the script as a parameter (not as common as the first two)

3 - Scripts are not executables unless compiled.  A common organization is to have user level folders for all of your work (scripts and exe's both

     developement and production - whatever that might mean to you).  The reason is that if you do any upgrades or maintenance you want to have

    a vannila install envoronment.

    Much of the adhoc stuff that I do is right on the desktop using the various MACRO's available to the language.  After it is stable than I move the scripts

   or exe's to a user level folder that is not in an install directory (just my idea of organization, take it or leave it).

4 - We can easily work through a script for this after you are sure that you have the environment that czardas and I have described.

Good Luck,

kylomas

P.S. - apologies for the formatting...I suck with this editor!

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Link to comment
Share on other sites

I was trying to be compact. Would you prefer that I put each one in a separate post?

 

LOL no. It's better to keep related questions in one place.

Regarding installation of AutoIt. I have only ever downloaded it from the pages I linked to. If you want to be sure they are the same then check version numbers in file properties by right clicking the installation files. The latest stable version of AutoIt is v3.3.8.1. To be really sure they are the same, check the hash values (I would not think this to be necessary).

Regarding your development projects, I would only put completed software projects in program files. Anything under development I put in a project folder (My Scripts). If you intend to use relative paths to other items in Program Files, then maybe developing within the program files folder may be just about acceptable on XP. but It could get tricky with Win 7 / 8 - if you can do that at all. I'm not sure (because I'm still using XP ;) ).

Edited by czardas
Link to comment
Share on other sites

Hi Jennifer, welcome!

Personally I would create a Projects folder in your My Documents folder/directory.

Perhaps call it "AutoIt Projects" or just "Projects" or a sub-folder arrangement like "AutoItProjects".

I would also create a sub-folder within, for each of the programs/scripts you create, like "AutoItProjectsFirst Script".

Normally, I just go into the folder where I want to create a script, right-click anywhere blank, and select -->

New --> AutoIt Script

from your right-click context menu, providing you have that entry there.

I then right-click the script (.au3 file) and select -->

Edit Script

from your right-click context menu, providing you have that entry there.

All of which should mean you are up and working within SciTE with your script.

P.S. I normally rename my .au3 script to something suitable, before opening/editing it in SciTE the first time

(i.e. First Script.au3).

P.S.S. Another quick way, is to just create a Text file where you want your script to be, and then rename it's extension from .txt to .au3

Then start SciTE the same way as mentioned above or using Open or Open With (browsing to where you have SciTE installed).

Edited by TheSaint

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

Hi jennifer and welcome to the forum!

Short answer to questions:

1 - If you downloaded the full editor (2ND button down from the 1ST link that czardas posted) then you have the right editor.

2 - If you execute "autoit3.exe" you will be driven to the file selection dialog.  If you select an Autoit script (.au3) it will be executed.  This is NOT how     99.99%  of user invoke Autoit. 

    Generally Autoit scripts are invoked in one of three ways:

    a - through SciTE (F5 to run script) - this is best for developement as it reports any errors

    b - dbl clicking a .au3 file if you selected that option during install

    c - running an instance of autoit3.exe with the script as a parameter (not as common as the first two)

3 - Scripts are not executables unless compiled.  A common organization is to have user level folders for all of your work (scripts and exe's both

     developement and production - whatever that might mean to you).  The reason is that if you do any upgrades or maintenance you want to have

    a vannila install envoronment.

    Much of the adhoc stuff that I do is right on the desktop using the various MACRO's available to the language.  After it is stable than I move the scripts

   or exe's to a user level folder that is not in an install directory (just my idea of organization, take it or leave it).

4 - We can easily work through a script for this after you are sure that you have the environment that czardas and I have described.

Good Luck,

kylomas

P.S. - apologies for the formatting...I suck with this editor!

I don't know how to break up the quote so I can insert my comments in the middle, so I'll have to put them all here.

That all makes sense. Thanks for the F5 hint. That will be useful. I like your file organization.

I am using Office 2007 on Windows XP.

Link to comment
Share on other sites

LOL no. It's better to keep related questions in one place.

Regarding installation of AutoIt. I have only ever downloaded it from the pages I linked to. If you want to be sure they are the same then check version numbers in file properties by right clicking the installation files. The latest stable version of AutoIt is v3.3.8.1. To be really sure they are the same, check the hash values (I would not think this to be necessary).

Regarding your development projects, I would only put completed software projects in program files. Anything under development I put in a project folder (My Scripts). If you intend to use relative paths to other items in Program Files, then maybe developing within the program files folder may be just about acceptable on XP. but It could get tricky with Win 7 / 8 - if you can do that at all. I'm not sure (because I'm still using XP ;) ).

It shows v3.3.8.1, so I'm good to go. The editor does not show a version. Good suggestion on the file organization.

I am using Office 2007 on Windows XP.

Link to comment
Share on other sites

Hi Jennifer, welcome!

Personally I would create a Projects folder in your My Documents folder/directory.

Perhaps call it "AutoIt Projects" or just "Projects" or a sub-folder arrangement like "AutoItProjects".

I would also create a sub-folder within, for each of the programs/scripts you create, like "AutoItProjectsFirst Script".

Normally, I just go into the folder where I want to create a script, right-click anywhere blank, and select -->

New --> AutoIt Script

from your right-click context menu, providing you have that entry there.

I then right-click the script (.au3 file) and select -->

Edit Script

from your right-click context menu, providing you have that entry there.

All of which should mean you are up and working within SciTE with your script.

P.S. I normally rename my .au3 script to something suitable, before opening/editing it in SciTE the first time

(i.e. First Script.au3).

P.S.S. Another quick way, is to just create a Text file where you want your script to be, and then rename it's extension from .txt to .au3

Then start SciTE the same way as mentioned above or using Open or Open With (browsing to where you have SciTE installed).

Thank you for the tip on right-clicking in a blank area of the righthand Explorer panel and using the New options. That's more than worth the price of admission -- maybe even double the price. :) I can use that for Office docs, too. I wish I'd known about that years ago.

Edited by JenniferMurphy

I am using Office 2007 on Windows XP.

Link to comment
Share on other sites

As you can see, there are as many ways to do things as there are people, and then some...

Now that you have the editor going you will need something to chew on.

Your answer to #4...

#include <Constants.au3>
#include <array.au3>

local $sFiles = FileOpenDialog("Jennifer's File Open Dialog", @scriptdir & '\', "Text and Scripts (*.txt;*.au3)",5) ; file must exist and allow multi selections

if $sFiles = '' then
    ConsoleWrite('No files selected' & @LF)
    Exit
endif

msgbox( $mb_ok,'Files Selected','You choose files:' & @crlf & stringreplace($sFiles,'|',@crlf) )

; create an array of the files selected

local $aFiles = stringsplit($sFiles,'|',2)

; create a variable to hold return values

local $ret

; _arraydisplay is a debugging tool.  This will display each element of the array that you just created.
; _arraydisplay, consolewrite and msgbox are what you use to debug your scripts.

_arraydisplay($aFiles)

; next, let's iterate the array that you just created making a copy of each file in the same directory that you selected the files from with the same file name with
;  YYYY_MM_DD_hh_mm_ss appended.

; if only one file is selected than array[0] will contain the fully qualified file name (path and file)
; if multiple files are selected than array[0] will contain the path to each subsequent file

if ubound($aFiles) = 1 then ; we only have one file
    $ret = filecopy($aFiles[0],$aFiles[0] & '.' & @year & '_' & @mon & '_' & @MDAY & '_' & @hour & '_' & @min & '_' & @sec,9) ; overwrite file and create dir if required
    if $ret <> 1 then
        ConsoleWrite('File copy failed for ' & @LF & @tab & 'Source = ' & $aFiles[0] & @lf & @tab & _
            'Destination = ' & $aFiles[0] & '.' & @year & '_' & @mon & '_' & @MDAY & '_' & @hour & '_' & @min & '_' & @sec & @lf)
        Exit
    endif
    ConsoleWrite('File copy sucessfull for ' & $aFiles[0] & @LF)
    exit
endif

; we have multiple file so lets loop on the array, one copy for each element

local $path = $aFiles[0]            ;   element 0 contains the path

for $i = 1 to ubound($aFiles) - 1   ;   start at 1 because element 0 was the path only

    $ret = filecopy($path & '\' & $aFiles[$i],$path & '\' & $aFiles[$i] & '.' & @year & '_' & @mon & '_' & @MDAY & '_' & @hour & '_' & @min & '_' & @sec,9)
    if $ret <> 1 then
        ConsoleWrite('File copy failed for ' & @LF & @tab & 'Source = ' & $path & '\' & $aFiles[$i] & @lf & @tab & _
            'Destination = ' & $path & '\' & $aFiles[$i] & '.' & @year & '_' & @mon & '_' & @MDAY & '_' & @hour & '_' & @min & '_' & @sec & @lf)
        Exit
    endif
    ConsoleWrite('File copy sucessfull for ' & $path & '\' & $aFiles[$i] & @LF)

Next

Work through it using the Help file as czardas suggested.  You can run this from SciTE as discussed above.  It's bare bones and intended only as a template to get you off and running..

Good Luck,

kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

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...