Shortcut Ctrl + S will work in HM ??

Altair Forum User
Altair Forum User
Altair Employee
edited October 2020 in Community Q&A

Hi ,

 

I just want to keep the shortcut for saving the Hm file.

 

For this i prepared this code

 

set hmDatabase [hm_info hmfilename]

if {[llength $hmDatabase] == '0'} {
    set expFileName [tk_getSaveFile -defaultextension '.hm'\
      -filetypes {{'HM Database' '.hm'}} -initialfile 'ORIGINAL_DATA.hm'\
      -title 'Save as .hm file']
      hm_answernext 'yes'
      catch {*writefile '$expFileName' 1 }
    set hmDatabase [hm_info hmfilename]
}

if {[llength $hmDatabase] == '1' } {
hm_answernext 'yes'
*writefile '$hmDatabase' 1
}

 

Then i pasted this code on keyboard shortcuts window on Ctrl + S

 

For the first time it worked in both cases

 

1. Fresh file ( which will ask the file name & location to Save)

2. Working file ( Which will save on the same file name  & location)

 

After some time it is working only on fresh file case.

 

Any suggestions?

Answers

  • tinh
    tinh Altair Community Member
    edited November 2014

    Hi,

    we should not use *writefile directly

    you can assign this command for Ctr+S :

    [. cget -menu].file invoke 2