Skip to content

Instantly share code, notes, and snippets.

View mikahanninen's full-sized avatar

Mika Hänninen mikahanninen

  • Robocorp
  • Finland
View GitHub Profile
from RPA.Word.Application import Application
from win32com.client import constants
from typing import Any
from enum import Enum
class CursorPosition(Enum):
NO_MOVE = 0
START = 1
@mikahanninen
mikahanninen / DevExcel.py
Last active February 12, 2024 16:05
Keyword "Write data to range" for RPA.Excel.Application library
from RPA.Excel.Application import Application
from RPA.Tables import Table
from typing import Any, List, Union
class DevExcel(Application):
def __init__(self, autoexit: bool = True) -> None:
super().__init__(autoexit)
def write_data_to_range(
@mikahanninen
mikahanninen / example.py
Created May 2, 2023 14:04
Getting thread dump when Python gets stuck
import threading
from _pydevd_bundle import pydevd_utils
import time
def dump_threads_after_timeout():
time.sleep(5)
pydevd_utils.dump_threads()
def this_is_going_to_stuck():
@mikahanninen
mikahanninen / task.robot
Last active February 23, 2022 08:38
Running Selenium Keyword for element which needs to be in view
*** Settings ***
Library RPA.Browser.Selenium
*** Tasks ***
Lets scroll
Open Available Browser https://robotframework.org/SeleniumLibrary/SeleniumLibrary.html
${status} Run Keyword For Element in View Mouse Down name:Input Text
Capture Page Screenshot
*** Keywords ***
@mikahanninen
mikahanninen / releasenote.txt
Created December 28, 2021 15:45
rpaframework-google release note 2.0.0
‎‎​
@mikahanninen
mikahanninen / modify.py
Created November 30, 2021 15:10
libspeccing
def modify_libspec_files():
files = list_all_libspec_files()
pattern = r"source=\"([^\"]+)"
sub_pattern = rf'source=".\{os.path.sep}\g<1>'
for f in files:
outfilename = f"{f}.modified"
with open(f) as file_in:
file_content = file_in.read()
with open(outfilename, "w") as file_out:
new_content = re.sub(
@mikahanninen
mikahanninen / README.md
Last active March 23, 2021 14:03
Using Robocorp Vault from Lab

Using Robocorp Vault from Lab

View credentials

rcc configure credentials

Add new Cloud Access Credential entry (if account has not been added before)

All user's Access Credentials are visible at https://cloud.robocorp.com

Offline Python Package Install Notes

Two common cases which make the install of Python packages harder due to networking issues are: a) Install behind a Proxy b) Install without access to the internet

(a) Install behind a Proxy

In the case where the target machine connects to the internet over a network proxy, export the following environment vars, as appropriate - http_proxy and https_proxy. Eg:

@mikahanninen
mikahanninen / README.md
Created December 13, 2020 08:15
get Google Maps suggestions

javascript

var texts = document.querySelector('.suggestions').innerText.split('\n') console.log(texts[Math.floor(Math.random()*texts.length)])

@mikahanninen
mikahanninen / pysyslog.py
Created April 9, 2019 13:29 — forked from marcelom/pysyslog.py
Tiny Python Syslog Server
#!/usr/bin/env python
## Tiny Syslog Server in Python.
##
## This is a tiny syslog server that is able to receive UDP based syslog
## entries on a specified port and save them to a file.
## That's it... it does nothing else...
## There are a few configuration parameters.
LOG_FILE = 'youlogfile.log'