Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

28
LINES

< > BotCompany Repo | #1020155 // Save Good Result (Screenshot + Data From Another Module)

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Libraryless. Click here for Pure Java version (15193L/109K).

1  
!7
2  
3  
module SaveGoodResult {
4  
  S moduleIDAndName, comment;
5  
  
6  
  visualize {
7  
    ret withRightMargin(makeForm2(
8  
      "Module", dm_moduleSelectorComboBox(dm_fieldLiveValue('moduleIDAndName)),
9  
      "Comment", dm_fieldTextField('comment),
10  
      "", jbutton("Save", rThread saveResult)));
11  
  }
12  
  
13  
  void saveResult enter {
14  
    O mod = dm_getModule(firstIntAsString(moduleIDAndName));
15  
    if (mod == null) ret;
16  
    BufferedImage screenshot = dm_moduleScreenShot(mod);
17  
    S moduleID = dm_moduleID(mod);
18  
    File jpgFile = makeFileNameUnique_withExtension(goodResultsDir(ymd_minus_hms()), ".jpg");
19  
    saveJPEG(jpgFile, screenshot);
20  
    dm_persistModule(mod);
21  
    saveTextFile(replaceExtension(jpgFile, ".data"), dm_getStructure(mod));
22  
    setFileInfoFields(jpgFile,
23  
      Comment := comment,
24  
      "Module ID" := moduleID,
25  
      "Module Lib ID" := dm_moduleLibID(mod));
26  
    infoBox("Saved " + jpgFile + " (plus data)");
27  
  }
28  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1020155
Snippet name: Save Good Result (Screenshot + Data From Another Module)
Eternal ID of this version: #1020155/9
Text MD5: 66dfbadc53be24a5ecb351cd7ab88b07
Transpilation MD5: 9fa1feeb7a67fb2b362da1054f6f8f60
Author: stefan
Category: javax / stefan's os
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-12-09 18:48:58
Source code size: 946 bytes / 28 lines
Pitched / IR pitched: No / No
Views / Downloads: 343 / 601
Version history: 8 change(s)
Referenced in: [show references]