Skip to content

Commit

Permalink
using now exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin-SF committed Oct 23, 2017
1 parent 16d26aa commit 0bba4a9
Showing 1 changed file with 9 additions and 20 deletions.
29 changes: 9 additions & 20 deletions atom_latex_autorun.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ return
try
run_line()
catch e
MsgBox % "Error in " e.What ", which was called at line " e.Line "`n`nPlease contact [email protected] with this error! (unless you did not configured the program wrong) `n`n " Errorlevel
MsgBox % e.message "`n`nError in " e.What ", which was called at line " e.Line "`nPlease contact [email protected] with this error! (unless you did not configured the program wrong)"

return

Expand All @@ -62,7 +62,6 @@ run_line() {
;atom oder notepad?

if (winactive("ahk_exe atom.exe")!=0) {
;msgbox 3
len_a := InStr(title, "" )

;NewStr := SubStr(String, StartingPos [, Length])
Expand All @@ -71,7 +70,6 @@ run_line() {
else if (winactive("ahk_exe notepad++.exe")!=0) {
msgbox notepad++.exe not supported yet!
return
;msgbox 12
keys_close_run_npp()
;ControlSend, Edit1, {Alt down}f{Alt up}, Untitled - Notepad

Expand Down Expand Up @@ -116,10 +114,8 @@ get_scripttype(scriptname) {
return "lualatex"
else if (InStr(scriptname, ".py"))
return "python"
else {
msgbox script type not supported!`n`nonly .py (python) and .tex (latex)
throw Exception("script type not supported!", -1)
}
else
throw Exception("script type not supported!`n`nonly .py (python) and .tex (latex)")
}

open_c(program,path) {
Expand All @@ -138,7 +134,7 @@ open_c(program,path) {
programexe := sumatraexe
programpathexe := sumatrapathexe
} else
throw Exception("unspecified program used in variable", -1)
throw Exception("unspecified program TRIED TO OPEN", -1)

process, exist, %programexe%
if (errorlevel=0) {
Expand All @@ -152,10 +148,8 @@ open_c(program,path) {
while (title = "ConEmu 170910 [64]" or title = "conemu-msys2-64") {
WinGetTitle, title, A
;sleep 50
if (A_TickCount-c>=conemu_ms) { ;if (A_TickCount-c>=conemu_ms) {
msgbox your pc is very slow. increase conemu_waittime!
throw Exception("conemu time to low", -1) ;message wird nicht im enddialog benutzt ändern
}
if (A_TickCount-c>=conemu_ms) ;if (A_TickCount-c>=conemu_ms) {
throw Exception("your pc is very slow. increase conemu_waittime!") ;message wird nicht im enddialog benutzt ändern
}
}
}
Expand All @@ -173,10 +167,7 @@ get_scriptfullpath_for_atom() {
keys_get_filedest(shortcut_ms)
ClipWait, 1
if ErrorLevel
{
MsgBox, clipboard error
return
}
throw Exception("clipboard error")
scriptfullpath := Clipboard

Clipboard := clip
Expand Down Expand Up @@ -283,10 +274,8 @@ check_program_availability(){
}
conemuexe := SubStr(conemupathexe, InStr(conemupathexe, "\", false, 0, 1)+1 , strlen(conemupathexe))

} else {
msgbox 32-bit not supported contact [email protected] for support request`n`nProgram will exit now
exitapp
}
} else
throw Exception("32-bit not supported contact [email protected] for support request`n`nProgram will exit now")

;sumatra

Expand Down

0 comments on commit 0bba4a9

Please sign in to comment.