my .ahk file doesn't work by itself, but working in codequicktester. Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
hancre
Posts: 248
Joined: 02 Jul 2021, 20:51

my .ahk file doesn't work by itself, but working in codequicktester.

03 Aug 2021, 21:44

my script for excel doesn't work by itself. BUt it works well in CodeQuickTester, an ahk editor.
How can I fix the error? I didn't add others to this file. Thanks for any help in advance.

Code: Select all

xl := ComObjActive("excel.application")
!k:: ;행을 위로 google keep 
tmp1 := xl.activecell.entirerow.value
tmp2 := xl.activecell.offset(-1,0).entirerow.value			; tmp 1 and tmp2 are safe arrays;msgbox % tmp2[1,2]
xl.activecell.offset(-1,0).entirerow.value := tmp1
xl.activecell.entirerow.value := tmp2
;~ xl.activecell.offset(-1,0).select
Return						; optional	

!l:: 
tmp1 := xl.activecell.entirerow.value
tmp2 := xl.activecell.offset(1,0).entirerow.value			; tmp 1 and tmp2 are safe arrays;msgbox % tmp2[1,2]
xl.activecell.offset(1,0).entirerow.value := tmp1
xl.activecell.entirerow.value := tmp2
;~ xl.activecell.offset(1,0).select						; optional	
Return 

!y:: 
xl.activecell.entirerow.delete
Return 

!u:: 
xl.activecell.entirerow.insert	
Return 

!x:: ;cut and delete row
tmp := xl.activecell.entirerow.value
xl.activecell.entirerow.delete
Send, {home}{right}
Send, ^{space}
Send, ^f
Return 

!v:: ; insert and paste row
xl.activecell.entirerow.insert					
xl.activecell.entirerow := tmp
Return 
gregster
Posts: 9002
Joined: 30 Sep 2013, 06:48

Re: my .ahk file doesn't work by itself, but working in codequicktester.  Topic is solved

03 Aug 2021, 21:55

CodeQuickTester uses the autohotkey*.exe interpreters from the AutoHotkey folder, afaik - so what could be different ?
Perhaps encoding... do you save your .ahk-files in UTF-8 with BOM encoding, as you probably should ? (https://www.autohotkey.com/docs/FAQ.htm#nonascii)
hancre
Posts: 248
Joined: 02 Jul 2021, 20:51

Re: my .ahk file doesn't work by itself, but working in codequicktester.

04 Aug 2021, 00:15

gregster wrote:
03 Aug 2021, 21:55
Right, encoding causes the problem.
After saving as UFT-8(BOM), I got the result. ^^

Thanks for your help. ^^

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], Joey5 and 342 guests