Sign in to follow this  
Followers 0
CyberSlug

Improved Help File (UNofficial)

121 posts in this topic

#1 ·  Posted (edited)

I've taken it upon myself to make a few improvements to the help file.

Current version available here

Most recent news: See most recent messages as I'm tired of updating this one post B)

Feedback is encouraged :whistle: I'm mostly trying to make the help file more helpful.

Please submit:

- Features/Bugs in the current unofficial docs

- Sample code and neat tricks

Edited by CyberSlug

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites



CyberSlug,

I would be happy to do some of it...

Don't know if you saw the Context help post of Trids and the responses, but it would also be usefull to have an index in the Helpfile to be used with Editor that support this feature. I can generate the INDEX.HHK for you with a script.

I am using Frontpage for editing (WYSIWYG, Sort of :whistle: ) so could also help out with your tables.

Just let me know what I can help with..

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I will post the versions I have access to shortly, most likely just edit this one. Win2000, win2003, WinXP(done), WinME, not sure what others atm.

Stay tuned...

I used:
FileWriteLine($file, ";"&@OSType&" - "&@OSVersion&" - "&@OSBuild&" - "&@OSServicePack &" - "&@comspec & @LF)

so information is OSType - OSVersion - OSBuild - OSServicePack - Comspec
win2003 Server =WIN32_NT - WIN_XP - 3790 -  - E:\WINDOWS\system32\cmd.exe
WinXP Pro =WIN32_NT - WIN_XP - 2600 -  - C:\WINDOWS\system32\cmd.exe
Windows2000 Pro=WIN32_NT - WIN_2000 - 2195 - Service Pack 3 - C:\WINNT\system32\cmd.exe

WinME=WIN32_WINDOWS - WIN_ME - 3000 -   - C:\WINDOWS\COMMAND.COM
Win95=WIN32_WINDOWS - WIN_95 - 1111 - B - C:\WINDOWS\COMMAND.COM
Win98(sr2?)=WIN32_WINDOWS - WIN_98 - 1998 -   - C:\WINDOWS\COMMAND.COM

Had to have a few friends run it for odd versions.

Also, I think @comspec should be added in. It is available in:

envvariable | Name of the environment variable to get, e.g. "COMSPEC" or "PATH".

But I think it should be in the macro or @ sections as well, it comes in handy. Edited by scriptkitty

AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

scriptkitty: Exellent! Thank you

JdeB: Thanks--I'll let you know. I do want to ensure the file will work with Context Sensitive Help implementations for TextPad, Crimson, and other editors.

HTML Help Workshop (which Jon uses) has an index generation feature; however, it doesn't seem to work :whistle: which may explain why his help files lack an index... I need to work some more with the program.

I'll be posting a new version with sources this evening (Eastern Standard Time, USA).


Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

HTML Help Workshop (which Jon uses) has an index generation feature; however, it doesn't seem to work :whistle:  which may explain why his help files lack an index...

Indeed. What's the point of a "create index" page if it just creates a blank index. Bonkers.

Share this post


Link to post
Share on other sites

CyberSlug,

I tested the helpfile + index on Crimson and SourceEdit... See my post in Support forum.

When your editor doesn't support direct INDEX lookup but does support "Selected keyword" like TEXTPAD you could download a little utility called keyhh at http://www.keyworks.net/keyhh.htm which has that possibility.

After install use the command keyhh to open the Helpfile at the correct entry of the index by: KeyhhDir\keyhh.exe -#klink $SelWord autoit3dir\AutoIt.chm.

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Indeed.  What's the point of a "create index" page if it just creates a blank index.  Bonkers.

Jon,

thats why I build a script that reads the "Table of Contents.hhc " and creates an Index.HHC which can be included... save lots of typing!!! :whistle:

Jos

Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

One more small thing, we need to fix all the if statements: as in add the then part

Example

If Random(1, 2) = 1

  $msg = "50% Loss"

Else

  $msg = "50% Win"

Endif

Example

If Random(1, 2) = 1 then

  $msg = "50% Loss"

Else

  $msg = "50% Win"

Endif

Not to mention Random is in real need of a fix. The example would always be Win, well there is a 1-10000000000000000 chance.

Maybe it should be:

$x=Random(0, 1)
If $x < 0.5 then
  $msg = "50% Loss"
Else
  $msg = "50% Win"
Endif
msgbox(1,$msg,$x)
Edited by scriptkitty

AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

One more small thing, we need to fix all the if statements: as in add the then part

Example

Example

If Random(1, 2) = 1 then

  $msg = "50% Loss"

Else

  $msg = "50% Win"

Endif

Not to mention Random is in real need of a fix. The example would always be Win, well there is a 1-10000000000000000 chance.

Maybe it should be:

$x=Random(0, 1)
If $x < 0.5 then
  $msg = "50% Loss"
Else
  $msg = "50% Win"
Endif
msgbox(1,$msg,$x)
For Random, you might show casting it to an int. Since Jon changed how numbers work, Random returns a float now. Casting to int should make it work right again.

Share this post


Link to post
Share on other sites

True, int just drops off anything over the point. Many Random are just set at 0 to 1 by default, so this is actually more versitile.

$x=Random(0, 1)
; this gives a random number between
; 0.0000000000000000 and 1.0000000000000000
MsgBox(1,$x,"")

; this gives a random 0-10
; 0.0000000000000000 to 11.000000000000000 actually
; but hard to actually hit  11.000000000000000 exactly
; and int(10.999999999999999) is 10
$x=int(Random(0, 11))
MsgBox(1,$x,"")

$Start = InputBox("Question", "Starting Number?", "", "", -1, -1, 0, 0)
$End = InputBox("Question", "Ending Number?", "", "", -1, -1, 0, 0)
$x=int(Random($Start, $End+1))
; we add 1 because int() drops the 16 decimal places, not rounds them
MsgBox(1,$x,"",1)

Not sure what is the best way to say it


AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

CyberSlug,

Just uploaded an updated version to generate the Index.hhc to http://groups.yahoo.com/group/AutoItList/files/AU3/MISC/

It will also open all HTMfiles that end with Macros" and search for @ variables to create Index entries for them.

Also shows the compile log so it can be reviewed for errors.

Couple of remark on the current helpfile:

* missing the @cr @lf @crlf in the Macros section

* <title>AutoIt</title> in several HTM Files (is used in Search):

--> AutoItRelated.htm

--> Directory.htm

--> functions.htm

--> keywords.htm

--> SystemInfo.htm

--> TimeAndDate.htm

Jos

Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

I like the new updates.

I will look over it more. One small change is I think beginers might need a bit more info on @comspec.

@ComSpec

| returns the value of the %comspec% Windows environment variable

Maybe like this?

@ComSpec

| returns the value of the %comspec% the SPECified secondary COMmand interpreter. Primarly for command line uses.

Ex. Run(@ComSpec & " /c copy c:\test.txt c:\temp\test.txt")

I think the if..then could use a bit more definition.

Conditionally run a single line statement. (Endif not needed)

If <expression> Then statement1

;Terminates script if no command-line arguments
If $CmdLine[0] = 0 Then Exit

;traditional would be
If $CmdLine[0] = 0 Then
Exit
EndIf

Just off the top of my head.... More to come. I will look at some ways to express Command Line Parms

Comments

Line Continuation _

When I get the chance. Happy Holidays :whistle:


AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

The help file is shaping up verrry nicely .... Great work youse guys :whistle:


We have enough youth. How about a fountain of SMART?

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

Some more sample sections :whistle:

Command line params

===================

The variable $CmdLine contains command line parameters. Note the script name is not classed as a parameter, get this information with @ScriptName instead. This is of particular use for compiled AutoIt programs for use with drag and drop.

$CmdLine[0] is number of parameters

$CmdLine[1] is param 1 (after the script name)

$CmdLine[2] is param 2 etc

ex:

if $CmdLine[0]<>0 then

for $x= 1 to $CmdLine[0]

msgbox(1,"Command line "&$x, $CmdLine[$x])

Next

Else

msgbox(1,"Error","No command line values")

EndIf

Sample script to send drag and dropped files' full dos name to clipboard:

If $CmdLine[0] > 0 Then

$tmp = ""

For $i = 1 to $CmdLine[0]

$tmp = $tmp & FileGetShortName ( $CmdLine[$i]) & @CRLF

Next

ClipPut( StringTrimRight($tmp,2) )

EndIf

Comments

===================

Comments in AutoIt scripts help keep things organized. Use of ; denotes a comment.

Comments can be put as a separate line, or placed at the end of a finished function.

Comments are ignored by AutoIt.

Ex1:

run("c:\myprogram.exe") ; this runs my program

Ex2:

; this runs my program

run("c:\myprogram.exe")

Ex3:

;This is my code for finding $x

Function Func1()

msgbox(1,"X = ",$x)

EndFunc

;

;Run my Email program

Function Func2()

run("C:\Program Files\Outlook Express\Msimn.exe")

EndFunc

Line Continuation _

===================

New to AutoIt is Line Continuation. Each line of AutoIt is normally one command. Due to the length of some lines, AutoIt has a Line Continuation function. To make lines easier to read, you can use the Line Continuation. Use a space followed by _

to end the line.

Ex:

Msgbox(1,"This is my very very long box","Hi, I am a very hard to read"&" box that contains lots "&"and lots of text, I could also use several $x and things and it could get very hard to read in your editor.")

; this also works exactly the same

Msgbox(1,"This is my very very long box","Hi, _

I am a very hard to read" &" box that contains _

lots "& "and lots of text, I could also use seve _

ral $x and things and it could get very hard to _

read in your editor.")

; this is made to show you can continue lines almost anywhere,

Msgbox(1,"This is my very very long box", _

"Hi, I am a very hard to read"& _

" box that contains lots "& _

"and lots of text, I could also use several $x and things and it could get very hard to read in your editor.")

Edited by scriptkitty

AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

I'll incorporate scriptkitty's info into the next release (in a few hours)

I also need to make a few changes due to the 3.0.82 release

By the way I've discovered:

WinGetTitle works on both minimized and hidden windows.

WinGetText works on minimized but not hidden windows.

WinMove works on hidden but not minimized windows.

Got that? :whistle:


Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

I would expect WinMove not to work. The window is in an iconic state. Try this script and pay particular attention to the second message box and what coordinates it displays:

$szTitle = "Untitled - "
IF NOT(WinExists($szTitle)) THEN Run("notepad.exe")
WinShow($szTitle, "", @SW_SHOW)
WinActivate($szTitle)
WinWaitActive($szTitle)
$var = WinGetPos($szTitle)
IF UBound($var) > 0 THEN
    MsgBox(4096, "Active", "x=" & $var[0] & @LF & "y=" & $var[1])
ELSE
    MsgBox(4096, "Error", "Error")
    WinClose($szTitle)
    EXIT(-1)
ENDIF

WinShow($szTitle, "", @SW_MINIMIZE)
$var2 = WinGetPos($szTitle)
IF UBound($var2) > 0 THEN
    MsgBox(4096, "Minimized", "x=" & $var2[0] & @LF & "y=" & $var2[1])
ELSE
    MsgBox(4096, "Error", "Error")
    WinClose($szTitle)
    EXIT(-2)
ENDIF

WinShow($szTitle, "", @SW_RESTORE)
WinShow($szTitle, "", @SW_HIDE)
$var3 = WinGetPos($szTitle)
IF UBound($var3) > 0 THEN
    MsgBox(4096, "Hidden", "x=" & $var3[0] & @LF & "y=" & $var3[1])
ELSE
    MsgBox(4096, "Error", "Error")
    WinClose($szTitle)
    EXIT(-3)
ENDIF
WinClose($szTitle)
Edited by Valik

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

Larry and Valik, I'll take a look again....

JdeB: It could be quite useful to have a script that generates the function list function.htm (complete table of names and descriptions) from the htm function files..... I'd like a script that reads the top one-sentence description from the files \helpFiles\html\functions\Asc.htm thru \helpFiles\html\functions\WinWaitNotActive.htm and generates the appropriate functions.htm file. What do you think? :whistle:

Oh, and don't worry about generating macros.htm--I have it (ready to post soon) B)

Edited by CyberSlug

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

This may be good for a Au3toExe.exe help file, but I think this can handle it. :whistle:

Compiling Au3 files into self contained Exe

=======================

AutoIt3 has a small companion program so that you can compile all your script code into an executable. This allows you to create free running macros on machines that do not have AutoIt installed, and hide your work from prying eyes.

Note on use of #Include and FileInstall:

#Include acts like a C++ preprocessor command. Coneqeuently, a compiled script will be entirely self-contained (no dependencies).

The FileInstall function is designed to include files into a compiled AutoIt script. These included files can then be "extracted" during execution of the compiled script. Keep in mind that files such as images can greatly increase the size of a compiled script.

When this function is used from a non-compiled script a copy operation is performed instead (to allow for easy testing pre-compilation).

Once AutoIt is installed, you can right mouse click and choose compile. This will take your myscript.AU3 file and compile it to myscript.EXE in the same directory, with the default icon, and no Passphrase.

If you choose to run the Script to EXE Converter itself, you choose the au3 file, and where and what you wish to call the compiled exe, the icon file, and you can additionally choose a passphrase to keep your code safe from prying eyes.

You can additionally use the command line options to compile your scripts.

Aut2exe.exe /in <infile.au3> [/out <outfile.exe>][/icon <iconfile.ico>][/pass <passphrase>]

; small example program to show how to use command line options

; this will choose icon using default install and compile your au3 to Exe

$var = FileOpenDialog( "Choose an Icon.", "C:\Program Files\AutoIt3\Aut2Exe\Icons\misc\", "My Files (*.ico)", 1 + 4 )

$var=FileGetShortName ($var)

$file=FileGetShortName ($CmdLine[1])

run("C:\Program Files\AutoIt3\Aut2Exe\Aut2Exe.exe /in " & $file & " /out " & StringTrimRight($file ,3 ) & "exe /icon " & $var )

....edit Changed Choose a file to Choose an Icon.

Edited by scriptkitty

AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

#20 ·  Posted (edited)

I updated the documentation to reflect 3.0.83 changes.

Note: I didn't re-test the functions; I just took Jon's word for the changes. :whistle:

edit: I forgot ControlSend.... I'll test and add it to 3.0.83b later.

Edited by CyberSlug

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

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