fincs / SciTE4AutoHotkey

SciTE distribution for AutoHotkey
https://www.autohotkey.com/scite4ahk/
333 stars 69 forks source link

"Internal error" #23

Closed cdeadlock closed 2 years ago

cdeadlock commented 8 years ago

I am trying to get Autohotkey_h v2 to work because I wanted to use multithreading https://hotkeyit.github.io/v2/

Scite4AutoHotkey gives me an "internal error. do you want to continue running without debug?" and immediately closes my debug output window so I can't even see what the problem might be.

clipboard threaded.ahk

#SingleInstance, FORCE

Gui, Add, Text,, Downloading From Youtube
Gui, +LabelMainGUI

global workers := []
Percent1 := 0
Percent2 := 0
Percent3 := 0
Percent4 := 0
Percent5 := 0
Percent6 := 0
Percent7 := 0
Percent8 := 0
Percent9 := 0
Percent10 := 0
Loop, 10
{
    Gui, Add, Progress, w300 h20 cBlue vPercent%A_Index%
    GuiControl,, Percent%A_Index%, 0
    GuiControl, Hide, Percent%A_Index%
}
Gui, Show

OnClipboardChange("ClipChanged")
Loop
{
    Sleep, 1000
    toremove := []

    for i,w in workers
    {       
        percent := w.percent
        OutputDebug %percent%       
        if w.done
        {
            toremove.Push(i)            
            if i < 11
            {
                GuiControl,, Percent%i%, 0
                GuiControl, Hide, Percent%i%                
            }
        }
        else if i < 11 && percent > 0
        {           
            if Percent%i% = 0
            {
                GuiControl, Show, Percent%i%
            }
            GuiControl,, Percent%i%, %percent%
        }
    }

    Sort toremove, N R U
    for i,v in toremove
    {       
        OutputDebug removing
        OutputDebug toremove[i]
        workers.RemoveAt(toremove[i])
    }

}
return

ClipChanged(Type){  
    FoundPos := InStr(clipboard, "https://www.youtube.com/watch" , CaseSensitive = true)
    url := clipboard    
    OutputDebug %url%
    if FoundPos
    {       
        ;Create worker thread
        Thread := ThreadObj("#include" " ytdownload.ahk", url)  
        workers.Push(Thread)        
    }
}
return

GuiClose:
ExitApp 
return
ytdownload.ahk

#SingleInstance, off
OutputDebug ytdownload
shell := ComObjCreate("WScript.Shell")
SetWorkingDir "d:\utils\youtube"
exec := Shell.Exec("d:\utils\youtube\youtube-dl.exe -a -")
url := A_Args[1]
hash := RegExReplace(url, "[^a-zA-Z0-9]", "")
readcount := 60
percent := 0
done := false
close := false

OutputDebug %url%
exec.StdIn.Write(url)
exec.StdIn.Close()

while, !exec.StdOut.AtEndOfStream
{       
    line := exec.StdOut.Read(readcount)
    RegExMatch(line, " (\d+)\.\d+`%", p)
    OutputDebug %line%
    OutputDebug percent 
    OutputDebug %p1%    
    If p1 > percent
    {
        percent := p1           
    }      
}   
done := true
while !close
{
    sleep 100
}
return
joedf commented 8 years ago

I am not sure SciTE4AHK actually supports AHK_H. Have you tried contacting @HotKeyIt directly?

HotKeyIt commented 7 years ago

It works fine for me, try this version with latest changes: https://autohotkey.com/boards/viewtopic.php?p=121305#p121305

fincs commented 2 years ago

Closing this issue due to Lexikos's debugger changes being integrated.