autohotkey not working for CarbonPoker application - automation

I've tested my script on other windows, such as the Calculator (so it's not simply a problem with my script), but when I'm running the CarbonPoker application, the table window won't move. I can activate the window, and I can get the title and display it with MsgBox, but I can't get it to move.
I've tried
WinMove,0,0
and I've tried
WinGetTitle, Title, A
WinMove,ahk_id %Title%,, %xval%,%yval%,%width%,%height%
and I've tried
WinMove,%Title%,, %xval%,%yval%,%width%,%height%
Are there some applications which can't have their windows moved? Or is there a way to still do it for such applications? Thanks.

Code Updated. Now you can move window if it is overlapped by other window. Also added variable for WinTitle.
You can also try to move window other way:
CoordMode, Mouse, Screen ;sets coordinate mode relative to screen.
DestX:=200 ; the x coordinate of the point where you want to see left upper point of window.
DestY:=10 ; the y coordinate of the point where you want to see left upper point of window.
WinTitleVar:="Notepad" ; The part of WinTitle of window that we need to move.
;Here are shift variables. What they meen? You cant just drug by left upper corner of window. You need to shift slightly right and down to be able to drag window. That variables are giving that shift to your coordinates.
ShiftX:= 30 ; shift for x coordinate.
ShiftY:= 10 ; shift for y coordinate.
DestX:= DestX + ShiftX ; apply shift to DestX .
DestY:= DestY + ShiftY ; apply shift to DestY .
SetTitleMatchMode, 2 ; Whith that command a window's title can contain WinTitle anywhere inside it to be a match. It is for WinGetPos command. You can remove this command, but then you need to use exact title in WinGetPos command.
WinGetPos, InitX, InitY,,, %WinTitleVar% ; get current upper left position of notepad window.
InitX:= InitX + ShiftX ; apply shift to InitX .
InitY:= InitY + ShiftY ; apply shift to InitY .
WinActivate, %WinTitleVar% ; Activates Window. This command is here in cases if other window overlaps the window that we need to move.
Click, Left, Down, %InitX%, %InitY% ; Click the left button but dont release it at the shifted coordinates of current window location.
MouseMove, %DestX%, %DestY% ; Move mouse to the shifted destination coordinates.
Click, Left, Up ; Release Left mouse button.
I commented code as much as possible but if you have any questions feel free to ask.

First, if your other application is being run as administrator, then your script also needs to be run with the same administrator permissions. I would check this first.
Next, you can try using the hwnd instead of the title:
; hover mouse over the window, and press f3 to move window
f3::
MouseGetPos,,, hwnd
WinMove, ahk_id %hwnd%,, 0, 0
return

Related

TornadoFX modal window shifting position after each opening

im having a little positioning problem with TornadoFX (JavaFX) openModal() window. I have a main table with some data, and after doubleclick it opens a little modal window with a table with 3 columns and buttons. Every time I open the window, it will shift to the right and down a little. So after 12-15 opening-closing on FullHD, the bottom of the window will be out of the bounds, meaning I cant see the bottom buttons of the modal window.
OpenModal is using standard x,y position calculation taken from Component.kt:
x = owner.x + (owner.width / 2) - (scene.width / 2)
y = owner.y + (owner.height / 2) - (scene.height / 2)
How is the calculation of coordinates after every opening a little off to the right and down.
I want to open my modal window to open everytime on the center of the screen.
I have made some corections, but I can only apply it when function onDock is caled, and after that the window is centered, but it just jumps back to the center when onDock is caled.
Is openModal bad for consecutive openings, should I use something else to open new window?

How to set the origin of a cube to its apex in blender?

For a cube with location (0, 0, 0) I wont it's apex to be at the origin of the coordinate system.
(apex = left bottom front point of the cube)
I tried Tools > Edit > Set Origin.
But it's not possible to achieve what I described.
So how to do this?
If it is blender 2.8+, then:
Press TAB, then select vertex you want to be an origin point.
SHIFT + S, then Cursor to Selected.
Again TAB, Right mouse click, then Origin to 3D Cursor
If not:
Press TAB, then select vertex you want to be an origin point.
SHIFT + S, then Cursor to Selected.
Again TAB, then SHIFT+CTRL+ALT+C, then Origin to 3D Cursor

IntelliJ IDEA non standard caret behaviour

I have an issue with IntelliJ IDEA when selecting a big amount of text, and I cannot find the parameter to set to change that. Here is an example of the situation:
My caret is on line 3
I scroll with the mouse wheel towards line 300
I press ctrl + shift
I press the left button of the mouse
Such an action would result in the text from line 3 to 300 being selected in all common editors (even in MS-Word I think), but not in IntelliJ.
Do you know how to set this right?
Thanks!
Why ctrl+shift? Shift is enough to select those lines in most editors, ctrl is most commonly used to add additional items (for example, two ranges with shift).
Ctrl + Shift + Left Click is "Navigate to Type Declaration" in IDEA. See here.

Autohotkey Win XP automating small task

I have a small task I would like to automate with Autohotkey and it looks like it is more or less directly transferable to autohotkey syntax:
1. Ctrl+v
2. Alt+tab
3. Click certain link in a window (no combo-key for this but it's always in the same place)
4. Enter (carriage return)
5. Alt+s
6. Ctrl+v
7. Enter
Now it would be nice to map this combo to something else e.g. Windows Key+Space.
What I have got so far is:
0. SetWinDelay 100 (using a connection to an remote computer)
0. SetKeyDelay 0
1. Send, ^c
1. ClipWait, 0.1
2. Send, {Alt down}{tab}
2. Send, {Alt up}
3. ?????
4. Send, {enter}
5. Send, !s
6. Send, ^v
7. Send, {enter}
Is this approximately right? Anyone up for helping me fix it or filling in the holes, so to speak :)
Another alternative to step 3, 4 and 6 would be to simply loop though the contents of the clipboard (a number string) and sending each letter of the string to keypresses? Maybe this would be the easier way
If you want to "click" on a certain position, to open a menu, you can first right click on your AutoHotKey icon and open the "window spy". This window spy will show you the mouse position. Yo can use the mouse positions to perform your actions in the active application.
Example:
SoundBeep 1000, 300 ; Wake up user
SplashTextOn, 200, 100, Script Preparations, Please Click on the person icon link. ; Show new Instructions text
WinMove, Script Preparations,, (A_ScreenWidth/2)+150, (A_ScreenHeight/2)+200 ; Move the window with the name "Script Preparations" Down and Right on the main screen
KeyWait, LButton, D ; Wait for LeftMouseButton click Down
MouseGetPos, xposE ,yposE ; Store the position where the mouse was clicked (Employee)
MouseClick, left, %xposE% ,%yposE%, 2 ; Perform a double mouse click on the captured mouse location
SplashTextOff ; Remove Text box
In this case, I first ask the user to manually click on the right location. This is only required when the position to click changes WITHIN the active window (variable tiles within the active window). Once you have the position stored, you can re-use it all throughout your script.
b.t.w. instead of using Alt+Tab, I suggest using this:
settitlematchmode, 1 ; Set search in title to start with....
settitlematchmode, Fast ; Slow is not required here. Slow is only required when hidden text needs to be found.
SwitchWindow("Microsoft Excel - 1 QRM Upload and Change Template") ; Activate the
window with the title: Microsoft Excel - 1 QRM Upload and Change Template
You could even use someting like this:
SetTitleMatchMode, 2 ; Ensure that the Title Match mode is set to 2: Find anywhere in the title
SetTitleMatchMode, Fast ; Ensure that the Title Match mode is set to FAST
winactivate, %WindowName% ; Activate the window with the title stored in the variable WindowName
WinWaitActive, %WindowName%, , 5 ; Wait up to five seconds for the screen
if ErrorLevel ; Execute this when the window is not activated within 5 seconds
{ ; Start-If Wait failed
SoundBeep 1000 , 1000 ; Warn the user
MsgBox,4097,Time Out, Script timed out while waiting for %WindowName%.`n`rYou Must manually activate %WindowName% and then continue the script by pressing OK. ; Message to user
IfMsgBox, Cancel ; Do when the user clicked on Cancel
{ ; Start-If User clicked Cancel
ExitApp ; Exit this program when the user clicked on Cancel
} ; End-If User clicked Cancel
WinWaitActive, %WindowName%, , 5 ; Try to activate the window AGAIN
if ErrorLevel ; If window can't be found
{ ; Start-If window can't be found
MsgBox,4096,Exit, %WindowName% still NOT Active. ; Warn user
ExitApp ; Exit this program when the expected window is still not found
} ; End-If window can't be found
} ; End-If Wait failed
Regards,
Robert Ilbrink

How to Select Columns in Editors (Atom,Notepad++, Kate, VIM, Sublime, Textpad,etc) and IDEs (NetBeans, IntelliJ IDEA, Eclipse, Visual Studio, etc) [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Closed 1 year ago.
Locked. This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions.
How to select columns in Editors and IDEs to columnar delete, insert or replace some characters ?
Editors:
Atom
Notepad++
Kate
VIM
Sublime
Emacs
Textpad
Emerald Editor
UltraEdit
MCEdit
jEdit
Nedit
IDEs:
NetBeans
Eclipse
Visual Studio
IntelliJ IDEA
Flash Builder
Aptana Studio
Notepad++, Visual Studio, and some others: Alt + drag.
vim: Ctrl + v or (bizarrely enough) Quad-click-drag. In windows: Ctrl + Q (since Ctrl + V is the standard for paste)
In Kate toggle Ctrl + shift + B .
In Netbeans 7.1 can select columns (Rectangular Selection) with Ctrl + shift + R . There is also a button in the code editor available.
This is how rectangular selections look like:
Eclipse used to need a column mode plugin to be able to select a rectangular selection.
Since Eclipse 3.5, you just need to type Alt+Shift+A: see its News and Noteworthy section. (On OS X it's Option-Command-A.)
Or activate the 'Editor Presentation' action set ( Window > Customize Perspective menu) to get a tool bar button for toggling the block selection mode.
AmbroseChapel adds in the comments:
This is a toggle.
Columnar selection is a mode you enter and leave: in other words, Eclipse switches into a mode where all mouse selections have to be columnar and you stay in that mode until you switch back (by using the same command again).
It's not like other editors where columnar selections are enabled only while certain keys are down.
In vim column visual mode is Ctrl + v. If that is what you meant?
SublimeText 2, 3, and 4
Using the Mouse
Different mouse buttons are used on each platform:
OS X
Left Mouse Button + Option
OR: Middle Mouse Button
Add to selection: Command
Subtract from selection: Command+Shift
Windows
Right Mouse Button + Shift
OR: Middle Mouse Button
Add to selection: Ctrl
Subtract from selection: Alt
Linux
Right Mouse Button + Shift
Add to selection: Ctrl
Subtract from selection: Alt
Using the Keyboard
OS X
ctrl + shift + ↑
ctrl + shift + ↓
Windows
ctrl + alt + ↑
ctrl + alt + ↓
Linux
ctrl + alt + ↑
ctrl + alt + ↓
Source: SublimeText2 Documentation
You didn't explicitly state emacs, but since you've highlighted lots of editors...
In emacs, you can use rectangles for this, where a column is a rectangle of width 1.
To create a rectangle, mark the top-left and bottom-right of the rectangle (where the bottom-right mark is one to the right of the further right point included in the rectangle. You can then manipulate via:
C-x r k
Kill the text of the region-rectangle, saving its contents as the "last killed rectangle" (kill-rectangle).
C-x r d
Delete the text of the region-rectangle (delete-rectangle).
C-x r y
Yank the last killed rectangle with its upper left corner at point (yank-rectangle).
C-x r o
Insert blank space to fill the space of the region-rectangle (open-rectangle). This pushes the previous contents of the region-rectangle rightward.
M-x clear-rectangle
Clear the region-rectangle by replacing its contents with spaces.
M-x delete-whitespace-rectangle
Delete whitespace in each of the lines on the specified rectangle, starting from the left edge column of the rectangle.
C-x r t string RET
Replace rectangle contents with string on each line. (string-rectangle).
M-x string-insert-rectangle RET string RET
Insert string on each line of the rectangle.
In IntelliJ IDEA, you can switch the selection mode with Alt + Shift + Insert combination. You can also column select by keeping the middle mouse button (i.e. the scroll wheel button) pressed and dragging.
on Kate
Ctrl + Shift + B also allows you to add more columns by simply clicking anywhere and paste it.
I used this when saving text files I copied from Google Translate as a side-by-side view.
This feature is not available in older versions of Netbeans (up to 7.1) and the plugin is not supported anymore.
A plugin is now available for NetBeans 6.9.
In TextMate with the mouse: start a selection and keep alt pressed while you move the cursor.
Without the mouse: first select normally using ⇧ and arrows then hit alt and move the cursor.
in Notepad++ , you can select a particular column holding ctrl + alt + shift and then left click mouse button and drag to select.
In TextPad:
With the mouse, Left-Click + Alt + Drag. Note that if you first use Alt, and then Click-and-drag, it does not work (at least for me). Ctrl+Alt instead of Alt also Works.
For pure keyboard, no mouse, enable Block Select Mode with Ctrl+Q, B.
Or use the sequence Alt, C, B, to do it via the Configure menu.
Warning 1: if Word Wrap is enabled, then Block Select Mode will not be available (which is somewhat logical). First disable Word Wrap. This was causing me some trouble, and this gave me the answer.
Warning 2: if you mean to insert text in every selected row by typing, you have to use Edit, Fill Block. Other editors let you type in directly.
In Ultra Edit and Crimson (or Emerald) Editor you can enable/disable the column mode with Alt + C
In textpad.
Go to left top of the page.
hold "shift key
Now use right arrow key to select column.
Now click "down arrow" key.
And the entire column will be selected.
jEdit:
With the keyboard: press Alt-\ (Opt-\ in Mac OS X) to toggle between rectangular and normal selection mode; then use Shift plus arrow keys to extend selection. You can switch back to regular selection mode with another Alt-\ (Opt-\ in Mac OS X), if desired.
With the mouse: Either use Alt-\ (Opt-\ in Mac OS X) as above to toggle rectangular selection mode, then drag as usual; or Ctrl-drag (Cmd-drag in Mac OS X). You can switch back to regular selection mode with another Alt-\ (Opt-\ in Mac OS X), if desired.
Actually, you can even make a non-rectangular selection the normal way and then hit Alt-\ (Opt-\ in Mac OS X) to convert it into a rectangular one.
In MCEdit toggle Shift+F3 (ie F13) or F9->Edit ->Mark columns.
P.S. In this case, MCEdit is an editor written for the Midnight Commander.
In Sublime3 (Windows):
Some users may get an inverted screen using the Ctrl+Alt+▲ in windows. To Solve this go to
Preferences->Key Bindings-User
And add these two lines at the end of the file just before closing brackets:
{ "keys": ["ctrl+alt+pageup"], "command": "select_lines", "args": {"forward": false} },
{ "keys": ["ctrl+alt+pagedown"], "command": "select_lines", "args": {"forward": true} }
Or use your own keys.
If you're using Nedit under Cygwin-X (or any platform for that matter), hold down the Ctrl key while selecting text with the left mouse.
Additionally, you can then drag the selected "box" around in an insert mode using the depressed left-mouse button or in overwrite mode by using Ctrl+left-mouse button.
With Nedit you can do several operations with selected column:
CTRL+LEFT-MOUSE -> Mark Rectangular Text-Area
MIDDLE-MOUSE pressed in area -> moving text area with pushing aside other text
CTRL+MIDDLE-MOUSE pressed in marked area -> moving text area with overriding aside text and deleting text from original position
CTRL+SHIFT+MIDDLE-MOUSE pressed in marked area -> copying text area with overriding aside text and keeping text from original position
In Flash Builder (v 4.5 and up), and Aptana Studio (at least v 2.0.5) there is a toolbar button to toggle block select. It is between the 'mark occurrences' and 'show whitespace characters' buttons. There is also a Alt + Shift + A shortcut. Not surprisingly, this is basically the same as for Eclipse, but I'm including here for completeness.
For any editor, you can use the below shortcuts. These shortcuts work for every text area also.
Shift + UpArrow/DownArrow - this will select text line by line
Ctrl + Shift + LeftArrow/RightArrow - this will select text word by word
Ctrl + BackSpace - this will delete text word by word