dm-script

How can one synchronize an external application with a DigitalMicrograph script?

守給你的承諾、 提交于 2019-12-23 01:43:27
问题 This question has been inspired by the question 'Call script from command line'. How can one write a script which acts on 'trigger events' in an application other than DigitalMicrograph? i.e. some script functionality should be triggered by an external application. 回答1: The scripting language does not offer many 'external' interfaces in its current state. It is possible to call out to an external process with the command LaunchExternalProcess and wait for the process to complete, but there is

How to close a UIFrame window from the object itself? (Behavioral difference GMS 1.x to GMS 2.x)

和自甴很熟 提交于 2019-12-14 02:33:36
问题 In GMS2.x, closing UIFrame window with the code shown below will cause DM to crash (at pressing the close button.) However, the same code works fine with GMS 1.x. Is there a way to work around this problem in GMS 2.x? class UIWindowCloseTest : UIFrame { void CloseSelf( object self ) self.GetFrameWindow().WindowClose(0); UIWindowCloseTest( object self ) { TagGroup tgDialog = DLGCreateDialog( "window close test" ); tgDialog.DLGAddElement( DLGCreatePushButton( "Close", "CloseSelf" )); self.super

dm-script catch error with “Analyze Particles”

最后都变了- 提交于 2019-12-12 17:45:24
问题 When doing ChooseMenuItem("Analysis", "Particles", "Analyze Particles") I sometime get "Invalid index" error window. Is there a way to catch that error? Doing this, try { ChooseMenuItem( "Analysis", "Particles", "Analyze Particles" ) } catch { okdialog("error") } does not catch the error. The "Invalid index" error is likely an error after the menu action "Analyze Particles" is done. Can anyone point out on how to catch this error? And finding out the origin of this error is a great plus. I am

Find a pattern image (binary file)

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 18:37:48
问题 For string variable in DigitalMicrograph, we can find the position of a particular pattern using the "find" function: Number find( String str, String sub_str ) I would like to do the same but with image data. For example, I can create an image with image img := exprsize(1024, icol); and the pattern I want to find is image pattern := exprsize( 15, icol+64 ); In above case, we know the offset of pattern w.r.t. the data is at column number 64. A real case we won't have a such simple pattern (i.e

Performing Particle Analysis via ChooseMenuItem() - what is wrong

强颜欢笑 提交于 2019-12-11 15:48:49
问题 This is a continuation of the question here. I am re-posting one of the answers to keep the topics cleaner. The original question (and continued question) is from user6406828. Trying to perform some (looped over) particle analysis, a couple of errors are thrown every now and then. What can be improved in this code? Here are some code: // $BACKGROUND$ number useBadImage, stopAtSrcImage // flags for test image histogram, src, stack taggroup imgLst number i, imgCt,imgID,x0,y0,x1,y1, z1 if

Call script from Windows command line

不羁岁月 提交于 2019-12-11 12:55:04
问题 Is it possible to call a script in Digital Micrograph from the Windows command line? I cannot seem to find information on command line options, if any are available, for DM. 回答1: No, this is not possible for GMS version 2 or lower. There are no command-line parameters for script-launch in DigitalMicrograph. However, if you want to run a script automatically on start-up of DM, you can do this by installing a script as plugin (.gtk file). 回答2: From GMS 3.0.1 onward, there is an optional start

Closing a modal dialog in GMS 2.x and GMS 1.x?

本小妞迷上赌 提交于 2019-12-11 10:18:25
问题 I have a dialog that needs 3 options, which I have implemented as buttons. It would be best served by a modal dialog. I have code like this: class testDialog : uiframe { void OnOne( object self ) { Result( "Doing one\n" ) self.close() } void OnTwo( object self ) { Result( "Two.\n" ) self.close() } void OnThree( object self ) { Result( "Three.\n" ) self.close() } } void ThreeButtonDialog(String description) { TagGroup dialog_items TagGroup dialog_tags = DLGCreateDialog( "Test Dialog", dialog

How to get and change the values of the projector lens system?

百般思念 提交于 2019-12-11 10:14:25
问题 I am trying to write a Gatan DigitalMicrograph script to control the tilting of incident electron beam before and after a specimen. I think that the values of pre-specimen lens system can be got and changed by using commands such as EMGetBeamTilt, EMSetBeamTilt and EMChangeBeamTilt. However, I don't know how to get or control the status of the post-specimen lens system such as a projector lens. What command or code should be written in order to control the projector lens system? It will be

Continious camera acquisition accompanied with a modeless dialog by dm-script

*爱你&永不变心* 提交于 2019-12-11 06:55:57
问题 I would like to make a DM script acquiring camera images continuously, like VIEW mode. In my plan, the continious camera acquisition is start when START button located at an UIframe dialog is pressed; and a modeless dialog is also shown simultaneously. The continuous acuisition is stopped when the OK button located at the dialog is pressed. For this kind of scripts, I think a background thread is required. However, I don't have enough knowledge about such a background running. It will be

How to create a spin box in dm-script?

随声附和 提交于 2019-12-11 04:38:32
问题 I would like to create a spin box on a modal/modeless dialog in dm-script, which enables users to increase or decrease the number value in the text field by clicking up or down arrow buttons (i.e., spin buttons). Is there an appropriate way to create such a spin box? It will be appreciated if you share some wisdom. Thank you very much in advance. 回答1: There exists no "spin control" for scripted dialogs. However, you can build a proxy-spin control by creating and arranging according push