Jump to content

Add a Button in SciTE to Insert current date


JohnBailey
 Share

Recommended Posts

If the title didn't explain it enough (which it is probably confusing), I want to add a button or menu item or something to SciTE. With that button I want to be able to simple add the current date to an open au3 file at a certain position. I would later add things like username and etc.

This helps me and a few blokes here.

EDIT:

My apologies. I need to edit SciTE4AutoIt3 not just SciTE. :">

Edited by JohnBailey
A decision is a powerful thing
Link to comment
Share on other sites

If the title didn't explain it enough (which it is probably confusing), I want to add a button or menu item or something to SciTE. With that button I want to be able to simple add the current date to an open au3 file at a certain position. I would later add things like username and etc.

This helps me and a few blokes here.

EDIT:

My apologies. I need to edit SciTE4AutoIt3 not just SciTE. :

Check AnyGui.au3 -> http://www.autoitscript.com/forum/index.php?showtopic=9517

This might get you started to do it external autoit way. Otherwise talk with JdeB he can prolly help you out :)

My little company: Evotec (PL version: Evotec)

Link to comment
Share on other sites

Check AnyGui.au3 -> http://www.autoitscript.com/forum/index.php?showtopic=9517

This might get you started to do it external autoit way. Otherwise talk with JdeB he can prolly help you out :)

I was wanting to do a direct SciTE edit.

Can we address JdeB directly? I didn't think we could msg Mods unless they specifically requested. Maybe I'm nuts!

A decision is a powerful thing
Link to comment
Share on other sites

  • Developers

you can also use an autoitscript and use SciTE's Director interface...

Below a basic script that will insert the date at the place where the carret is located

use it to add a nice gui asking what you want to insert .... just let your imagination work :)

#include<date.au3>
;
SendSciTE_Command('insert:' & _DateTimeFormat( _NowCalc(),2))
;
;
; Send command to SciTE
Func SendSciTE_Command($sCmd) 
    Opt("WinSearchChildren", 1)
    Local $WM_COPYDATA = 74
    Local $My_Hwnd = 0
; Get SciTE DirectorHandle 
    Local $Scite_hwnd = WinGetHandle("DirectorExtension")
    ConsoleWrite('-->' & $sCmd & @lf )
    Local $CmdStruct = DllStructCreate('Char[' & StringLen($sCmd) + 1 & ']')
    DllStructSetData($CmdStruct, 1, $sCmd)
    Local $COPYDATA = DllStructCreate('Ptr;DWord;Ptr')
    DllStructSetData($COPYDATA, 1, 1)
    DllStructSetData($COPYDATA, 2, StringLen($sCmd) + 1)
    DllStructSetData($COPYDATA, 3, DllStructGetPtr($CmdStruct))
    DllCall('User32.dll', 'None', 'SendMessage', 'HWnd', $Scite_hwnd, _
            'Int', $WM_COPYDATA, 'HWnd', $My_Hwnd, _
            'Ptr', DllStructGetPtr($COPYDATA))
EndFunc;==>SendSciTE_Command
Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Can we address JdeB directly? I didn't think we could msg Mods unless they specifically requested. Maybe I'm nuts!

I think if you don't abuse and msg anyone on daily basis I think messaging mod (in this case JdeB) is allowed :) At least i never hestiated ;>

My little company: Evotec (PL version: Evotec)

Link to comment
Share on other sites

  • Developers

I think if you don't abuse and msg anyone on daily basis I think messaging mod (in this case JdeB) is allowed :) At least i never hestiated ;>

I don't mind getting PM's every now and then but in general its better to post in the public forum when you have question like this so other can chime in too... :)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

you can also use an autoitscript and use SciTE's Director interface...

haha, hi JdeB! Right after I posted my comment about wondering if I could msg you, you posted here.

First, Director Interface is something I looked at, but wasn't sure if I was even climbing the right tree. Second, I want to avoid writing a app using AU3 if at all possible.

This link explains exactly what you want:

http://lua-users.org/wiki/SciteMiscScripts

I can't edit the SciTEUser.properties. It gives me a msg saying I must save as.

A decision is a powerful thing
Link to comment
Share on other sites

haha, hi JdeB! Right after I posted my comment about wondering if I could msg you, you posted here.

First, Director Interface is something I looked at, but wasn't sure if I was even climbing the right tree. Second, I want to avoid writing a app using AU3 if at all possible.

I can't edit the SciTEUser.properties. It gives me a msg saying I must save as.

Change attribute of file? Probably set as read only ?:)

My little company: Evotec (PL version: Evotec)

Link to comment
Share on other sites

Is it a better idea to create an AU3 App due to updating SciTE can write over any altered files? However, as I come back to this question I can't help but ask, "Yeah, but you can just save those files and then put them back whenever you update."

Any more wisdom gang?

A decision is a powerful thing
Link to comment
Share on other sites

  • Developers

haha, hi JdeB! Right after I posted my comment about wondering if I could msg you, you posted here.

First, Director Interface is something I looked at, but wasn't sure if I was even climbing the right tree. Second, I want to avoid writing a app using AU3 if at all possible.

I can't edit the SciTEUser.properties. It gives me a msg saying I must save as.

LUA is fine too and its build on the same stuff the Director interface is build on in SciTE.

The reason for proposing AutoIt3 is that you could assign a single shortcut in SciTE and have that start and Au3 script showing a GUI will multiple option to insert things like Date/Time/Username etc .....

either way should work .. :)

Do you have write access to @UserProfileDir ?

That is the location SciTEUser.properties is located...

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

Is it a better idea to create an AU3 App due to updating SciTE can write over any altered files? However, as I come back to this question I can't help but ask, "Yeah, but you can just save those files and then put them back whenever you update."

Any more wisdom gang?

let me make sure I understand what you want to accomplish: Do you want to insert the date one time or have other intentions ? Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

The reason for proposing AutoIt3 is that you could assign a single shortcut in SciTE and have that start and Au3 script showing a GUI will multiple option to insert things like Date/Time/Username etc .....

"Assign a single shortcut" WHAT?! How do you do that?! :-D :excited:

Do you have write access to @UserProfileDir ?

That is the location SciTEUser.properties is located...

:">

A decision is a powerful thing
Link to comment
Share on other sites

let me make sure I understand what you want to accomplish: Do you want to insert the date one time or have other intentions ?

The only other intentions I can think of having is putting the windows username in line 2 right above line 3 (those lines are standard in my au3 files for small projects with office mates).

EDIT

I thought it would be easy enough and would teach me something extremely cool or at least helpful or interesting. This would also save me time.

Edited by JohnBailey
A decision is a powerful thing
Link to comment
Share on other sites

I made a toolbar that works with SciTe. You can find a link for it in my sig. As for exactly what you want, I know you can make a simple script that does a time stamp. You can make a hotsetkey for when SciTe is active to send the time stamp, or add it to the context menu in SciTe. If I remember right, Gary made a tool to configure SciTe...Jos, you can dork slap me if I'm wrong on this....

Link to comment
Share on other sites

  • Developers

"Assign a single shortcut" WHAT?! How do you do that?! :-D :excited:

:">

have a look at au3.properties how all current utilities are started like tidy:

# 09 JdeB's Tidy formatting program for Autoit3 
command.9.$(file.patterns.au3)="$(SciteDefaultHome)\tidy\tidy.exe" "$(FilePath)"
command.name.9.$(file.patterns.au3)=Tidy AutoIt Source
command.subsystem.9.$(file.patterns.au3)=0
command.save.before.9.$(file.patterns.au3)=1
command.shortcut.9.$(file.patterns.au3)=Ctrl+T
command.is.filter.9.$(file.patterns.au3)=1

Add something like this to SciTEUser.properties and modify it to use a available command number etc ....

Information on all these commands can be found in the SciTE4AutoIt3 helpfile ...

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

I made a toolbar that works with SciTe. You can find a link for it in my sig. As for exactly what you want, I know you can make a simple script that does a time stamp. You can make a hotsetkey for when SciTe is active to send the time stamp, or add it to the context menu in SciTe. If I remember right, Gary made a tool to configure SciTe...Jos, you can dork slap me if I'm wrong on this....

Gary made the CodeSnippet utility that inserts code snippet directly into scite using this same SciTE director mechanism .... is that what you mean ?

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

have a look at au3.properties how all current utilities are started like tidy:

# 09 JdeB's Tidy formatting program for Autoit3 
command.9.$(file.patterns.au3)="$(SciteDefaultHome)\tidy\tidy.exe" "$(FilePath)"
command.name.9.$(file.patterns.au3)=Tidy AutoIt Source
command.subsystem.9.$(file.patterns.au3)=0
command.save.before.9.$(file.patterns.au3)=1
command.shortcut.9.$(file.patterns.au3)=Ctrl+T
command.is.filter.9.$(file.patterns.au3)=1

Add something like this to SciTEUser.properties and modify it to use a available command number etc ....

Information on all these commands can be found in the SciTE4AutoIt3 helpfile ...

Jos

Thanks!
A decision is a powerful thing
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...