Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Anchor
    AutoHotKey
    AutoHotKey
    AutoHotKey
    • Code Block
      titleOpen
      ;Adobe Acrobat (v9.3.0 Pro Extended)
      ;document
      ;pdf
      
      ;Parse input filename
      arg1 = %1%
      StringGetPos, index, arg1, \, R
      ifLess, index, 0, ExitApp
      index += 2
      input_filename := SubStr(arg1, index)
      
      ;Run program if not already running
      IfWinNotExist, Adobe 3D Reviewer
      {
        Run, C:\Program Files\Adobe\Acrobat 9.0\Acrobat\Acrobat.exe
        WinWait, Adobe Acrobat Pro Extended
      }
      
      ;Activate the window
      WinActivate, Adobe Acrobat Pro Extended
      WinWaitActive, Adobe Acrobat Pro Extended
      
      ;Open document
      Send, ^o
      WinWait, Open
      ControlSetText, Edit1, %1%
      ControlSend, Edit1, {Enter}
      
      ;Make sure model is loaded before exiting
      Loop
      {
        IfWinExist, %input_filename% - Adobe Acrobat Pro Extended
        {
          break
        }
      
        Sleep, 500
      }
      Code Block
      titleSave
      ;Adobe Acrobat (v9.3.0 Pro Extended)
      ;document
      ;doc, html, jpg, pdf, ps, rtf, txt
      
      ;Parse output format
      arg1 = %1%
      StringGetPos, index, arg1, ., R
      ifLess, index, 0, ExitApp
      index += 2
      out := SubStr(arg1, index)
      
      ;Parse filename root
      StringGetPos, index, arg1, \, R
      ifLess, index, 0, ExitApp
      index += 2
      name := SubStr(arg1, index)
      StringGetPos, index, name, ., R
      ifLess, index, 0, ExitApp
      name := SubStr(name, 1, index)
      
      ;Activate the window
      WinActivate, %name%.pdf - Adobe Acrobat Pro Extended
      WinWaitActive, %name%.pdf - Adobe Acrobat Pro Extended
      
      ;Save document
      Send, ^S
      WinWait, Save As
      
      if(out = "doc"){
        ControlSend, ComboBox3, m
      }else if(out = "html"){
        controlSend, ComboBox3, h
      }else if(out = "jpg"){
        controlSend, ComboBox3, j
      }else if(out = "pdf"){
        controlSend, ComboBox3, a
      }else if(out = "ps"){
        controlSend, ComboBox3, p
        controlSend, ComboBox3, p
        controlSend, ComboBox3, p
        controlSend, ComboBox3, p
        controlSend, ComboBox3, p
      }else if(out = "rtf"){
        controlSend, ComboBox3, r
      }else if(out = "txt"){
        controlSend, ComboBox3, t
        controlSend, ComboBox3, t
      }
      
      ControlSetText, Edit1, %1%
      ControlSend, Edit1, {Enter}
      
      ;Return to main window before exiting
      Loop
      {
        ;Continue on if main window is active
        IfWinActive, %name%.pdf - Adobe Acrobat Pro Extended
        { 
          break
        }
      
        ;Click "Yes" if asked to overwrite files
        IfWinExist, Save As
        {
          ControlGetText, tmp, Button1, Save As
      
          if(tmp = "&Yes")
          {
            ControlClick, Button1, Save As
          }
        }
      
        Sleep, 500
      }
      
      ;Wait a lit bit more just in case
      Sleep, 1000
      
      ;Close whatever document is currently open
      Send, ^w
      
      ;Make sure it actually closed before exiting
      Loop
      {
        ;Continue on if main window is active
        IfWinActive, Adobe Acrobat Pro Extended
        { 
          break
        }
      
        Sleep, 500
      }
      Code Block
      titleKill
      ;Adobe Acrobat (v9.3.0 Pro Extended)
      
      ;Kill any scripts that could be using this application first
      RunWait, taskkill /f /im Acrobat_open.exe
      RunWait, taskkill /f /im Acrobat_save.exe
      
      ;Kill the application
      RunWait, taskkill /f /im Acrobat.exe
  • Anchor
    AppleScript
    AppleScript
    AppleScript
  • Anchor
    Python
    Python
    Python
  • Anchor
    Bash
    Bash
    Bash

Anchor
Medici
Medici
Medici

Image Removed

Anchor
Example Extractors
Example Extractors
Example Extractors

  • Anchor
    Java
    Java
    Java

    Code Block
    themeEmacs
    languagejava
    titleConnecting to RabbitMQ
    protected void startExtractor(String rabbitMQUsername,
    	String rabbitMQpassword) {
    	try{ 
     		//Open channel and declare exchange and consumer
    		ConnectionFactory factory = new ConnectionFactory();
    		factory.setHost(serverAddr);
    		factory.setUsername(rabbitMQUsername);
    		factory.setPassword(rabbitMQpassword);
    		Connection connection = factory.newConnection();
    
     		final Channel channel = connection.createChannel();
    		channel.exchangeDeclare(EXCHANGE_NAME, "topic", true);
    
    		channel.queueDeclare(QUEUE_NAME,DURABLE,EXCLUSIVE,AUTO_DELETE,null);
    		channel.queueBind(QUEUE_NAME, EXCHANGE_NAME, "*.file.text.plain.#");
     
     		this.channel = channel;
    
     		// create listener
    		channel.basicConsume(QUEUE_NAME, false, CONSUMER_TAG, new DefaultConsumer(channel) {
     			@Override
     			public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException {
    				messageReceived = new String(body);
     				long deliveryTag = envelope.getDeliveryTag();
     				// (process the message components here ...)
    				System.out.println(" {x} Received '" + messageReceived + "'");
     
    				replyProps = new AMQP.BasicProperties.Builder().correlationId(properties.getCorrelationId()).build();
    				replyTo = properties.getReplyTo();
     
    				processMessageReceived();
    				System.out.println(" [x] Done");
    				channel.basicAck(deliveryTag, false);
    			}
    		});
    
     		// start listening 
    		System.out.println(" [*] Waiting for messages. To exit press CTRL+C");
     		while (true) {
    			Thread.sleep(1000);
    		}
    	}
     	catch(Exception e){
    		e.printStackTrace();
    		System.exit(1);
    	} 
    }

     

  • Anchor
    C++
    C++
    C++

  • Anchor
    Python
    Python
    Python

     
    Code Block
    themeEmacs
    languagepy
    titleInstantiating the logger and starting the extractor
    def main():
     global logger
    
     # name of receiver
    receiver='ExamplePythonExtractor'
    
     # configure the logging system
    logging.basicConfig(format="%(asctime)-15s %(name)-10s %(levelname)-7s : %(message)s", level=logging.WARN)
    logger = logging.getLogger(receiver)
    logger.setLevel(logging.DEBUG)
     
     if len(sys.argv) != 4:
    logger.info("Input RabbitMQ username, followed by RabbitMQ password and Medici REST API key.")
    sys.exit()
     
     global playserverKey
    playserverKey = sys.argv[3]
    Code Block
    themeEmacs
    languagepy
    titleConnecting to RabbitMQ
    # connect to rabbitmq using input username and password 
    credentials = pika.PlainCredentials(sys.argv[1], sys.argv[2])
    parameters = pika.ConnectionParameters(credentials=credentials)
    connection = pika.BlockingConnection(parameters)
     
     # connect to channel
    channel = connection.channel()
    
     # declare the exchange
    channel.exchange_declare(exchange='medici', exchange_type='topic', durable=True)
    
     # declare the queue
    channel.queue_declare(queue=receiver, durable=True)
    
     # connect queue and exchange
    channel.queue_bind(queue=receiver, exchange='medici', routing_key='*.file.text.plain')
    
     # create listener
    channel.basic_consume(on_message, queue=receiver, no_ack=False)
    
     # start listening
    logger.info("Waiting for messages. To exit press CTRL+C")
     try:
    channel.start_consuming()
     except KeyboardInterrupt:
    channel.stop_consuming()
    

Anchor
Versus
Versus
Versus

...

  • Code Block
    languagejava
    titleMeasure
    public class WordMeasureWordCountMeasure implements Serializable,Measure {
    
    	private static final long SLEEP = 10000;
    
    	@Override
    	public Similarity compare(Descriptor feature1, Descriptor feature2)
    			throws Exception {
    		Thread.sleep(SLEEP);
    		return new SimilarityNumber(0);
    	}
    
    	@Override
    	public SimilarityPercentage normalize(Similarity similarity) {
    		// TODO Auto-generated method stub
    		return null;
    	}
    
    	@Override
    	public String getFeatureType() {
    		return DummyFeatureWordCountMeasure.class.getName();
    	}
    
    	@Override
    	public String getName() {
    		return "DummyWord Count Measure";
    	}
    
    	@Override
    	public Class<DummyMeasure>Class<WordCountMeasure> getType() {
    		return DummyMeasureWordCountMeasure.class;
    	}
    
    }