Search found 26969 matches

by mikeyww
Yesterday, 15:57
Forum: Ask for Help (v2)
Topic: Cycling through an array of functions...
Replies: 1
Views: 76

Re: Cycling through an array of functions...

Hello,

Detect single, double, and triple-presses of a hotkey

If you want to preserve the value of a local variable from one function call to the next, you will probably want to use a static variable.

Cycling through an array
by mikeyww
Yesterday, 14:37
Forum: Ask for Help (v1)
Topic: The same variable cannot be used for more then one control
Replies: 11
Views: 342

Re: The same variable cannot be used for more then one control

Yes, I think that those are the right ideas to get started. Can a control ever be added twice if a Destroy command always precedes the Add? The script below shows how a specific sort of timing can throw the error even in that situation. If your user simulates this timing in relation to your script, ...
by mikeyww
Yesterday, 14:04
Forum: Ask for Help (v1)
Topic: Loop: Sequential Pixelsearch's not working
Replies: 10
Views: 215

Re: Loop: Sequential Pixelsearch's not working

I have provided all of the recommendations that I have. If they are not useful for you, then others may have some better ones! Best of luck. #Requires AutoHotkey v1.1.33.11 x1 := 0 y1 := 0 x2 := A_ScreenWidth y2 := A_ScreenHeight rgb := 0xFFFFFF CoordMode Pixel PixelSearch x, y, x1, y1, x2, y2, rgb,...
by mikeyww
Yesterday, 13:58
Forum: Ask for Help (v2)
Topic: Help with creating script: Toggle GUI indicator (On/off)
Replies: 1
Views: 43

Re: Help with creating script: Toggle GUI indicator (On/off)

If you trigger a hotkey a second time, it does not abort the first subroutine. Instead, it interrupts it. When the interrupting routine ends, the interrupted routine will resume. I did not test your script, but having an infinite loop within the subroutine complicates it. Nothing will completely bre...
by mikeyww
Yesterday, 13:46
Forum: Ask for Help (v1)
Topic: Delete all lines containing word1 and word2
Replies: 2
Views: 102

Re: Delete all lines containing word1 and word2

#Requires AutoHotkey v1.1.33.11 txt := " ( Here is a line with a lot of text. Here is a line with the word often used. This line has little content. Another line with often and much. One further line without matching words. Example line with often and much. )" word1 := "often" word2 := "much" b := ...
by mikeyww
Yesterday, 13:24
Forum: Ask for Help (v1)
Topic: The same variable cannot be used for more then one control
Replies: 11
Views: 342

Re: The same variable cannot be used for more then one control

I have already suggested that you display the MDPID, but I don't think you have done it yet. Or, also as mentioned, you can insert a single MsgBox line before the GUI control is added. You need not wonder about what will happen. You can determine it by testing! I personally would not care whether yo...
by mikeyww
Yesterday, 13:21
Forum: Ask for Help (v1)
Topic: Double IF statement always flags True
Replies: 3
Views: 110

Re: Double IF statement always flags True

Try it and see! Let everyone know! :)
by mikeyww
Yesterday, 08:55
Forum: Ask for Help (v1)
Topic: Double IF statement always flags True
Replies: 3
Views: 110

Re: Double IF statement always flags True

Hello,

The "in" syntax would not be used with an array. You would need to loop through the array elements to find a value.

Code: Select all

#Requires AutoHotkey v1.1.33.11
arr   := [1, 5]
found := False
For k, v in arr
 If (v = 5)
  found := True
MsgBox, 64, Found, % found
by mikeyww
Yesterday, 08:51
Forum: Ask for Help (v2)
Topic: Stay in effect after release of a button. Topic is solved
Replies: 2
Views: 83

Re: Stay in effect after release of a button. Topic is solved

Variables are local to functions by default. To define or change a global variable within a function, declare the variable as global within the function. Else does not apply to directives. #Requires AutoHotkey v2.0 toggle := False Ins:: { Global toggle := !toggle SoundBeep 1000 + 500 * toggle } #Hot...
by mikeyww
Yesterday, 08:36
Forum: Ask for Help (v1)
Topic: error in if
Replies: 5
Views: 229

Re: error in if

I recommend reading about expressions and If in the documentation. Ideas are below. This shows how to refer to expressions. In most situations, % is not used to refer to variables in expressions. Variable names in an expression are not enclosed in percent signs (except for pseudo-arrays and other do...
by mikeyww
Yesterday, 08:29
Forum: Ask for Help (v1)
Topic: Help with toggle function
Replies: 3
Views: 165

Re: Help with toggle function

This forum has thousands of posts with toggles. Another is below. Test in Notepad.

Code: Select all

#Requires AutoHotkey v1.1.33.11
#MaxThreadsPerHotkey 2

F3::
#If on
^F3::
on := !on
While on {
 Send {Ctrl down}{LButton down}
 Loop 8
  Sleep 225 * on
 Send {LButton up}{Ctrl up}
}
Return
#If
by mikeyww
Yesterday, 05:33
Forum: Ask for Help (v2)
Topic: MS Word, how to reset display settings to its original scale Topic is solved
Replies: 3
Views: 150

Re: MS Word, how to reset display settings to its original scale Topic is solved

Change zoom level in Microsoft Word ; This script changes zoom level in Microsoft Word #Requires AutoHotkey v2.0 #HotIf WinActive('ahk_exe WINWORD.exe') ^0:: ; CTRL-0 = Change zoom to 100% ^9:: { ; CTRL-9 = Change zoom to 110% Static wordZoom := Map( '0', 100 , '9', 110 ) oWord := ComObjActive('Wor...
by mikeyww
25 Apr 2024, 20:34
Forum: Ask for Help (v2)
Topic: trouble with shifted function to expand limited keyset. Topic is solved
Replies: 4
Views: 202

Re: trouble with shifted function to expand limited keyset. Topic is solved

You can use any hotkey to define a variable. You can then use #HotIf to evaluate its value.
by mikeyww
25 Apr 2024, 20:29
Forum: Ask for Help (v1)
Topic: Open Outlook email links in Chrome, not default browse Topic is solved
Replies: 5
Views: 361

Re: Open Outlook email links in Chrome, not default browse Topic is solved

No, I have not tested it lately. Others here may have better ideas.
by mikeyww
25 Apr 2024, 19:09
Forum: Ask for Help (v2)
Topic: trouble with shifted function to expand limited keyset. Topic is solved
Replies: 4
Views: 202

Re: trouble with shifted function to expand limited keyset. Topic is solved

Code: Select all

#Requires AutoHotkey v2.0

+c:: {
 KeyWait 'c'
 If A_PriorKey = 'c'
  SendText 'C'
}

#HotIf GetKeyState('c', 'P')
+a::SendText 'm'
#HotIf
by mikeyww
25 Apr 2024, 13:37
Forum: Ask for Help (v1)
Topic: error in if
Replies: 5
Views: 229

Re: error in if

It looks like the forum has automatically provided a link to the image instead of an attachment. I have no idea why.
by mikeyww
25 Apr 2024, 13:28
Forum: Ask for Help (v1)
Topic: Help with toggle function
Replies: 3
Views: 165

Re: Help with toggle function

Welcome to this AutoHotkey forum! If you need to trigger a hotkey while a modifier is being held, then you must do at least one of three things. Add the modifier to the hotkey. Add the wildcard to the hotkey. Use a custom combination (not usually preferred). #Requires AutoHotkey v1.1.33.11 #MaxThrea...
by mikeyww
25 Apr 2024, 13:25
Forum: Ask for Help (v1)
Topic: Get longest line's character count in multiline string
Replies: 1
Views: 177

Re: Get longest line's character count in multiline string

#Requires AutoHotkey v1.1.33.11 msg := " ( Alt+F1 - Command Hint Alt+Q - Bold+Paste F1 - Hello World F2 - This is a much longer text that might make the info box extremely long F4 - Thank you )" MsgBox 64, Length of longest line, % longestLineCharCount(msg) longestLineCharCount(str) { len := 0 For ...
by mikeyww
25 Apr 2024, 08:12
Forum: Ask for Help (v1)
Topic: Delete all lines with pipe symbol
Replies: 1
Views: 197

Re: Delete all lines with pipe symbol

Code: Select all

#Requires AutoHotkey v1.1.33.11
str := "
(
This is the first sentence
This is | the second sentence
This is the third sentence
This is the | fourth sentence.
This is the fifth sentence.
Sixth sentence.
)"
MsgBox 64, Result, % Trim(RegExReplace(str, "m`a)^.*\|.*$\R?"), " `t`r`n")
by mikeyww
25 Apr 2024, 07:55
Forum: Ask for Help (v1)
Topic: "'Non Titlebar-limited/From anywhere-within' Window Mover" Script Improvement Help
Replies: 2
Views: 132

Re: "'Non Titlebar-limited/From anywhere-within' Window Mover" Script Improvement Help

Just a comment here: I believe that the script to achieve this goal was already posted previously, so you might want to search the forum for it.

Go to advanced search