-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
54 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ SetDefaultMouseSpeed, 0 | |
/* ideas section | ||
- Bei protokoll eine V*.tex suchen und die ausführen anstatt durchführung.tex etc. | ||
- oder eine regel anlegen wo das programm einmal fragt nach einer main tex datei | ||
- F5 in conemu versucht die gestartete .tex datei als pdf zu öffnen wenn vorhanden | ||
- Der update checker versucht schon am anfang runterzuladen | ||
|
@@ -32,7 +32,7 @@ inipath := A_AppData "\script_helper\" | |
FileCreateDir, %inipath% | ||
SetWorkingDir, %inipath% | ||
inifile := "optionsv2.ini" | ||
fileinstall, version.txt, %A_Temp%\cversion.txt | ||
fileinstall, version.txt, %A_Temp%\cversion.txt | ||
githubversiontxt := "https://raw.githubusercontent.com/Martin-SF/script_helper_by_Peter_Holz/master/version.txt" | ||
|
||
settingsread() | ||
|
@@ -76,7 +76,7 @@ IfMsgBox, Yes | |
return | ||
|
||
; SHORTCUT UM PDF ZU ÖFFNEN / entsprechende pdf | ||
^5:: | ||
^5:: | ||
open_c(sumatraexe,sumatrapathexe) | ||
return | ||
|
||
|
@@ -90,19 +90,19 @@ return | |
} | ||
;mehrere texteditoren durchgehen dementsprechend filepath getten modifizieren | ||
;die entsprechende methode um alle paramater zu bekommen abhängig vom texteditor machen | ||
|
||
if (winactive("ahk_exe "conemuexe)) { | ||
clearconsole(1) | ||
/* | ||
eine globale variable speichert zuletzte Datei | ||
if ("last_var hat Form V*.tex") | ||
dann wenn da öffne die V*.tex datei in sumatra | ||
*/ | ||
open_c(sumatraexe,sumatrapathexe) ;wenn scripttype tex ist dann .pdf öffnen | ||
} | ||
else if (winactive("ahk_exe atom.exe") or winactive("ahk_exe notepad++.exe") ){ | ||
try | ||
try | ||
run_line() | ||
catch e | ||
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)" | ||
|
@@ -120,10 +120,10 @@ clearconsole(a := 0){ | |
it := 30 | ||
;SendInput {control down} {right %it%} {control up} {shift down} {left} {control down} {left %it%} {shift up} {control up} {del} | ||
;mit der selektierung kein löschen mögich ... | ||
Send {control down} {right %it%} {backspace 100} {control up} | ||
;löscht nicht mit peiltasten hochgeholte befehle.... | ||
Sendinput _this got cleared by script_helper {enter} | ||
*/ | ||
if (clearmethod=0) | ||
|
@@ -136,29 +136,31 @@ clearconsole(a := 0){ | |
|
||
run_line() { | ||
global shortcut_ms, conemuexe, conemupathexe | ||
|
||
keys_save_texteditor(shortcut_ms) | ||
|
||
scriptname := get_scriptname() ;erkennung für notepad ++ nicht fertig run_line nur für atom ausgelegt | ||
scripttype := get_scripttype(scriptname) | ||
scriptfullpath := get_scriptfullpath_atom() | ||
|
||
scriptpath := trafo_scriptpath(scriptfullpath, scriptname) | ||
|
||
/* | ||
/* | ||
nach V*.tex suchen und ausführen falls da | ||
-> später mit zb. shift+f5 V*.tex ausführen | ||
*/ | ||
|
||
open_c(conemuexe, conemupathexe, scriptpath) | ||
|
||
StringReplace, scriptpath, scriptpath, :, , All | ||
scriptpath := "/" + scriptpath | ||
|
||
|
||
;nachfolgenden bereich aktiv unterstützen, dass keine fehler bei eingabe passieren | ||
|
||
;error wenn fenster gewechselt wurde | ||
if (WinGetActiveTitle() != scriptpath) ;FRAGEN OB WECHSELN ODER NICHT? | ||
SendInput cd "%scriptpath%"; ;nur wenn im title von conemu nicht ath steht ;scriptname := % """" scriptpath "/" scriptname """" | ||
|
||
SendInput %scripttype% %scriptname%{enter} ;eventl diesen befehl beim starten von conemu als parameter übergeben | ||
} | ||
|
||
|
@@ -176,7 +178,7 @@ get_scriptname() { | |
WinGetTitle, title, A | ||
if (winactive("ahk_exe atom.exe")!=0) { | ||
len_a := InStr(title, " — " ) | ||
|
||
;NewStr := SubStr(String, StartingPos [, Length]) | ||
scriptname := SubStr(title, 1 , Len_a-1) | ||
} | ||
|
@@ -185,16 +187,16 @@ get_scriptname() { | |
return | ||
keys_close_run_npp() | ||
;ControlSend, Edit1, {Alt down}f{Alt up}, Untitled - Notepad | ||
|
||
;sleep 500 | ||
t1 := title | ||
while (title<=20) | ||
while (title<=20) | ||
WinGetTitle, title, A | ||
;C:\Users\m7fel\CloudStation\C++ & AHK Projekte\Autohotkey\Skripte und Programme\sonstige Projekte\atom comemu atom\atom_latex_autorun.ahk - Notepad++ | ||
len_a := InStr(title, " - " ) | ||
len_b := InStr(title, "\" ,,StartingPos = 0) | ||
scriptname := SubStr(title, len_b+1 , Len_a-3) | ||
msgbox, % scriptname | ||
msgbox, % scriptname | ||
} else { | ||
msgbox notepad++.exe not supported yet! | ||
return | ||
|
@@ -205,36 +207,36 @@ get_scriptname() { | |
|
||
get_scripttype(scriptname) { | ||
if (InStr(scriptname, ".tex")) | ||
return "lualatex --output-directory=build" | ||
return "lualatex -output-directory=build" | ||
else if (InStr(scriptname, ".py")) | ||
return "python" | ||
else | ||
else | ||
throw Exception("script type not supported!`n`nonly .py (python) and .tex (latex)") | ||
} | ||
|
||
open_c(programexe, programpathexe, path := "") { | ||
|
||
;programme starparam übergeben : path | ||
;programme starparam übergeben : path | ||
global conemu_ms | ||
p := 0 | ||
newstarted := 0 | ||
|
||
if (InStr(programexe, "conemu")) { | ||
programpathexe .= " -here /single -run {Bash::Msys2-64}" | ||
p := 1 | ||
} | ||
|
||
/* | ||
} else | ||
} else | ||
throw Exception("unspecified program TRIED TO OPEN", -1) | ||
*/ | ||
|
||
process, exist, %programexe% | ||
if (errorlevel=0) { | ||
newstarted := 1 | ||
run, %programpathexe%, %path% | ||
WinWaitActive, ahk_exe %programexe% | ||
|
||
if (p = 1) { | ||
static title := "ConEmu 170910 [64]" | ||
c := A_TickCount | ||
|
@@ -246,7 +248,7 @@ open_c(programexe, programpathexe, path := "") { | |
} | ||
} | ||
} | ||
|
||
WinActivate, ahk_exe %programexe% ;TIMEOUTS | ||
WinWaitActive, ahk_exe %programexe% | ||
sleep 10 | ||
|
@@ -260,14 +262,14 @@ get_scriptfullpath_atom(ms := "-1") { | |
global shortcut_ms | ||
if (ms = -1) | ||
ms := shortcut_ms | ||
|
||
clipboard = ; Empty the clipboard | ||
keys_get_filedest(ms) | ||
ClipWait, 3 | ||
if ErrorLevel | ||
throw Exception("clipboard error") | ||
f_scriptfullpath := Clipboard | ||
|
||
Clipboard := clip | ||
return f_scriptfullpath | ||
} | ||
|
@@ -298,7 +300,7 @@ keys_get_filedest(ms) { | |
|
||
write_std_settings(n) { | ||
global inifile | ||
|
||
std_shortcut_waittime := 100 | ||
std_conemu_waittime := 5000 | ||
std_clearmethod := 1 | ||
|
@@ -319,49 +321,49 @@ write_std_settings(n) { | |
|
||
settingsread() { | ||
global conemupathexe, sumatrapathexe, shortcut_ms, conemu_ms, inifile, clearmethod | ||
|
||
if !FileExist(inifile) | ||
write_std_settings(0) | ||
|
||
if !FileExist(inifile) | ||
write_std_settings(0) | ||
iniread, conemupathexe, %inifile%, settings, conemu64_path_exe | ||
iniread, sumatrapathexe, %inifile%, settings, SumatraPDF_path_exe | ||
|
||
if (check_program_availability()=false) { | ||
iniwrite, %conemupathexe%, %inifile%, settings, conemu64_path_exe | ||
iniwrite, %sumatrapathexe%, %inifile%, settings, SumatraPDF_path_exe | ||
} | ||
|
||
iniread, shortcut_ms, %inifile% ,settings , shortcut_waittime ;generelle funktion ür iniread mit entsprechendem fehler | ||
if (shortcut_ms = "ERROR") | ||
write_std_settings(1) | ||
|
||
iniread, conemu_ms, %inifile% ,settings , conemu_waittime | ||
if (conemu_ms = "ERROR") | ||
if (conemu_ms = "ERROR") | ||
write_std_settings(2) | ||
|
||
iniread, clearmethod, %inifile% ,settings , clearing_method_in_conemu | ||
if (clearmethod = "ERROR") | ||
if (clearmethod = "ERROR") | ||
write_std_settings(5) | ||
|
||
} | ||
|
||
check_program_availability() { | ||
|
||
global conemupathexe, sumatrapathexe | ||
boo := true | ||
; CONEMU | ||
if (A_Is64bitOS=0) | ||
; CONEMU | ||
if (A_Is64bitOS=0) | ||
throw Exception("32-bit not supported contact [email protected] for support request`n`nProgram will exit now") | ||
|
||
if !FileExist(conemupathexe) { ;TRY benutzen für fehler in general | ||
boo := false | ||
;über WinGet, OutputVar [, Cmd, WinTitle, WinText, ExcludeTitle, ExcludeText] mit cmd := processname einfach auffordern conemu und sumatra einmal zu starten (wenn schon aktiv silent den processpath retrieven | ||
MsgBox, 32, , Please select the conemu64.exe path. `n`n(it will show a window after clicking ok) | ||
FileSelectFile, conemupathexe, 1, %conemupathexe% , select your ConEmu64.exe path., Executables (*.exe) | ||
} | ||
global conemuexe := SubStr(conemupathexe, InStr(conemupathexe, "\", false, 0, 1)+1 , strlen(conemupathexe)) | ||
|
||
;DAUERT SEHR LANGE BIS SICH DIE PROMPTS ÖFFNEN | ||
;DAUERT SEHR LANGE BIS SICH DIE PROMPTS ÖFFNEN | ||
|
||
;sumatra | ||
if !FileExist(sumatrapathexe) { | ||
|
@@ -370,9 +372,9 @@ check_program_availability() { | |
FileSelectFile, sumatrapathexe, 1, %sumatrapathexe% , select your sumatraPDF.exe path., Executables (*.exe) | ||
} | ||
global sumatraexe := SubStr(sumatrapathexe, InStr(sumatrapathexe, "\", false, 0, 1)+1 , strlen(sumatrapathexe)) | ||
|
||
;atom | ||
|
||
;npp | ||
return boo | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
[version] | ||
version = v1.0-beta_3.0.5.1 | ||
version = v1.0-beta_3.0.5.2 |