Search found 6899 matches
- 24 Nov 2019, 12:43
- Forum: Scripts and Functions (v1)
- Topic: MCode4GCC -- C/C++ to MCode Generator
- Replies: 121
- Views: 53857
Re: MCode4GCC -- C/C++ to MCode Generator
AFAIK for hex it adds CRLFs and spaces, for base64 it adds CRLFs. So you might want to do something like this: vText := RTrim(vText, " `r`n") vText := StrReplace(vText, "`r`n") vText := StrReplace(vText, " ") ;vText .= "`r`n" ;add this line, if a trailing CRLF is wanted Since the raw hex/base64 flag...
- 23 Nov 2019, 21:41
- Forum: Bug Reports
- Topic: bug? Hotstring using just a colon
- Replies: 7
- Views: 3920
Re: bug? Hotstring using just a colon
Thanks Helgef. So, here are 2 examples, a one-liner and a multi-liner. MyHotstrings1() { static vDummy := Hotstring(":*::", "abc") } MyHotstrings2() { static vDummy := MyHotstrings2() Hotkey, IfWinActive, ahk_class Notepad Hotstring(":*:abc-", "Notepad") Hotkey, IfWinActive, ahk_class WordPadClass H...
- 23 Nov 2019, 19:30
- Forum: Ask for Help (v1)
- Topic: FileSelectFile - control the display view type
- Replies: 7
- Views: 1545
Re: FileSelectFile - control the display view type
Based on rommmcek's script, and the VIEW MODES section that lmstearn mentioned. Cheers. ;FileSelectFile with large icons vScriptPID := DllCall("kernel32\GetCurrentProcessId", "UInt") SetTimer, ChangeDialog, -300 FileSelectFile, vPath MsgBox, % vPath return ChangeDialog: WinWait, % "ahk_class #32770 ...
- 23 Nov 2019, 16:48
- Forum: Ask for Help (v1)
- Topic: Ceil() with precision Topic is solved
- Replies: 23
- Views: 3825
Re: Ceil() with precision Topic is solved
PS negative numbers. E.g. Ceil(2.5) = 3, Ceil(-2.5) = -2. Counterintuitively, to ceil a negative number, you remove the sign, *floor* the number, and restore the sign. Here is a test script and my current and former functions. Any feedback is welcome. ;q:: ;test Ceil function vList := "" VarSetCapac...
- 23 Nov 2019, 15:59
- Forum: Ask for Help (v1)
- Topic: want to use Hotstring but...
- Replies: 2
- Views: 462
Re: want to use Hotstring but...
Try swapping the order. Cheers.
Code: Select all
:*:+i::abc
:*:i::cde
- 22 Nov 2019, 23:40
- Forum: Ask for Help (v1)
- Topic: Simple Midi Message to Play a note Topic is solved
- Replies: 21
- Views: 4635
Re: Simple Midi Message to Play a note Topic is solved
@AHKStudent: I've clarified the post (and added some links). The script above is fine, however, MIDIOutputDevice has more functionality. @rommmcek: Nice, I like the name, SynchroSleep. @A_Perry_1984: Interesting usage. It might come in handy that the MIDI note system makes it quite easy to shift the...
- 22 Nov 2019, 16:26
- Forum: Ask for Help (v1)
- Topic: Alt-U to Ctrl-U does not work with key sequences in JetBrains Rider?
- Replies: 2
- Views: 631
Re: Alt-U to Ctrl-U does not work with key sequences in JetBrains Rider?
Some variations to try. Cheers. !u::SendInput {Alt up}^u !u::SendInput {LAlt up}^u !u::SendInput {LAlt up}{LCtrl down}u{LCtrl up} ;not as good, but useful if all else fails: !u:: KeyWait Alt SendInput ^u return Possibly #MenuMaskKey is worth looking into: #MenuMaskKey - Syntax & Usage | AutoHotkey h...
- 22 Nov 2019, 09:36
- Forum: Ask for Help (v1)
- Topic: Struggling with DLL
- Replies: 2
- Views: 1347
Re: Struggling with DLL
The key thing to do would be to look up 'DllCall FindWindow' or 'DllCall FindWindowEx', and see if anyone has written scripts using those Winapi functions. Admittedly, if you're new to AHK, you wouldn't know to lookup DllCall, and might not know that these were Winapi dll functions. ;q:: ;find windo...
- 21 Nov 2019, 22:32
- Forum: Ask for Help (v1)
- Topic: Simple Midi Message to Play a note Topic is solved
- Replies: 21
- Views: 4635
Re: Simple Midi Message to Play a note Topic is solved
Here are some basic examples: ;q:: ;MIDI play notes hModule := DllCall("kernel32\LoadLibrary", "Str","winmm", "Ptr") vDeviceID := 0, hMIDIOutputDevice := 0 if DllCall("winmm\midiOutOpen", "Ptr*",hMIDIOutputDevice, "UInt",vDeviceID, "UPtr",0, "UPtr",0, "UInt",0, "UInt") return hDev := hMIDIOutputDevi...
- 21 Nov 2019, 10:33
- Forum: Ask for Help (v1)
- Topic: Ceil() with precision Topic is solved
- Replies: 23
- Views: 3825
Re: Ceil() with precision Topic is solved
So, rounding, before flooring/ceiling, can give you more 'intuitive' results. From doing some tests, it seems best to use Round (or Format), to give you a string rounded to 15 decimal places. You can then apply RTrim to remove trailing zeros. I.e. you want to use the maximum precision to preserve th...
- 21 Nov 2019, 08:01
- Forum: Ask for Help (v1)
- Topic: Does ahk automatically load ntdll.dll? Topic is solved
- Replies: 2
- Views: 450
Re: Does ahk automatically load ntdll.dll? Topic is solved
Using this code to list functions in a dll on Windows 7: LoadPicture() from variable - AutoHotkey Community https://autohotkey.com/boards/viewtopic.php?f=5&t=39002&p=181321#p181321 kernel32.dll and ntdll.dll both contain: RtlCaptureContext RtlCaptureStackBackTrace RtlFillMemory RtlMoveMemory RtlUnwi...
- 21 Nov 2019, 02:53
- Forum: Ask for Help (v1)
- Topic: locking my screen not with Win L Topic is solved
- Replies: 21
- Views: 10888
Re: locking my screen not with Win L Topic is solved
Changing the DisableLockWorkstation value to 1, in the registry, disables the Win+L hotkey, but appears to have the side effect of disabling all means of locking the workstation. With Win+L disabled, you can choose an alternative hotkey to lock the workstation. It needs to set DisableLockWorkstation...
- 20 Nov 2019, 22:33
- Forum: Ask for Help (v1)
- Topic: Match Closest Value
- Replies: 6
- Views: 1276
Re: Match Closest Value
One thing I find useful for this sort of 'is a value within a range' task, is to use an intermediate array. You round the needle value down, and look up the rounded value in the intermediate array. By using the rounded value, you can jump to a relevant place in the list. array: 1 1.23 2 1.41 3 1.59 ...
- 20 Nov 2019, 21:32
- Forum: Ask for Help (v1)
- Topic: Code only works on ANSI-32, narrowed down where the issue is but still stuck.
- Replies: 3
- Views: 595
Re: Code only works on ANSI-32, narrowed down where the issue is but still stuck.
See more up-to-date versions of Gdip_All.ahk, where some of these problems are fixed. E.g.: https://raw.githubusercontent.com/mmikeww/AHKv2-Gdip/master/Gdip_All.ahk The data is ANSI, so you need to use StrGet with CP0. This has been done in the updated function. For reference, here the DllCall types...
- 20 Nov 2019, 19:37
- Forum: Ask for Help (v1)
- Topic: Ceil() with precision Topic is solved
- Replies: 23
- Views: 3825
Re: Ceil() with precision Topic is solved
I don't think that your function 'shouldn't be used'. It may be that it's fine for precisions of up to 5, and possibly more with some slight tweaks. So, all that would be needed is a comment stating the valid range. Although such statements can be complicated to prove. Floating-point numbers are per...
- 20 Nov 2019, 17:43
- Forum: Ask for Help (v1)
- Topic: Ceil() with precision Topic is solved
- Replies: 23
- Views: 3825
Re: Ceil() with precision Topic is solved
2 tests on your ceiling function: MsgBox, % ceiling(2.222222, 6) ;2.222223 MsgBox, % ceiling(2.2222222, 7) ;2.2222220 The issue is that SubStr is rounding to 6dp (as set by SetFormat): ;AHK v1: vNum := 2.22+0 MsgBox, % Format("{:0.17f}", vNum) ;2.22000000000000020 MsgBox, % SubStr(vNum, 1) ;2.220000...
- 20 Nov 2019, 13:14
- Forum: Ask for Help (v1)
- Topic: Ceil() with precision Topic is solved
- Replies: 23
- Views: 3825
Re: Ceil() with precision Topic is solved
@guest3456: What you're effectively doing is: MsgBox, % Ceil(222.00000000000002) ;223 And insisting that it should be 222. I.e. your function rounds before ceiling, which can be a good thing, but by what criteria. Ideally the logic for this should be fully explained (commented). In short, floating-p...
- 20 Nov 2019, 02:17
- Forum: Ask for Help (v1)
- Topic: Is there a simplified way to extract the variable?
- Replies: 4
- Views: 800
Re: Is there a simplified way to extract the variable?
For this very specific case, you could make use of logarithms to produce a one-liner: ;q:: ;report the biggest variable number that contains 1 (where each variable contains 0 or 1) Var1 := 0 Var2 := 1 Var3 := 0 vNum := Var1<<1 | Var2<<2 | Var3<<3 MsgBox, % vNum ? ("Var" Floor(Log(vNum)/Log(2))) : ""...
- 20 Nov 2019, 02:04
- Forum: Ask for Help (v1)
- Topic: Ceil() with precision Topic is solved
- Replies: 23
- Views: 3825
Re: Ceil() with precision Topic is solved
I've run your tests. It failed this one: Yunit.assert(ceiling(6.004, 1) == 6.1) because of a typo in the function, which I've fixed. For the other test that it 'failed'. It appears that the test failed, not the function. Because 2.22 when stored as a Double is bigger than 2.22, and so should round u...
- 20 Nov 2019, 01:11
- Forum: Ask for Help (v1)
- Topic: Brightness adjust via scroll wheel
- Replies: 5
- Views: 2750
Re: Brightness adjust via scroll wheel
Here are some links that might help you to write native AHK code for WmiMonitorBrightnessMethods. Windows screen brightness fine tune (autohotkey) · GitHub https://gist.github.com/krrr/3c3f1747480189dbb71f windows - How to query GetMonitorBrightness from C# - Stack Overflow https://stackoverflow.com...