Guest Posted March 24, 2012 Posted March 24, 2012 (edited) Here is my latest project, It is a simple code editor that supports all text formats. It will execute batch directly and will also execute maths. It also has the simple feature of shellexecute (POINTLESS!) 1 error I found was that I dont know how to tell if the script* has been saved so it has to ask the user I need to know that for executing batch where the file (if saved/opened) is executed using 'Run($location)' GOTO bottom for latest version Edit*:----the script made in the program. not the code for the program. expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> GUICreate("Script", 600, 400) GUISetState(@SW_SHOW) HotKeySet("{F5}", "execute1") HotKeySet("{F4}", "shellexecute1") HotKeySet("{F3}", "Executebatch1") GUICtrlCreateLabel("F3 Execute Batch, F4 ShellExecute, F5 Execute Math", 10, 10) $edit = GUICtrlCreateEdit("", 4, 54, 594, 343) $save = GUICtrlCreateButton("Save", 74, 30, 70, 20) $new = GUICtrlCreateButton("New", 144, 30, 70, 20) $stop = GUICtrlCreateButton("Exit", 4, 30, 70, 20) $open = GUICtrlCreateButton("Open", 214, 30, 70, 20) $help = GUICtrlCreateButton("Info", 284, 30, 70, 20) $progress = GUICtrlCreateProgress(370, 29, 220, 22) Func execute1() $executeans = Execute(GUICtrlRead($edit)) MsgBox("", "", $executeans) EndFunc ;==>execute1 Func shellexecute1() ShellExecute(GUICtrlRead($edit)) EndFunc ;==>shellexecute1 Func Executebatch1() $saveyn = MsgBox(4, "", "Have you saved?") If $saveyn = 6 Then Run($location) Else MsgBox(48, "Warning", "Save before executing batch!") EndIf EndFunc ;==>Executebatch1 While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop Select Case $msg = $help MsgBox(64, "Editor", "By James B") Case $msg = $open $openfile = FileOpenDialog("open", "", "Text documents (*.bat;*.txt;*.vbs;)") $netopen = FileOpen($openfile) $read_file = FileRead($netopen) GUICtrlSetData($progress, 100) Sleep(300) GUICtrlSetData($edit, $read_file) Sleep(300) GUICtrlSetData($progress, 0) Case $msg = $new GUICtrlSetData($edit, "") Case $msg = $stop ExitLoop Case $msg = $save $ynsave = MsgBox(1, "Editor", "Save?") If $ynsave = 1 Then $location = FileSaveDialog("Save", @MyDocumentsDir, "Text documents (*.bat;*.txt;*.vbs;)", 2) GUICtrlSetData($progress, 100) Sleep(300) $exists = FileExists($location) If $exists = 1 Then FileDelete($location) EndIf FileWrite($location, GUICtrlRead($edit)) Sleep(300) GUICtrlSetData($progress, 0) EndIf EndSelect WEnd FileClose($openfile) FileClose($location) Please report errors but do not edit! Edited March 24, 2012 by Guest
martin Posted March 24, 2012 Posted March 24, 2012 I dont know how to tell if the script has been savedMaybe you mean you don't know if the script has been changed.Search the forums for examples of $EN_CHANGE. You can set a flag to indicate a change was made every time the EN_CHANGE notification fires, and reset the flag whenever the script is saved. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Guest Posted March 24, 2012 Posted March 24, 2012 (edited) Could I just find out if a variable has been declared with a dimple 1-0 return value?I know I am in the wrong forum but I just wondered if that was poss Edited March 24, 2012 by Guest
martin Posted March 24, 2012 Posted March 24, 2012 You mean could you find out if a variable is declared, with something like an IsDeclared function? Well you never know your luck.. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Guest Posted March 24, 2012 Posted March 24, 2012 (edited) Just what I need Edited March 29, 2012 by Guest
Guest Posted March 24, 2012 Posted March 24, 2012 (edited) Problem cured and V2.01 released expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <WindowsConstants.au3> GUICreate("Script", 600, 400) GUISetState(@SW_SHOW) HotKeySet("{F5}", "execute1") HotKeySet("{F4}", "shellexecute1") HotKeySet("{F3}", "Executebatch1") GUICtrlCreateLabel("F3 Execute Batch, F4 ShellExecute, F5 Execute Math", 10, 10) $edit = GUICtrlCreateEdit("", 4, 54, 594, 343) $save = GUICtrlCreateButton("Save", 74, 30, 70, 20) $new = GUICtrlCreateButton("New", 144, 30, 70, 20) $stop = GUICtrlCreateButton("Exit", 4, 30, 70, 20) $open = GUICtrlCreateButton("Open", 214, 30, 70, 20) $help = GUICtrlCreateButton("Info", 284, 30, 70, 20) $progress = GUICtrlCreateProgress(370, 29, 220, 22) Func execute1() $executeans = Execute(GUICtrlRead($edit)) MsgBox("", "", $executeans) EndFunc ;==>execute1 Func shellexecute1() ShellExecute(GUICtrlRead($edit)) EndFunc ;==>shellexecute1 Func Executebatch1() If Not IsDeclared("location") Then MsgBox(48, "Warning", "Save before executing batch!") Else Run($location) EndIf EndFunc ;==>Executebatch1 While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop Select Case $msg = $help MsgBox(64, "Editor", "By James B") Case $msg = $open $openfile = FileOpenDialog("open", "", "Text documents (*.bat;*.txt;*.vbs;*au3;)") $netopen = FileOpen($openfile) $read_file = FileRead($netopen) GUICtrlSetData($progress, 100) Sleep(300) GUICtrlSetData($edit, $read_file) Sleep(300) GUICtrlSetData($progress, 0) Case $msg = $new GUICtrlSetData($edit, "") Case $msg = $stop ExitLoop Case $msg = $save $ynsave = MsgBox(1, "Editor", "Save?") If $ynsave = 1 Then $location = FileSaveDialog("Save", @MyDocumentsDir, "Text documents (*.bat;*.txt;*.vbs;*au3;)", 2) GUICtrlSetData($progress, 100) Sleep(300) $exists = FileExists($location) If $exists = 1 Then FileDelete($location) EndIf FileWrite($location, GUICtrlRead($edit)) Sleep(300) GUICtrlSetData($progress, 0) EndIf EndSelect WEnd FileClose($openfile) FileClose($location) Edited March 24, 2012 by Guest
Guest Posted March 24, 2012 Posted March 24, 2012 V2.53 expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <WindowsConstants.au3> GUICreate("Script", 600, 400) GUISetState(@SW_SHOW) HotKeySet("{F5}", "execute1") HotKeySet("{F6}", "htmlshow1") HotKeySet("{F4}", "shellexecute1") HotKeySet("{F3}", "Executebatch1") GUICtrlCreateLabel("F3 Execute Batch, F4 ShellExecute, F5 Execute Math, F6 Show HTML", 10, 10) $edit = GUICtrlCreateEdit("", 4, 54, 594, 343) $save = GUICtrlCreateButton("Save", 74, 30, 70, 20) $new = GUICtrlCreateButton("New", 144, 30, 70, 20) $stop = GUICtrlCreateButton("Exit", 4, 30, 70, 20) $open = GUICtrlCreateButton("Open", 214, 30, 70, 20) $help = GUICtrlCreateButton("Info", 284, 30, 70, 20) $progress = GUICtrlCreateProgress(370, 29, 220, 22) Func execute1() $executeans = Execute(GUICtrlRead($edit)) MsgBox("", "", $executeans) EndFunc ;==>execute1 Func htmlshow1() Filewrite("C:/tmp/editorhtml.html", GUIctrlread($edit)) shellexecute("C:/tmp/editorhtml.html") Filedelete("C:/tmp/editorhtml.html") endfunc Func shellexecute1() ShellExecute(GUICtrlRead($edit)) EndFunc ;==>shellexecute1 Func Executebatch1() If Not IsDeclared("location") Then MsgBox(48, "Warning", "Save before executing batch!") Else Run($location) EndIf EndFunc ;==>Executebatch1 While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop Select Case $msg = $help MsgBox(64, "Editor", "By James B") Case $msg = $open $openfile = FileOpenDialog("open", "", "Text documents (*.bat;*.txt;*.vbs;*.au3;*.html;)") $netopen = FileOpen($openfile) $read_file = FileRead($netopen) GUICtrlSetData($progress, 100) Sleep(300) GUICtrlSetData($edit, $read_file) Sleep(300) GUICtrlSetData($progress, 0) Case $msg = $new GUICtrlSetData($edit, "") Case $msg = $stop ExitLoop Case $msg = $save $ynsave = MsgBox(1, "Editor", "Save?") If $ynsave = 1 Then $location = FileSaveDialog("Save", @MyDocumentsDir, "Text documents (*.bat;*.txt;*.vbs;*au3;*.html;)", 2) GUICtrlSetData($progress, 100) Sleep(300) $exists = FileExists($location) If $exists = 1 Then FileDelete($location) EndIf FileWrite($location, GUICtrlRead($edit)) Sleep(300) GUICtrlSetData($progress, 0) EndIf EndSelect WEnd FileClose($openfile) FileClose($location)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now