Start a new topic

Save and key-bind macros

 I found this 4-year old topic


https://support.dbvis.com/support/discussions/topics/1000076749


because I'm missing exactly this capability.


I thend to forget how to convert timezones in my DB to my local timezone so I created a macro which cuts out my current selection and puts the SQL code for converting the timezone around it.


Would be greate I could store this macro and maybe bind it to some shortcut.


Hi Stephan,


This has not been implemented yet, partly because very few have shown an interest in it. I have added you vote for it so we will discuss it again.


Best Regards,

Hans


1 person likes this

For anybody on a Mac, this might help. As you saw above, my goal was to have selected text to be surrounded by some fixed text which makes NySQL/MariaDB convert a column to my local timezone.


So this

    last_scan


wolud become this

    CONVERT_TZ(last_scan, '+00:00', @@global.time_zone) as last_scan


Here is how I do it now.


Preparation:


Copy attached script "TimeZoneConvert.scpt" into ~/Library/Scripts/DbVisualizer and note that this path will most probably not exist yet.


In Script Editor's preferences, (/Applications/Utilities/Script Editor) enable the script Menu.



Usage:


When in DbVisualizer's Editor, select the word(s) you want to be surrounded by mentioned text. Then click the Script Menu -> DbVisualizer -> TimeZoneConvert and see how the text is replaced.



Adjustments:


Open in Script Editor the TimeZoneConvert script and adjust it to you needs and store it under a different name. You can store as many other "Macros" as you want.


scpt

Hi Stephan,


Great, thanks for sharing this script!


Best Regards,

Hans

 Thanks Hans.


If you happen to know jEdit, take a look at its macro system. Something like that would be fantastic. Macros are simply stored as files in a specific directory and its subdirectories. The content of that directory can be found in a macro menu. Every subdirectory is a sub-menu. Additionally keybindings are possible.

Login or Signup to post a comment