Click button or hide box in iMacros or Greasemonkey - greasemonkey

So I've had an iMacro for about a year now working fine.
The iMacro has the following line in it:
ONDIALOG POS=1 BUTTON=OK CONTENT=
That's because after the tab 2 closes, a dialog popup box appears and the "OK" button needs to be clicked. However, for some reason since a few days now this stopped working. I think the popup box somehow changed.
Here is how the box looks:
I need to be able to click this, because otherwise I can't continue doing what I need to do. I'm thinking if iMacros can do it (I tried recording with different recording modes, and nothing records when I click the OK button). I'm using iMacros for Firefox by the way. Or, maybe to do it somehow with Greasemonkey? Or if anyone has any other idea?
The website I'm trying to create an iMacro for is called Likesasap.com, and I'm trying to make a script for their website hits category.
Here is the script that I have that worked up until a month ago:
SET !ERRORIGNORE YES
SET !TIMEOUT_PAGE 20
SET !VAR1 EVAL("var min = 2; var max = 3; var randomNumber = Math.floor(Math.random() * (max - min + 1)) + min; randomNumber;")
SET !VAR2 EVAL("var min = 4; var max = 5; var randomNumber = Math.floor(Math.random() * (max - min + 1)) + min; randomNumber;")
SET !VAR3 EVAL("var min = 25; var max = 27; var randomNumber = Math.floor(Math.random() * (max - min + 1)) + min; randomNumber;")
TAB T=1
URL GOTO=http://www.likesasap.com/website.php
WAIT SECONDS={{!VAR1}}
TAG POS=1 TYPE=INPUT:BUTTON ATTR=*
TAB T=2
WAIT SECONDS={{!VAR3}}
TAB T=1
ONDIALOG POS=1 BUTTON=OK CONTENT=
WAIT SECONDS={{!VAR2}}
TAG POS=1 TYPE=INPUT:BUTTON ATTR=*
TAB T=2
WAIT SECONDS={{!VAR3}}
TAB T=1
ONDIALOG POS=1 BUTTON=OK CONTENT=
WAIT SECONDS={{!VAR2}}
TAG POS=1 TYPE=INPUT:BUTTON ATTR=*
TAB T=2
WAIT SECONDS={{!VAR3}}
TAB T=1
ONDIALOG POS=1 BUTTON=OK CONTENT=
TAB CLOSEALLOTHERS
WAIT SECONDS={{!VAR2}}
Can anyone help with this?
Thanks

Related

TKinter - Clear text widget

I am inputting a random number from 1 to 25 into a text box on button press.
Every time i press the button, i want the text box to be emptied before the new number is stored - but putting self.outputbox.delete("1.0") into the button command only deletes the first character. i tried replacing 1.0 by something obvious like 2.0, but it never deleted both characters. At the moment, i am doing a very dirty solution by just calling self.outputbox.delete("1.0") twice - but i want to know how to delete the entire content of the text box.
this is the part:
def change_button_color(self):
randomcolor = self.get_random_color()
randombutton = self.random_button()
for z in range(0,1):
self.buttons['button{}'.format(randombutton)].config(bg=randomcolor)
for i in range(0,40):
self.outputbox.delete("1.0")
self.outputbox.insert("1.0","Button" + str(randombutton) + " " + "has the color" + " " + randomcolor)
as you can see, i currently have a rather dirty solution to clear the box
Do this
self.outputbox.delete("1.0", self.END)
it will clear all the text widget
And if you imported tkinter as tk do this
self.outputbox.delete("1.0", self.tk.END)

.focus and .trigger with text

I need help with my script. Need script working like this:
$(".Chat textarea").val(pQ); < .chat textarea [text place], pQ < my text
I want when text add in .chat textarea when add .focus() and press AUTO ENTER.
I think this script must look like:
var e = jQuery.Event("keypress");
e.which = 13; //choose the one you want
e.keyCode = 13;
$(".Chat textarea").val(pQ);$(".Chat textarea").focus();$(".Chat textarea".trigger(e);
I try this but this not work :/

VimL: VSPLIT with width specified as a function of total width

I want to write a vim script that opens a new window with vsplit, where the width of the new window is equal to the total number of columns minus 90.
The result would be, the current window would be 90 columns wide (to view 80 cols of code + gutter) and the new vsplit would occupy whatever part of the screen is left over.
If I understand vsplit correctly, :vsplit 90 specifies the window being created should be 90 columns. Is there a way to get the current number of columns in a window into a variable?
let cur_cols = [insert magic here]
let win_width = cur_cols - 90
execute "vsplit ". win_width
Use winwidth to find width of window. winwidth returns width as the no. of characters window can accommodate. In your case, use
let cur_cols = winwidth(0)
Here the parameter 0 refers to current widow. For more information,
:help winwidth
:help :vsplilt

Debugging this jade+coffeescript code on Express4 server

I am looking for some help as I don't know how bad those lines of codes are.
I am trying to adapt this original Codepen.io work (http://codepen.io/ettrics/pen/Jdjdzp/ , by Ettrics) for one of my teaching project. I run my web page on a Express4+Stylus+Coffescript Node's server.
The CoffeeScript file:
# Each popup takes the entire window, so it is a modal
Modal = ->
# Make it easier for yourself by not having to type as much to select an element (QuerySelectorAll)
$qsa = (el) ->
document.querySelectorAll(el)
trigger = $qsa('.modal__trigger') # What you click to activate the modal
modals = $qsa('.modal') # The entire modal (takes up entire window)
modalsbg = $qsa('.modal__bg') # The entire modal (takes up entire window)
content = $qsa('.modal__content') # The inner content of the modal
closers = $qsa('.modal__close') # An element used to close the modal
isOpen = false
contentDelay = 100 # Duration after you click the button and wait for the content to show
len = trigger.length
getId = (event) ->
event.preventDefault()
# Get the value of the data-modal attribute from the button
modalId = this.dataset.modal
# Remove the '#' from the string
len = modalId.length
modalId = modalId.substring(1, len)
# Select the modal we want to activate
modal = document.getElementById(modalId)
# Execute function that creates the temporary expanding div named fakeDiv
makefakeDiv(this, modal)
makefakeDiv = (self, modal) ->
fakeDiv = document.getElementById('modal__temp');
# If there isn't a 'fakeDiv', create one and append it to the button that was
# clicked. after that execute the function 'moveTrigger' which handles the animations.
if fakeDiv?
fakeDiv = document.createElement('div')
fakeDiv.id = 'modal__temp'
self.appendChild(fakeDiv)
moveTrigger(self, modal, fakeDiv)
moveTrigger = (trigger, modal, div) ->
triggerProps = trigger.getBoundingClientRect()
modalProps = modal.querySelector('.modal__content').getBoundingClientRect()
xc = window.innerWidth / 2
yc = window.innerHeight / 2
######## VOIR LE CSS !!
# This class increases z-index value so the button goes overtop the other buttons
trigger.classList.add('modal__trigger--active')
# These values are used for scale the fakeDiv div to the same size as the modal
scaleX = modalProps.width / triggerProps.width
scaleY = modalProps.height / triggerProps.height
scaleX = scaleX.toFixed(3) # Round to 3 decimal places
scaleY = scaleY.toFixed(3)
# These values are used to move the button to the center of the window (to pepare the ease out effect)
transX = Math.round(xc - triggerProps.left - triggerProps.width / 2)
transY = Math.round(yc - triggerProps.top - triggerProps.height / 2)
# If the modal is aligned to the top then move the button to the center-y of the modal instead of the window
if modal.classList.contains('modal--align-top')
transY = Math.round(modalProps.height / 2 + modalProps.top - triggerProps.top - triggerProps.height / 2)
# Translate button to center of screen
trigger.style.transform = 'translate(' + transX + 'px, ' + transY + 'px)'
trigger.style.webkitTransform = 'translate(' + transX + 'px, ' + transY + 'px)'
# Expand fakeDiv to the same size as the modal
div.style.transform = 'scale(' + scaleX + ',' + scaleY + ')';
div.style.webkitTransform = 'scale(' + scaleX + ',' + scaleY + ')'
# Smart animation API used to open
window.setTimeout( ->
window.requestAnimationFrame(open(modal, div))
, contentDelay)
open = (modal, div) ->
if !isOpen
# Select the content inside the modal
content = modal.querySelector('.modal__content')
# Reveal the modal
modal.classList.add('modal--active')
# Reveal the modal content
content.classList.add('modal__content--active')
###
# When the modal content is finished transitioning, fadeout expanding
# fakeDiv so when the window resizes it isn't visible ( it doesn't
# move with the window).
###
content.addEventListener('transitionend', hidefakeDiv, false)
isOpen = true
hidefakeDiv = ->
# Fadeout fakeDiv so that it can't be seen when the window is resized
div.style.opacity = '0'
content.removeEventListener('transitionend', hidefakeDiv, false)
close = (event) ->
event.preventDefault()
event.stopImmediatePropagation()
target = event.target
div = document.getElementById('modal__temp')
###
# Make sure the modal__bg or modal__close was clicked, we don't
# want to be able to click inside the modal and have it close.
###
if isOpen and target.classList.contains('modal__bg') or target.classList.contains('modal__close')
# Make the hidden div visible again and remove the transforms so it scales back to its original size
div.style.opacity = '1'
div.removeAttribute('style')
###
# Iterate through the modals, modal contents and triggers to remove their active classes.
# Remove the inline css from the trigger to move it back into its original position.
###
for i in [0..len]
modals[i].classList.remove('modal--active')
content[i].classList.remove('modal__content--active')
trigger[i].style.transform = 'none'
trigger[i].style.webkitTransform = 'none'
trigger[i].classList.remove('modal__trigger--active')
# When fakeDiv opacity is 1 again, we want to remove it from the dom
div.addEventListener('transitionend', removeDiv, false)
isOpen = false
removeDiv = ->
setTimeout( ->
window.requestAnimationFrame(div.remove())
, contentDelay - 50)
bindActions = ->
for i in [0..len]
trigger[i].addEventListener('click', getId, false)
closers[i].addEventListener('click', close, false)
modalsbg[i].addEventListener('click', close, false)
init = ->
bindActions()
{init: init}
window.onload = Modal.init
This coffeescript file is called in jade by
script(src='javascripts/coffee-script.js')
script(src='javascripts/modal.coffee', type='text/coffeescript')
I could not use the CoffeeScript compiler logs because the of the 'window.onload = Modal.init' which returned a "window is not defined" error. But browser console returns no error, Codepen neither.
I have to confess that I began to learn these 4 languages 3 days ago. So I basically don't know anything about anything... I don't even know if my app settings are right.
Can anyone give me a hand on this?
Thanks a lot! :)

How to set a header on excel page using apache POI?

I have a header which I need to set on every page that is printed on a dynamic excel sheet.
Is there any way to get the page number ?
As from swamy's comment the solution is to get the HSSFHeader from the HSSFSheet
HSSFHeader header = sheet.getHeader();
Then you can set left, center and right text including font, font style, font size, page number, date, time etc.
Example
header.setCenter(HSSFHeader.font("Calibri", "regular") +
HSSFHeader.fontSize((short) 14) + "My " + HSSFHeader.startBold() + "Styled" +
HSSFHeader.endBold() + " Text with page number " + HSSFHeader.page());
Result

Resources