Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

AutoHotkey v2 Documentation


  • Please log in to reply
37 replies to this topic
fincs
  • Moderators
  • 1662 posts
  • Last active:
  • Joined: 05 May 2007
Guest, I'd suggest you get git; that way it'll be easier for both you and Lexikos to send and receive the changes, respectively.

  • Guests
  • Last active:
  • Joined: --
@fincs: He intentado pero no sabían git. Pero Frankie dijo que iba a ayudar.

JSLover
  • Members
  • 920 posts
  • Last active: Nov 02 2012 09:54 PM
  • Joined: 20 Dec 2004
Also, Guest, can I suggest you at least use...
diff -u...or...
diff -ru...to generate your diffs? Most people prefer unified diffs.
Useful forum links: New content since: Last visitPast weekPast 2 weeks (links will show YOUR posts, not mine)

OMFG, the AutoHotkey forum is IP.board now (yuck!)...I may not be able to continue coming here (& I love AutoHotkey)...I liked phpBB, but not this...ugh...

Note...
I may not reply to any topics (specifically ones I was previously involved in), mostly cuz I can't find the ones I replied to, to continue helping, but also just cuz I can't stand the new forum...phpBB was soo perfect. This is 100% the opposite of "perfect".

I also semi-plan to start my own, phpBB-based AutoHotkey forum (or take over the old one, if he'll let me)
PM me if you're interested in a new phpBB-based forum (I need to know if anyone would use it)
How (or why) did they create the Neil Armstrong memorial site (neilarmstronginfo.com) BEFORE he died?

Frankie
  • Members
  • 2930 posts
  • Last active: Feb 05 2015 02:49 PM
  • Joined: 02 Nov 2008
I patched and pulled them. Thanks Guest.

TreeView.htm is the only one that didn't go through.
aboutscriptappsscripts
Request Video Tutorials Here or View Current Tutorials on YouTube
Any code ⇈ above ⇈ requires AutoHotkey_L to run

fincs
  • Moderators
  • 1662 posts
  • Last active:
  • Joined: 05 May 2007

@fincs: He intentado pero no sabían git. Pero Frankie dijo que iba a ayudar.

[Translation][how to use][/i] git. But Frankie said that he was going to help.]


Umm... Lexikos does use git, so I have no clue whom you're talking about.

(PS: it's bad etiquette to speak in a foreign language, even though I can understand it; besides, I prefer to be talked to in English)

  • Guests
  • Last active:
  • Joined: --
My bad, wanted to practice a bit a of Spanish. I don't understand git.
(winmerge is just about right for my level of understanding)

fincs
  • Moderators
  • 1662 posts
  • Last active:
  • Joined: 05 May 2007

My bad, wanted to practice a bit a of Spanish. I don't understand git.

Oh lol, that was it. Anyway, there are many tutorials you can read. git is really fun and useful, so I recommend you to take your time.

  • Guests
  • Last active:
  • Joined: --
I'm not sure if this is wanted/needed, but new separate pages for InStr and SubStr. Note that the examples could be improved. No patch file for all the other html pages that link the current location Functions.htm#InStr and Functions.htm#SubStr as that would be easier to do with a local search and replace (e.g. patching would be more work)

New: docs/commands/InStr.htm
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>InStr</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="../css/default.css" rel="stylesheet" type="text/css">
</head>
<body>

<h1>InStr</h1>
<p>Retrieves the position of the specified substring within a string.</p>
<pre class="Syntax">FoundPos := InStr(Haystack, Needle [, CaseSensitive = false, StartingPosition = 1, Occurrence = 1])</pre>

<h3>Parameters</h3>
<dl>

  <dt>FoundPos</dt>
  <dd><p>
  Returns the position of an occurrence of the string Needle in the string Haystack. Position 1 is the first character; this is because 0 is synonymous with "false", making it an intuitive "not found" indicator.</p>
</dd>

  <dt>Haystack</dt>
  <dd><p>The string whose content is searched.</p></dd>

  <dt>Needle</dt>
  <dd>
      <p>The string to search for.</p>
    </dd>

  <dt>CaseSensitive</dt>
  <dd>
      <p>If the parameter <em>CaseSensitive</em> is omitted or false, the search is not case sensitive (the method of insensitivity depends on <a href="StringCaseSense.htm">StringCaseSense</a>); otherwise, the case must match exactly.</p>
    </dd>

  <dt>StartingPosition</dt>
  <dd><p>If <em>StartingPosition</em> is omitted, it defaults to 1 (the beginning of <em>Haystack</em>). Otherwise, specify 2 to start at the second character, 3 to start at the third, and so on. If <em>StartingPosition</em> is beyond the length of <em>Haystack</em>.</p>
      <p>If <em>StartingPosition</em> is beyond the length of <em>Haystack</em>, 0 is returned. If <em>StartingPosition</em> is 0 or negative, the search is conducted in reverse (right-to-left) beginning at that offset from the end. Regardless of the value of <em>StartingPosition</em>, the returned position is always relative to the first character of <em>Haystack</em>.</p>
      <p>Regardless of the value of <em>StartingPosition</em>, the return value is always relative to the first character of <em>Haystack</em>. For example, the position of "abc" in "123abc789" is always 4.</p>    </dd>

  <dt>Occurrence</dt>
  <dd>
      <p>If <em>Occurrence</em> is omitted, it defaults to the first match of the <em>Needle</em> in <em>Haystack</em>. Specify 2 for <em>Occurrence</em> to return the position of the second match, 3 for the third match, etc.</p>
    </dd>

</dl>
<h3>Remarks</h3>
<p>The built-in variables <a href="../Variables.htm">%A_Space%</a> and <a href="../Variables.htm">%A_Tab%</a> contain a single space and a single tab character, respectively, which might be useful when searching for these characters alone.</p>

<h3>Related</h3>
<p><a href="RegExMatch.htm">RegExMatch()</a>, <a href="SubStr.htm">SubStr()</a>, <a href="Type.htm">Type</a>, <a href="Block.htm">Blocks</a>, <a href="Else.htm">Else</a>.</p>

<p>Common sources of text data: <a href="FileRead.htm">FileRead</a>, <a href="Download.htm">Download</a>, <a href="../misc/Clipboard.htm">Clipboard</a>, <a href="GuiControls.htm#Edit">GUI Edit controls</a>.</p>

<h3>Examples</h3>
<pre class="NoIndent">
<em>; Example 1</em>
MsgBox % InStr("123abc789","abc") <em>; Returns 4</em>

<em>; Example 2</em>
Haystack := "The Quick Brown Fox Jumps Over the Lazy Dog"
Needle := "Fox"
If InStr(Haystack, Needle)
  MsgBox, The string was found.
Else
  MsgBox, The string was not found.

<em>; Example 3</em>
Haystack := "The Quick Brown Fox Jumps Over the Lazy Dog"
Needle := "the"
MsgBox % InStr(Haystack, Needle, false, 1, 2) <em>; case insensitive search, return start position of second occurence</em>
MsgBox % InStr(Haystack, Needle, true) <em>; case sensitive search, return start position of first occurence, same result as above</em>
</pre>

</body>
</html>

New: docs/commands/SubStr.htm
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>SubStr</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="../css/default.css" rel="stylesheet" type="text/css">
</head>
<body>

<h1>SubStr</h1>
<p>Retrieves one or more characters from the specified position in a string.</p>
<pre class="Syntax">NewStr := SubStr(String, StartingPos [, Length])</pre>

<h3>Parameters</h3>
<dl>

  <dt>NewStr </dt>
  <dd><p>Copies a substring from <em>String</em> starting at <em>StartingPos</em> and proceeding rightward to include at most <em>Length</em> characters (if <em>Length</em> is omitted, it defaults to "all characters").</p></dd>

  <dt>StartingPos</dt>
  <dd><p>For <em>StartingPos</em>, specify 1 to start at the first character, 2 to start at the second, and so on (if <em>StartingPos</em> is beyond <em>String</em>'s length, an empty string is returned).
  <p>If <em>StartingPos</em> is negative, it is considered to be an offset from the end of the string. For example, -1 extracts the last character and -2 extracts the two last characters (but if <em>StartingPos</em> tries to go beyond the left end of the string, the extraction starts at the first character).</p> 
  </dd>

  <dt>Length</dt>
  <dd>
      <p><em>Length</em> is the maximum number of characters to retrieve (fewer than the maximum are retrieved whenever the remaining part of the string is too short).</p>
			<p>Specify a negative <em>Length </em>to omit that many characters from the end of the returned string (an empty string is returned if all or too many characters are omitted).</p>  
    </dd>

</dl>

<h3>Related</h3>
<p><a href="RegExMatch.htm">RegExMatch()</a>, <a href="InStr.htm">InStr()</a>, <a href="Type.htm">Type</a>, <a href="Block.htm">Blocks</a>, <a href="Else.htm">Else</a>.</p>

<p>Common sources of text data: <a href="FileRead.htm">FileRead</a>, <a href="Download.htm">Download</a>, <a href="../misc/Clipboard.htm">Clipboard</a>, <a href="GuiControls.htm#Edit">GUI Edit controls</a>.</p>

<h3>Examples</h3>
<pre class="NoIndent">
<em>; Example 1</em>
MsgBox % SubStr("123abc789", 4, 3) <em>; Returns abc</em>

<em>; Example 2</em>
String := "The Quick Brown Fox Jumps Over the Lazy Dog"
MsgBox % SubStr(String, 1, 19)  <em>; Returns "The Quick Brown Fox"</em>
MsgBox % SubStr(String, -7)  <em>; Returns "Lazy Dog"</em>
</pre>

</body>
</html>


  • Guests
  • Last active:
  • Joined: --
If the above is useful, other built-in functions that could have their own page:

[*:nkz2x5jb] FileExist()
[*:nkz2x5jb] DirExist()
[*:nkz2x5jb] StrLen()
[*:nkz2x5jb] Ord()
[*:nkz2x5jb] Chr()
[*:nkz2x5jb] Asc()
[*:nkz2x5jb] Func()
[*:nkz2x5jb] GetKeyName(Key), GetKeyVK(Key), GetKeySC(Key)
[*:nkz2x5jb] IsByRef()
[*:nkz2x5jb] IsFunc()
[*:nkz2x5jb] IsLabel()I do suggest all Match functions will remain on one page for ease of reference and use, perhaps on a new page named Math.

  • Guests
  • Last active:
  • Joined: --

TreeView.htm is the only one that didn't go through.

If you open the HTML file, you'll see that on line 53 is has a few linefeeds in the middle of the sentence

line 53: .... system has


line 56: Comctl32.dll ...

that might be it.

  • Guests
  • Last active:
  • Joined: --
There are few things that stopped me while I was writing examples for the v2 manual. [*:2ss6xuej]"Untitled - Notepad" is often used in the examples for querying a window title. I'm wondering if this could be altered with ahk_class Notepad since it is not available in many other non-English OS. However, it slightly becomes not beginner-friendly. [*:2ss6xuej]Often imaginary file paths are used in the examples such as C:\Temp\myfile.ini on the IniRead page. Since the path doesn't exist in the reader's computer, the code won't procude the expected result unless the file is created. Although it is obvious to many coders including me that the example tells "if there is such a file, this code would produce something like this," I still feel an example should unconditionally produce a recognizable result when the reader runs it. On the other hand, creating a file in the code may obscure the command usage for the added lines.

  • Guests
  • Last active:
  • Joined: --

Untitled - Notepad is often used in the examples for querying a window title.

perhaps this can be solved by adding a default comment like so
WinWait, Untitled - Notepad ; you can find this information using the Window Spy


  • Guests
  • Last active:
  • Joined: --
That won't solve the problem that the code does not run in non-English OS. Beginners would have hard time finding what information it's talking about. I strongly believe provided code examples in the manual should be self-explanatory, meaning it's better to be understood without comments.

maul.esel
  • Members
  • 790 posts
  • Last active: Jan 05 2013 09:26 PM
  • Joined: 28 Feb 2011
As for v2 and its docs, I have some questions. I hope you don't mind I post them all here, even if some go a little off-topic:
[*:83db35fn]Do you wish version information such as "as of v...", "requires AHK_L 42+", "since v..." etc. to be removed :?:
[*:83db35fn]The docs on ClipboardAll say comparison requires a traditional if. I assume this has changed?
[*:83db35fn]It's mentioned several times in the docs that UInt64's are not supported. Assuming this is still valid, would you mind to explain why?
[*:83db35fn]Will A_IsUncode be entirely removed? It's useless for v2.
[*:83db35fn]a small wish not worth an own post: I'd like DllCall-types to require quotes as every string in an expression. This would remove ambiguity, and those who don't like to use quotes could just use command-syntax.
Join the discussion on The future of AutoHotkey
Posted Image Visit me on github Posted Image
Win7 HP SP1 64bit | AHK_L U 64bit

  • Guests
  • Last active:
  • Joined: --

That won't solve the problem that the code does not run in non-English OS.

But they should be as simple a possible to illustrate its usage too. Using things like ahk_exe notepad.exe might be a good alternative as that seems noob-friendly and runs everywhere as far as I know.