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

40
LINES

< > BotCompany Repo | #1007001 // Monitor clipboard for runnable snippets [WORKS]

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Uses 3874K of libraries. Click here for Pure Java version (8084L/57K/197K).

!7

static int secondsToDisplay = 10;

p-substance-thread {
  S lastText = null;
  repeat with sleep 1 {
    S s = getTextFromClipboard();
    if (neq(s, lastText)) {
      lastText = s;
      final long id = parseSnippetURLOpt(s);
      if (id != 0) {
        fS _id = fsI(id);
        //infoBox("Snippet: " + _id, 2);
        
        awt {
          final JLabel lbl = jlabel("Testing snippet");
          final JFrame f = showPackedFrameInTopRightCorner("Run " + _id + "?",
            withMargin(vstackWithSpacing(lbl, jbutton("Run", r {
              nohupJavax(_id);
            }))));
          thread "Fetch Stuff" {
            print("Testing snippet " + id);
            if (getSnippetType(id) != 34)
              disposeWindow(f);
            else {
              print("Runnable");
              setText(lbl, "Fetching title...");
              packFrameInTopRightCorner(f);
              setText(lbl, or2(getSnippetTitle(id), "Unnamed snippet"));
              makeLabelBold(lbl);
              packFrameInTopRightCorner(f);
              disposeWindowIfMouseNotInIt(iround(secondsToDisplay*1000), f);
            }
          }
        }
      }
    }
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

-
Snippet ID: #1007001
Snippet name: Monitor clipboard for runnable snippets [WORKS]
Eternal ID of this version: #1007001/15
Text MD5: 4cd4b2ddb1c0e40e362e21599bf1d9eb
Transpilation MD5: 3114b496afa499ec179c3c690c94d970
Author: stefan
Category: javax / gui
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-02-25 16:28:17
Source code size: 1211 bytes / 40 lines
Pitched / IR pitched: No / No
Views / Downloads: 572 / 730
Version history: 14 change(s)
Referenced in: