Search found 83 matches

by AfterLemon
13 Dec 2013, 11:26
Forum: Ask For Help
Topic: simple function works in ahk basic but not in ahk unicode
Replies: 16
Views: 4122

Re: simple function works in ahk basic but not in ahk unicod

this should also work, numbers only RemoveTrailingZeros(n){ return RegExReplace(n, "^\d?+\K(\.0*|\.\d*?\K0+)$") } Using this code (below) which is the same code I wrote my function above with as a test, yours fails. Start1:=A_TickCount ,number:=17.0023000 ,a:=RemoveTrailingZeros(number) ,number:=10...
by AfterLemon
13 Dec 2013, 11:19
Forum: Ask For Help
Topic: Suspend a script and then resume it
Replies: 3
Views: 7558

Re: Suspend a script and then resume it

Have you searched the documentation at all? Pause , which allows you to pause/unpause using hotkeys (or a couple other methods) your entire script including SetTimers, SetTimer , which can be passed an expression (to run dynamic waits), which waits for the timer to run out before running a label. [y...
by AfterLemon
13 Dec 2013, 01:08
Forum: Scripts and Functions
Topic: StrReplace(string, chars)
Replies: 18
Views: 8358

Re: StrReplace(string, chars)

Holle, they are essentially identical in use except mine uses documented associative array style instead of your undocumented style of input. With larger arrays and replacement totals, the difference becomes even more pronounced. Just an FYI. What both of us should probably include is the ability to...
by AfterLemon
12 Dec 2013, 17:54
Forum: Scripts and Functions
Topic: StrReplace(string, chars)
Replies: 18
Views: 8358

Re: StrReplace(string, chars)

I wrote a version using Arrays and Associative-array input {}. Using AHK_L this should work better/faster: Msgbox,% StrReplace2("Hello",{H:"B",o:"a"}) ; --> "Bella" Msgbox,% StrReplace2("Abcde123",{bcd:"v",1:" ",23:"Cesar"}) ; --> "Ave Cesar" StrReplace2(string,chars*){ For k,c in (chars.MaxIndex()=...
by AfterLemon
12 Dec 2013, 12:51
Forum: Ask For Help
Topic: Assigning object to the clipboard crashes Autohotkey
Replies: 7
Views: 2153

Re: Assigning object to the clipboard crashes Autohotkey

In what way can you say it is crashing? Does the script not pause? (using the last ones i gave you)

If so, then yes it is crashing. Given your scripts normally, they don't put anything into the clipboard and they aren't persistent, so they should go away immediately when they're finished.
by AfterLemon
12 Dec 2013, 10:57
Forum: Ask For Help
Topic: Array madness. What am I doing wrong?
Replies: 10
Views: 3882

Re: Array madness. What am I doing wrong?

Lexikos is saying something along the lines that these examples will describe: A=%0% ; Will contain the passed amount of parameters (which is ALSO the final var containing passed parameters) ; For example, if passing 7 parameters, %0% will contain 7 which is the last passed var %7%. A:=0 ; Simply as...
by AfterLemon
12 Dec 2013, 10:39
Forum: Ask For Help
Topic: Assigning object to the clipboard crashes Autohotkey
Replies: 7
Views: 2153

Re: Assigning object to the clipboard crashes Autohotkey

I do not have any problems with AutoHotkey crashing when I run this script: clipboard := "", clipboard := ComObjCreate("Scripting.Dictionary") ; crash ;clipboard := "", clipboard := {} ; crash pause return Nor do I have trouble with this code: clipboard := "", clipboard := fun() ClipWait, 2 pause re...
by AfterLemon
10 Dec 2013, 15:34
Forum: Ask For Help
Topic: New design ahkscript homepage - feedback appreciated Topic is solved
Replies: 51
Views: 15090

Re: New design ahkscript homepage - feedback appreciated Topic is solved

This looks amazing and I really enjoy the colours. This is what I'm looking for when I visit AutoHotkey. I miss all the links and helpful descriptions and the script examples that are everywhere online, but not shown at all. We should be proud and I think this setup stands for itself in that respect...
by AfterLemon
09 Dec 2013, 17:58
Forum: Ask For Help
Topic: simple function works in ahk basic but not in ahk unicode
Replies: 16
Views: 4122

Re: simple function works in ahk basic but not in ahk unicod

RTrim will create problems with values like 100, 1000.
by AfterLemon
06 Dec 2013, 12:32
Forum: Ask For Help
Topic: simple function works in ahk basic but not in ahk unicode
Replies: 16
Views: 4122

Re: simple function works in ahk basic but not in ahk unicod

One last post. Figured I'd give a MUCH shorter version than mine from 2 prior that still acts the same way as described in my post directly prior. I'm going to be using this one in my own scripts.

Code: Select all

TrimZeros(number){
	return (SubStr(number,1,-1)=number?RegExReplace(number,"\.?0+$"):number)
}
by AfterLemon
06 Dec 2013, 12:03
Forum: Ask For Help
Topic: simple function works in ahk basic but not in ahk unicode
Replies: 16
Views: 4122

Re: simple function works in ahk basic but not in ahk unicod

RemoveTrailingZeros(number) { Return (regexmatch(number,"\.") ? regexreplace(number,"\.?0+$") : number) } Given this code, a simple test with this: number:="1000..000" In both tests this should be seen as a string that does NOT match the number type and so should not technically be trimmed. it is 2...
by AfterLemon
06 Dec 2013, 11:58
Forum: Ask For Help
Topic: simple function works in ahk basic but not in ahk unicode
Replies: 16
Views: 4122

Re: simple function works in ahk basic but not in ahk unicod

I'm not sure why this is happening but it is making infinite recursive calls and crashes due to stack overflow. Somehow it stops passing the correct value as parameter... After the first call the "number" is read as a string and thus never matches the n-number test. Checking if the (number=trimmed ...
by AfterLemon
27 Nov 2013, 19:09
Forum: Ask For Help
Topic: if and or
Replies: 10
Views: 5691

Re: if and or

TLM wrote:PuzzledGreatly, where you not trying to see if both DIS and or STY contained text?
If so ignore AfterLemon (don't worry we do it all the time)
Updated my post to reflect the stupid mistake I made.
by AfterLemon
27 Nov 2013, 15:48
Forum: Ask For Help
Topic: There must be a better way to do this?
Replies: 2
Views: 1389

Re: There must be a better way to do this?

This code should run faster and easier than the previous mentioned. It also allows for your data to be separated as it is now. Run,C:\Users\stevehb\Desktop\Buffer.url ; Open the Bufferapp.com web site sleep,10000 ; Allow 10 seconds for the new bufferapp.com tab to open SendInput,!b ; Send the comman...
by AfterLemon
27 Nov 2013, 15:33
Forum: Ask For Help
Topic: if and or
Replies: 10
Views: 5691

Re: if and or

In actuality, both of the above recommendations for code are incorrect. TLMs solution 1 will not work due to the text being seen as a VAR in InStr() TLMs solution 2 will not work due to badly spaced and braced ternary. emmanuel ds solution will not work due to the text being seen as a VAR in InStr()...
by AfterLemon
14 Nov 2013, 15:35
Forum: Ask For Help
Topic: Gui Font Sizes on different Screens
Replies: 7
Views: 3074

Re: Gui Font Sizes on different Screens

Seeing as how DPI of 144 is 150% of normal, the normal DPI would be 96. However, since GUI font sizes are NOT controllable by pixel, your best bet is to disable DPI.
by AfterLemon
14 Nov 2013, 15:20
Forum: Ask For Help
Topic: Selecting items randoms from a list
Replies: 12
Views: 4585

Re: Selecting items randoms from a list

Accepted Inputs: Var Containing Comma-Delimited Strings Array* Max Number To output an amount of random numbers using 1-%Max% (inclusive) use: Msgbox,% RandItems(10,,30) To output array with an amount of randomized elements from another array use something like: Arr:=["blah","ahh","har","arrh","barr...
by AfterLemon
06 Nov 2013, 15:01
Forum: Scripts and Functions
Topic: True In-Line Send Sleep Function
Replies: 8
Views: 4468

Re: True In-Line Send Sleep Function

Again, your understanding of the function is flawed. In some ways the { key is a modifier. In order to see how the script is intended to work, realize that the Raw parameter must be TRUE to send "{" as a key. Send("{",1) will send "{" as a key rather than as a wrapper for keys. Send("{100}",,1) will...
by AfterLemon
06 Nov 2013, 14:04
Forum: Scripts and Functions
Topic: True In-Line Send Sleep Function
Replies: 8
Views: 4468

Re: True In-Line Send Sleep Function

Your example is flawed, HotKeyIt. If you intend to send a SLEEP, your example is correct, and the sleep (even a sleep of 0) will be performed. If you intend to send a key, this example WILL work. Input,var,L1 Send(var) Even on a multi-core machine, Sleep,0 and Sleep,10 are quite different, as per th...
by AfterLemon
06 Nov 2013, 13:22
Forum: Scripts and Functions
Topic: True In-Line Send Sleep Function
Replies: 8
Views: 4468

Re: True In-Line Send Sleep Function

While this is technically true, Verdlin, there is one difference between my implementation of the Send Sleep idea and the _H implementation. My function supports single-number sleeps (e.g. {0},{1}). This allows Sleep,0 to yield it's timeslice to other processes. AutoHotkey_H sends {0} as the 0 key. ...

Go to advanced search