AHK different on 2 identical PC's

Get help with using AutoHotkey and its commands and hotkeys
omar
Posts: 174
Joined: 22 Oct 2015, 17:56

AHK different on 2 identical PC's

20 Mar 2017, 08:39

I have latest versions on 2 laptops

I have some simple text replacements.

On one, I get carriage returns
On the other - it just doesnt work.
It's really frustrating.

I do have some workarounds - like copying the text and pasting.
But that's long winded - I have hundreds of text replacement short cuts I use.

Any suggestions why I have this problem?

Thanks
Guest

Re: AHK different on 2 identical PC's

20 Mar 2017, 08:43

Make sure you run the same versions of AutoHotkey on both systems, and ensure both systems are running the same script, especially check the encoding, Unicode or not but also which line endings your scripts have (either DOS, Unix or Mac even), having `r`n or just `n in there might make a difference. (I'm referring to DOS v UNIX etc not actually sending `r`n or `n here)

And of course post an example, perhaps you're making basis mistake(s) ;)
omar
Posts: 174
Joined: 22 Oct 2015, 17:56

Re: AHK different on 2 identical PC's

20 Mar 2017, 19:50

the code is super simple:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



It comes out: See attachedXYZ

This happens only on one machine. all others are OK.
this machine is a fast 2.8GHz machine running Windows 10.
I have the IDENTICAL machine - there the same problem doesn't happen :(

I have 2 other machines - slower - all OK there :(

REALLY frustrating :(
Guest

Re: AHK different on 2 identical PC's

21 Mar 2017, 03:32

If your issue is that there are no new line characters between "See attached" and "XYZ", then try:

Code: [Select all] [Download] GeSHi © Codebox Plus

::]ksub::

SendInput,
(
See attached{U+000D}{U+000D}{U+000D}XYZ
)

Return
omar
Posts: 174
Joined: 22 Oct 2015, 17:56

Re: AHK different on 2 identical PC's

01 May 2017, 18:15

thanks for the reply.
why would the above work?
my main problem is why the code just doesn't work the same on all pc's? :(

i really really need to be the same on all pc's.
it's crazy
i have other laptops that are slower - that work perfectly ok
there must be an answer?
nismo
Posts: 19
Joined: 22 Dec 2016, 13:57

Re: AHK different on 2 identical PC's

01 May 2017, 18:52

Maybe, just maybe, in one of the pc's you have some program or script running that interfere/block ahk...
omar
Posts: 174
Joined: 22 Oct 2015, 17:56

Re: AHK different on 2 identical PC's

01 May 2017, 20:16

@nismo
no, it works. just behaves really differently.
it's winding me up

i can't be the ONLY one suffering :(
User avatar
evilC
Posts: 3566
Joined: 27 Feb 2014, 12:30

Re: AHK different on 2 identical PC's

02 May 2017, 14:25

And you are 100% sure the AHK scripts are byte for byte identical?

ie I could make you two files that LOOKED identical in Notepad++, but were not.

eg, one could have DOS style CRLF linefeeds, and one could have UNIX style linefeeds.
omar
Posts: 174
Joined: 22 Oct 2015, 17:56

Re: AHK different on 2 identical PC's

02 May 2017, 18:24

@evilC i have 4 PC - all with dropbox. all share the same.

with the laptop in question, in the early days, i posted questions on the AHK forums asking why why why why i couldn't get carriage returns in my autotext output on a keyboard shortcut. i would post a simple script and many others would reply: hey nothing wrong with script - works fine for me?

i was using AHK on this other laptop.
super weird. :(

it's a super fast laptop 2.8 Intel Ghz with 8GB RAM. it's 64 bit windows 10 (i had the problems since windows 8).

there HAS to be an answer!
User avatar
jeeswg
Posts: 2668
Joined: 19 Dec 2016, 01:58
Location: UK

Re: AHK different on 2 identical PC's

02 May 2017, 18:39

Try things like this to inspect the text:

Code: [Select all] [Download] GeSHi © Codebox Plus

vText := StrReplace(vText, "`r", "[CR]")
vText := StrReplace(vText, "`n", "[LF]")
MsgBox, % vText


Check the key history. 'View, Key history and script info'.

Which commands have the problem, is it just SendInput?

If the issue is with the enter key try:


Check that there isn't an Enter hotkey assigned:


What programs are you sending enter to? For example if it's a one-line Edit box, enters don't work. Are you trying the same scripts on the same programs (on different PCs).

Are you using the same script editors. Do the files have the same encodings. Are you using the same versions of AutoHotkey. Admin issues relating to scripts, individual programs and the PCs generally.
User avatar
tidbit
Posts: 997
Joined: 29 Sep 2013, 17:15
Location: USA

Re: AHK different on 2 identical PC's

02 May 2017, 18:57

are you testing in the same program, and does that program have the same settings on all pc's?
like, if it's in notepad++, make sure you have told all your np++'s to accept simply "\n" and not just "\r\n".

try it in plain old boring Notepad that comes with the OS on all Windows pc's. if it works on all of those notepad.exe's, it's your other programs fault.
rawr. fear me.
*poke*
Is it December 21, 2012 yet?
omar
Posts: 174
Joined: 22 Oct 2015, 17:56

Re: AHK different on 2 identical PC's

02 May 2017, 20:17

guys, thanks for the replies
i use notepad++ on all pc's
there could well be a different setting in notepad++
but whatever the setting, surely the code should run the same

i'm using the code in a browser
like an email reply in gmail - or just tabbing through a form
i use only chrome + firefox

i will try some of the above mentioned and will reply later - just to cross those out :)
User avatar
evilC
Posts: 3566
Joined: 27 Feb 2014, 12:30

Re: AHK different on 2 identical PC's

03 May 2017, 08:21

"but whatever the setting, surely the code should run the same"
Maybe, maybe not. I am not sure on this, but I would not be surprised if, when you open a file with DOS line-endings in a copy of Notepad++ that has been set to use UNIX line-endings, that it converts the file.
This is what we are all telling you - you need to examine the contents of the string *as the code runs* to see if the code is executing with identical string content on both machines.

Your fundamental problem is a difference in how the code handles line endings.
Seeing as you are using a continuation section, the line-endings of the file *are part of the code*.
Helgef
Posts: 2404
Joined: 17 Jul 2016, 01:02
Contact:

Re: AHK different on 2 identical PC's

03 May 2017, 15:40

jeeswg wrote:Check that there isn't an Enter hotkey assigned:

Interesting idea :think:


SendInput,`n is translated to pressing and releasing the enter key. You don't send text, you send keypresses, although simulated. So if notepad++ accepts the enter key, it will make the appropriate line break. With your script, I loose one line break if I use the hotstring in the same notepad++ where the code is, because notepad++ auto completes attached with enter, eating one of the line breaks, so if your real script uses only one line break, i.e.,

then that could be the issue.

Good luck.
User avatar
jeeswg
Posts: 2668
Joined: 19 Dec 2016, 01:58
Location: UK

Re: AHK different on 2 identical PC's

03 May 2017, 16:06

@Helgef.
Haha re. 'Interesting idea'. Whenever I have a hotkey issue, it might be that a hotkey already exists, and creating a new hotkey can confirm this by causing a 'Duplicate hotkey.' error.
Helgef
Posts: 2404
Joined: 17 Jul 2016, 01:02
Contact:

Re: AHK different on 2 identical PC's

03 May 2017, 16:17

Hehe, ok, I guess it makes sense if you have really big scripts then. However, Enter:: needs the keyboard hook (I think), so the sendinput wouldn't trigger it without raising the sendlevel.

Cheers. :)
omar
Posts: 174
Joined: 22 Oct 2015, 17:56

Re: AHK different on 2 identical PC's

04 May 2017, 20:23

guys thanks for all the replies

mixed results

Code: [Select all] [Download] GeSHi © Codebox Plus

::]ksub:
SendInput,
(
See attached


XYZ
)

Return

i made this in plain boring notepad (not notepadd++)

i get output: See attachedXYZ

i know i wont get the same output on my other pcs

i tried running the code on notepad (another instance). i know from past experience that the SAME will happen in the browser.

i have code that tabs through form fields and copies them.
when run on problem pc, it runs different :(
the number of tabs are different - i tab to traverse fields

Code: [Select all] [Download] GeSHi © Codebox Plus

::]ksub:
SendInput,
(
See attached{U+000D}{U+000D}{U+000D}XYZ
)

Return

this works!!

NOW... the thing is... with the first example above... it DOES give me the newline chars!
except it put them right at the end - AND not in the place where i actually wanted :(

i tested all other suggest code:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



i added a few items above - these arent the issue. my problem occurs with the most simple version of AHK code

thanks for all the help :)
User avatar
jeeswg
Posts: 2668
Joined: 19 Dec 2016, 01:58
Location: UK

Re: AHK different on 2 identical PC's

04 May 2017, 20:43

Btw I intended my replace text code to be used like this:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



Best of luck, interesting about the enters being queued.

Btw you can write the script in Notepad, but you can also test executing the script when Notepad is the active window also, to check that the scripts are sending the same thing.
Helgef
Posts: 2404
Joined: 17 Jul 2016, 01:02
Contact:

Re: AHK different on 2 identical PC's

05 May 2017, 16:07

jeeswg wrote:Check the key history. 'View, Key history and script info'.

@omar, did you do this? See, KeyHistory.

Return to “Ask For Help”

Who is online

Users browsing this forum: No registered users and 54 guests