Dolemite50 Posted February 12, 2007 Share Posted February 12, 2007 HI, I haven't been able to find a utility for ScIte that lets you paste in some code and run it, so if I want to test something I have to start a new file and save it as .au3. Does such a tool exist? It's probably been right under my nose but I can't find it. Thanks a lot. Link to comment Share on other sites More sharing options...
Shevilie Posted February 12, 2007 Share Posted February 12, 2007 Yep and its called test.au3 I have a file called test.au3 on my desktop, I use it in case i need to test someting alone Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit Link to comment Share on other sites More sharing options...
FreeFry Posted February 12, 2007 Share Posted February 12, 2007 If you want to take this a little longer, you could create an application, that when "activated" shows a window, where you can put code in, then it saves it to a file, and runs that file... Link to comment Share on other sites More sharing options...
Dolemite50 Posted February 12, 2007 Author Share Posted February 12, 2007 Yep and its called test.au3 I have a file called test.au3 on my desktop, I use it in case i need to test someting alone Hey, that's MY test.au3! Fork it over!Well thanks for the response. ScItE is such a swiss-army knife for Auto-it that I thought certain there would be a console. I've been getting by with a test.au3, and even went so far as to automate it with a few ScITe buttons. One simply opens it, and one grabs clipboard or highlighted text, opens test.au3 (if need be), clears, pastes, runs, and then returns focus to the original window. I also added my own save button that checks for ".au3" in the title and if not, it populates the Save-As box with it and sets the cursor to home. Prior to that I'd saved about 100 scripts without an extension. You'd laugh if you saw my ScITe buttons, they are a true testimony to one man's laziness. Thanks again. Link to comment Share on other sites More sharing options...
MHz Posted February 12, 2007 Share Posted February 12, 2007 Hey, that's MY test.au3! Fork it over!I use an addon tool for Scite to make temp scripts so clutter is reduced. If you are happy with the script then you can use "Save As" to keep worthy scripts. Wil not fix your file extension issue but programs that do not know what extension you want (except for M$) will need you to add the extention. I run it from a subfolder to Scite.exe but should run from same dir as Scite.exe as well. CODE expandcollapse popup;-------------; ; temp script ; ;-------------; #region - Global Variables ; Constants ; ; GuiConstants Global Const $GUI_EVENT_CLOSE = -3 Global Const $WS_EX_TOPMOST = 0x00000008 ; Variables Global $scite, $tempfile Global $date = @YEAR & '.' & @MON & '.' & @MDAY & '_' #endregion #region - Locate and Assign Files Select Case FileExists(@ScriptDir & '\..\scite.exe') If DirCreate(@ScriptDir & '\..\Temp') Then $scite = @ScriptDir & '\..\Scite.exe' $tempfile = _TempFile(@ScriptDir & '\..\Temp', $date, '.au3', 3) Else Exit 1 EndIf Case FileExists(@ScriptDir & '\scite.exe') If DirCreate(@ScriptDir & '\Temp') Then $scite = @ScriptDir & '\..\Scite.exe' $tempfile = _TempFile(@TempDir & '\Temp', $date, '.au3', 3) Else Exit 2 EndIf Case Else Exit 3 EndSelect #endregion #region - GUI Create GUICreate('TempScript', 300, 80, Default, Default, Default, $WS_EX_TOPMOST) GUICtrlCreateLabel('Choose your option carefully', 80, 10) $button_create = GUICtrlCreateButton('Create', 10, 40, 80) GUICtrlSetTip(Default, 'Create Temp Script') $button_delete = GUICtrlCreateButton('Delete', 110, 40, 80) GUICtrlSetTip(Default, 'Delete Temp Script') $button_cancel = GUICtrlCreateButton('Cancel', 210, 40, 80) GUISetState() #endregion #region - GUI SelectLoop While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $button_cancel Exit 0 Case - 100 To 0 ContinueLoop Case $button_create If FileWrite($tempfile, _Content()) Then If _SciteOpenFile() Then ConsoleWrite('+ Created and Opened a Temporary Script' & @CRLF) EndIf EndIf Exit Case $button_delete If $CMDLINE[0] And FileExists($CMDLINE[1]) Then $filepath = $CMDLINE[1] If FileReadLine($filepath) <> '; temporary script' Then ConsoleWrite('! Could not find the line "; temporary script" within the script' & @CRLF) Exit 4 EndIf If _SciteCloseFile() Then If FileDelete($filepath) Then ConsoleWrite('+ Closed and Deleted a Temporary Script' & @CRLF) EndIf EndIf EndIf Exit EndSwitch WEnd #endregion Exit Func OnAutoItStart() Local $title = @ScriptName & ' Interpreter' If WinExists($title) Then Exit AutoItWinSetTitle($title) EndFunc Func _Content() Return '; temporary script' & @CRLF & @CRLF & @CRLF & @CRLF & 'Exit' & @CRLF & @CRLF & _ 'Func OnAutoItStart()' & @CRLF & _ @TAB & "If WinExists(@ScriptName & '_Interpreter') Then Exit" & @CRLF & _ @TAB & "AutoItWinSetTitle(@ScriptName & '_Interpreter')" & @CRLF & _ 'EndFunc' & @CRLF & @CRLF EndFunc Func _SciteCloseFile() If FileExists($scite) And FileExists($filepath) Then $filepath = StringReplace($filepath, '\', '\\') Run('"' & $scite & '" "-open:' & $filepath & '" "-close:"') Return 1 EndIf EndFunc Func _SciteOpenFile() If FileExists($scite) And FileExists($tempfile) Then $tempfile = StringReplace($tempfile, '\', '\\') Run('"' & $scite & '" "-open:' & $tempfile & '" "-goto:3"') Return 1 EndIf EndFunc Func _TempFile($s_DirectoryName = @TempDir, $s_FilePrefix = "~", $s_FileExtension = ".tmp", $i_RandomLength = 7) Local $s_TempName ; Check parameters If Not FileExists($s_DirectoryName) Then $s_DirectoryName = @TempDir ; First reset to default temp dir If Not FileExists($s_DirectoryName) Then $s_DirectoryName = @ScriptDir ; Still wrong then set to Scriptdir ; add trailing \ for directory name If StringRight($s_DirectoryName, 1) <> "\" Then $s_DirectoryName = $s_DirectoryName & "\" Do $s_TempName = "" While StringLen($s_TempName) < $i_RandomLength $s_TempName = $s_TempName & Chr(Random(97, 122, 1)) WEnd $s_TempName = $s_DirectoryName & $s_FilePrefix & $s_TempName & $s_FileExtension Until Not FileExists($s_TempName) Return ($s_TempName) EndFunc Link to comment Share on other sites More sharing options...
Bert Posted February 12, 2007 Share Posted February 12, 2007 Trying to make sence of the code. Works fine to open a script, but for some reason the delete script function doesn't work. Any ideas? I'm going to add this to the SciTe toolbar package, so I want to make sure it works. Thoughts? The Vollatran project  My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Bert Posted February 13, 2007 Share Posted February 13, 2007 bump The Vollatran project  My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
MHz Posted February 13, 2007 Share Posted February 13, 2007 Trying to make sence of the code. Works fine to open a script, but for some reason the delete script function doesn't work. Any ideas? I'm going to add this to the SciTe toolbar package, so I want to make sure it works. Thoughts?I have it setup as a Scite tool so it will pass the parameter of the current active file that is open for the file delete action to take place. Perhaps the filepath is not being passed with your setup? My setting in user options file. # 46 My TempScript (Custom) command.46.*=$(autoitexe) "$(tools)\TempScript.au3" "$(FilePath)" command.subsystem.46.*=1 command.name.46.*=My TEMP Script command.shortcut.46.*=Alt+S command.save.before.46.*=0 command.quiet.46.*=1 You need a filepath to pass this condition. Case $button_delete If $CMDLINE[0] And FileExists($CMDLINE[1]) Then Link to comment Share on other sites More sharing options...
Bert Posted February 13, 2007 Share Posted February 13, 2007 I changed the user options as you suggested. Still nothing. I think I understand what it is supposed to do, but for some reason, the statement: Case $button_delete If $CMDLINE[0] And FileExists($CMDLINE[1]) Then is not getting passed. It will make the file, just won't delete it. The Vollatran project  My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
MHz Posted February 13, 2007 Share Posted February 13, 2007 Try adding the settings with the variables that I also use. # AutoIt executable autoitexe=$(SciteDefaultHome)\..\AutoIt3.exe # Tools folder tools=$(SciteDefaultHome)\tools # 46 My TempScript (Custom) command.46.*=$(autoitexe) "$(tools)\TempScript.au3" "$(FilePath)" command.subsystem.46.*=1 command.name.46.*=My TEMP Script command.shortcut.46.*=Alt+S command.save.before.46.*=0 command.quiet.46.*=1 Link to comment Share on other sites More sharing options...
Bert Posted February 13, 2007 Share Posted February 13, 2007 Thats got it. Thanks! The Vollatran project  My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Valuater Posted March 6, 2007 Share Posted March 6, 2007 A LITTLE CHANGE... Case FileExists(@ScriptDir & '\scite.exe') If DirCreate(@ScriptDir & '\Temp') Then $scite = @ScriptDir & '\..\Scite.exe' $tempfile = _TempFile(@TempDir & '\Temp', $date, '.au3', 3) Else 8) Link to comment Share on other sites More sharing options...
MHz Posted March 7, 2007 Share Posted March 7, 2007 A LITTLE CHANGE...Thanks, overlooked that bug as my setup always uses the previous Case so it always worked fine. Link to comment Share on other sites More sharing options...
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