Can someone help me fix this script code? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Divvy
Posts: 25
Joined: 20 Jul 2018, 03:18

Can someone help me fix this script code?

23 Jul 2018, 04:19

Hello guys,

I have this script code created by the member GEV:

Code: Select all

#NoEnv
    #SingleInstance Force
    SetWorkingDir %A_ScriptDir%
    
    WinTitle := "Edit Model ‹ Agency — WordPress - Google Chrome:"
    
    Keys := ["#","1","2","3","4","5","6","7","8","9","0"]
    for each, key in Keys
    	Hotkey, !+%key%, Create_LV_Key, On
    
    Loop, 26
    	Hotkey, % "!+" Chr(A_Index + 64), Create_LV_Key, On
    return
    
    Create_LV_Key:
    key := SubStr(A_ThisHotkey, 0)
    Gui, destroy
    Index := ""
    text := ""
    Loop, Read, linkslist.txt
    {
    	If ((StrLen(A_LoopReadLine) = 1) && (A_LoopReadLine == key))
    	{
    		Index := A_Index
    			break
    	}
    }
    Loop, Read, linkslist.txt
    {
    	If (A_Index <= Index)
    		continue
    	If (A_LoopReadLine = "")
    		continue
    	If (StrLen(A_LoopReadLine) = 1) && (A_Index > Index)
    		break
    	text .= A_LoopReadLine "`r`n"
    }
    
    Gui, Add, ListView, r10 w400 gMyListView, domain|URL|notes
    
    Loop, parse, text, `r`n
    {
    	If (A_LoopField = "")
    		continue
    	If !InStr(A_LoopField, "://")
    		continue
    	If (SubStr(A_LoopField, 1, 2) = "- ")
    	{
    		domain := "- " . StrSplit(A_LoopField," ").2
    		URL := StrSplit(A_LoopField," ").3
    	}
    	else
    	{
    		domain := StrSplit(A_LoopField," ").1
    		URL := StrSplit(A_LoopField," ").2
    	}
    	If InStr(A_LoopField, "(")
    	{
    		note := "(" . StrSplit(A_LoopField,"(").2
    		LV_Add("", domain, URL, note)
    	}
    	else
    		LV_Add("", domain, URL)
    }
    LV_ModifyCol()  ; auto-size each column to fit its contents.
    Gui, Add, Button, Default, Send
    Gui, Show,, Send domain+URL  %key%
    return
    
    MyListView:
    	If (A_GuiEvent = "DoubleClick")
    	{
    		LV_GetText(domain, A_EventInfo, 1)
    		If SubStr(domain, 1, 2) = "- "
    			domain := SubStr(domain, 3)
    		else
    			domain := domain
    		LV_GetText(URL, A_EventInfo, 2)
    		; MsgBox, domain = "%domain%"`nURL = "%URL%"
    		WinActivate, %WinTitle%
    		WinWaitActive, %WinTitle%
    		SendInput, %domain%%A_Tab%%URL%
    	}
    return
    
    ; https://autohotkey.com/docs/commands/ListView.htm#LV_GetNext
    ButtonSend:
    	RowNumber  = 0
    	Loop
    	{
    		RowNumber  := LV_GetNext(RowNumber)  
    		If (!RowNumber )
    			Break
    		LV_GetText(domain, RowNumber, 1)
    		If SubStr(domain, 1, 2) = "- "
    			domain := SubStr(domain, 3)
    		else
    			domain := domain
    		LV_GetText(URL, RowNumber, 2)
    		; MsgBox, domain = "%domain%"`nURL = "%URL%"
    		WinActivate, %WinTitle%
    		WinWaitActive, %WinTitle%
    		SendInput, %domain%%A_Tab%%URL%
    	}
    Return
    
    Esc::
    GuiClose:
    ExitApp
These are the lines that shows after I run the script:
> Script lines most recently executed (oldest first). Press [F5] to refresh. The seconds elapsed between a line and the one after it is in parentheses to the right (if not 0). The bottommost line's elapsed time is the number of seconds since it executed.
>
> ---- C:\Users\myuser\Desktop\test.ahk
> 003: SetWorkingDir,%A_ScriptDir%
> 005: WinTitle := "Edit Model ‹ Agency — WordPress - Google Chrome:"
> 007: Keys := ["#","1","2","3","4","5","6","7","8","9","0"]
> 008: For each,key in Keys
> 009: Hotkey,!+%key%,Create_LV_Key,On
> 009: Hotkey,!+%key%,Create_LV_Key,On
> 009: Hotkey,!+%key%,Create_LV_Key,On
> 009: Hotkey,!+%key%,Create_LV_Key,On (0.03)
> 009: Hotkey,!+%key%,Create_LV_Key,On
> 009: Hotkey,!+%key%,Create_LV_Key,On
> 009: Hotkey,!+%key%,Create_LV_Key,On
> 009: Hotkey,!+%key%,Create_LV_Key,On
> 009: Hotkey,!+%key%,Create_LV_Key,On
> 009: Hotkey,!+%key%,Create_LV_Key,On
> 009: Hotkey,!+%key%,Create_LV_Key,On
> 011: Loop,26
> 012: Hotkey,"!+" Chr(A_Index + 64),Create_LV_Key,On
> 012: Hotkey,"!+" Chr(A_Index + 64),Create_LV_Key,On
> 012: Hotkey,"!+" Chr(A_Index + 64),Create_LV_Key,On
> 012: Hotkey,"!+" Chr(A_Index + 64),Create_LV_Key,On
> 012: Hotkey,"!+" Chr(A_Index + 64),Create_LV_Key,On
> 012: Hotkey,"!+" Chr(A_Index + 64),Create_LV_Key,On
> 012: Hotkey,"!+" Chr(A_Index + 64),Create_LV_Key,On
> 012: Hotkey,"!+" Chr(A_Index + 64),Create_LV_Key,On
> 012: Hotkey,"!+" Chr(A_Index + 64),Create_LV_Key,On
> 012: Hotkey,"!+" Chr(A_Index + 64),Create_LV_Key,On
> 012: Hotkey,"!+" Chr(A_Index + 64),Create_LV_Key,On
> 012: Hotkey,"!+" Chr(A_Index + 64),Create_LV_Key,On
> 012: Hotkey,"!+" Chr(A_Index + 64),Create_LV_Key,On
> 012: Hotkey,"!+" Chr(A_Index + 64),Create_LV_Key,On
> 012: Hotkey,"!+" Chr(A_Index + 64),Create_LV_Key,On
> 012: Hotkey,"!+" Chr(A_Index + 64),Create_LV_Key,On
> 012: Hotkey,"!+" Chr(A_Index + 64),Create_LV_Key,On
> 012: Hotkey,"!+" Chr(A_Index + 64),Create_LV_Key,On
> 012: Hotkey,"!+" Chr(A_Index + 64),Create_LV_Key,On
> 012: Hotkey,"!+" Chr(A_Index + 64),Create_LV_Key,On
> 012: Hotkey,"!+" Chr(A_Index + 64),Create_LV_Key,On
> 012: Hotkey,"!+" Chr(A_Index + 64),Create_LV_Key,On
> 012: Hotkey,"!+" Chr(A_Index + 64),Create_LV_Key,On
> 012: Hotkey,"!+" Chr(A_Index + 64),Create_LV_Key,On
> 012: Hotkey,"!+" Chr(A_Index + 64),Create_LV_Key,On
> 012: Hotkey,"!+" Chr(A_Index + 64),Create_LV_Key,On
> 013: Return (1.25)
>
> Press [F5] to refresh.
Any idea how to solve this code, please?
If I close the window manually, it appears again. I can't make the script run.

Initial / Related topic: https://autohotkey.com/boards/viewtopic.php?f=5&t=52385

Thank you in advance!
wolf_II
Posts: 2688
Joined: 08 Feb 2015, 20:55

Re: Can someone help me fix this script code?

23 Jul 2018, 07:04

Two points, which might not even help you:
1 - Do you expect us to make up our own linkslist.txt or are you going to post yours?
2 - When you see what you claim to see, the script is already running. "I can't make the script run" is a contradiction to the claim.

You make little sense to me.
"solve the code" what is that supposed to mean? Construct a missing txt-file, test the script, guess who ran into guess which error, debug and deliver?
wolf_II
Posts: 2688
Joined: 08 Feb 2015, 20:55

Re: Can someone help me fix this script code?

23 Jul 2018, 08:45

Please tell me if I am wrong:
You think starting the ahk file and then double clicking the green "H" in the SysTray should make some sort of GUI with ListView pop up?
No, doing that opens what you see.

To pop up the GUI, ask GEV since I have no linkslist.txt yet.
Divvy
Posts: 25
Joined: 20 Jul 2018, 03:18

Re: Can someone help me fix this script code?

23 Jul 2018, 13:19

Thank you for your response, wolf_II.

1. linkslist.txt example:
#

21domain.com http://21domain.com (note test)
666domain.com http://666domain.com

A

adomain.com http://adomain.com
artdomain.com http://artdomain.com
- artsubdomain.com http://artdomain.com
- pinksubdomain.com http://pinksubdomain.com
animedomain.com http://animedomain.com (new note test)

B

bardomain.com http://bardomain.com
birddomain.com http://birddomain.com
2. The script code that I posted is an upgrade of this one, with a solution to show domains per selected letter instead of loading full list. For example, by press Alt+Shift+letter/number to show the corresponding domain in the GUI. Screenshot of the result: http://take.ms/9Hc1g

But I can't run the script because is showing this lines:

Screenshot: http://take.ms/2W0kUi

Any idea how to solve it? :)
gregster
Posts: 9000
Joined: 30 Sep 2013, 06:48

Re: Can someone help me fix this script code?

23 Jul 2018, 13:43

But I can't run the script because is showing this lines:

Screenshot: http://take.ms/2W0kUi
But that is not an error message - it shows that your script is actually running. You are somehow evoking the list of most recently executed lines (which by default every AHK script has), either by having the command Listlines somewhere in your code or by double-clicking the icon in the systray - perhaps you found another way, I don't know, doing it automatically by your script - but do you shows us all of your script and all scripts?
Let me repeat again: this is not an error message (it is perfectly normal, but normally it won't show up without some user action) - how do actually evoke this screen? Does it show up by itself? Or, do you do something and then it appears?
Divvy
Posts: 25
Joined: 20 Jul 2018, 03:18

Re: Can someone help me fix this script code?  Topic is solved

23 Jul 2018, 14:28

gregster, thank you for your response.

GEV, the creator of the script, already solved this for me in the initial thread.

Thank you anyway :)

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: mapcarter, Marium0505 and 381 guests