Please Help woth Simple Copy and Paste Script
-
- Posts: 9
- Joined: 31 May 2019, 10:06
Please Help woth Simple Copy and Paste Script
I've spent the last two hours trying to figure this out and I just can't get it.
I need a simple script that presses CTRL C to copy an image that im currently viewing, then Alt Tab to switch the the previous window and CTRL V to paste a copy of that image then Atl Tab to switch back to the image.
Below is what I have and I cant seem to get it.
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
^z::
Send {^c}
Send {AltTab}
Send {^v}
Send {AltTab}
Return
I need a simple script that presses CTRL C to copy an image that im currently viewing, then Alt Tab to switch the the previous window and CTRL V to paste a copy of that image then Atl Tab to switch back to the image.
Below is what I have and I cant seem to get it.
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
^z::
Send {^c}
Send {AltTab}
Send {^v}
Send {AltTab}
Return
Re: Please Help woth Simple Copy and Paste Script
I have tried a number of times over the years to get alt+Tab to work, but it never works, no matter how I write it.
As for the point about how something is written, I don't use send very often, but I'm not sure Send,{AltTab} is a thing.
Try,
I have seen others say that it works for them, so maybe it will work for you. It has never worked for me though.
If sending Alt+Tab is not a route you end up being able to take, there are a few other ways that you can get the outcome you want. A simple one is to hard code swapping between two known windows. If it's basically always the same two windows, this is a simple enough process to script.
As for the point about how something is written, I don't use send very often, but I'm not sure Send,{AltTab} is a thing.
Try,
Code: Select all
Send, {Alt Down}{Tab}{Alt Up}
If sending Alt+Tab is not a route you end up being able to take, there are a few other ways that you can get the outcome you want. A simple one is to hard code swapping between two known windows. If it's basically always the same two windows, this is a simple enough process to script.
Re: Please Help woth Simple Copy and Paste Script
After some playing around I got it to work using this.
hope that helps.
Code: Select all
*Numpad3::
Send,^c
ClipWait
run C:\Users\Default\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\Window Switcher.lnk
sleep,100
send,{enter}
sleep,100
Send,^v
run C:\Users\Default\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\Window Switcher.lnk
sleep,100
send,{enter}
return
-
- Posts: 2
- Joined: 31 May 2019, 11:28
Re: Please Help woth Simple Copy and Paste Script
Send {AltTab} not work
Why not use Send, !{Tab}
Why not use Send, !{Tab}
Last edited by thienphuongx on 05 Aug 2019, 16:40, edited 1 time in total.
Re: Please Help woth Simple Copy and Paste Script
Does that switch windows for you? Doesn't for me.
-
- Posts: 2
- Joined: 31 May 2019, 11:28
Re: Please Help woth Simple Copy and Paste Script
I used to win 7 64 bit, And you?
Last edited by thienphuongx on 05 Aug 2019, 16:39, edited 1 time in total.
Re: Please Help woth Simple Copy and Paste Script
Win 8.1 64 bit
Re: Please Help woth Simple Copy and Paste Script
Try this:
It will ensure your control and alt keys are firmly pressed while hitting the c and v for copy paste
Note: In case your wondering what the hell that L means, its basically the left control/alt key, you can use R for right but I think L is more practical
Code: Select all
^z::
Send {lcontrol down}c{lcontrol up}
Send {lalt down}{tab}{lalt up}
Send {lcontrol down}v{lcontrol up}
Send {lalt down}{tab}{lalt up}
Return
*Numpad3::
Send {lcontrol down}c{lcontrol up}
ClipWait
run C:\Users\Default\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\Window Switcher.lnk
sleep,100
send,{enter}
sleep,100
Send,{lcontrol down}v{lcontrol up}
run C:\Users\Default\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\Window Switcher.lnk
sleep,100
send,{enter}
return
Note: In case your wondering what the hell that L means, its basically the left control/alt key, you can use R for right but I think L is more practical
Les medecins choisissent viagrasansordonnancefr.com sans danger pour la sante
-
- Posts: 9
- Joined: 31 May 2019, 10:06
Re: Please Help woth Simple Copy and Paste Script
I tried both of the suggested scripts with no success.
I tried with my environment variables and withourt and still no good.
What should the entire txt file look like? I must be missing something.
I tried with my environment variables and withourt and still no good.
What should the entire txt file look like? I must be missing something.
-
- Posts: 9
- Joined: 31 May 2019, 10:06
Re: Please Help woth Simple Copy and Paste Script
OK, I copied this into my file exactly as shown below and it works when I hit Ctrl Z. But maybe 30% of the time it does not swap back to the image.
^z::
Send {lcontrol down}c{lcontrol up}
Send {lalt down}{tab}{lalt up}
Send {lcontrol down}v{lcontrol up}
Send {lalt down}{tab}{lalt up}
Return
*Numpad3::
Send {lcontrol down}c{lcontrol up}
ClipWait
run C:\Users\Default\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\Window Switcher.lnk
sleep,100
send,{enter}
sleep,100
Send,{lcontrol down}v{lcontrol up}
run C:\Users\Default\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\Window Switcher.lnk
sleep,100
send,{enter}
return
^z::
Send {lcontrol down}c{lcontrol up}
Send {lalt down}{tab}{lalt up}
Send {lcontrol down}v{lcontrol up}
Send {lalt down}{tab}{lalt up}
Return
*Numpad3::
Send {lcontrol down}c{lcontrol up}
ClipWait
run C:\Users\Default\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\Window Switcher.lnk
sleep,100
send,{enter}
sleep,100
Send,{lcontrol down}v{lcontrol up}
run C:\Users\Default\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\Window Switcher.lnk
sleep,100
send,{enter}
return
Re: Please Help woth Simple Copy and Paste Script
From what to what program are you trying to switch(exe name will probably be enough...and if it's not QT window,WinMenuSelectItem will probably also work)
This for example checks every time you copy something if it is image and if it is,send it to xnview without switching windows
There are manu ways to change the script to not constantly keep alt+tabing
This for example checks every time you copy something if it is image and if it is,send it to xnview without switching windows
Code: Select all
#SingleInstance,Force
#NoEnv
#Persistent
OnClipboardChange("ClipChanged")
Return
ClipChanged() {
if DllCall("IsClipboardFormatAvailable", "Uint", 2)
WinMenuSelectItem,ahk_exe xnview.exe,,Edit,Import Clipboard
}
-
- Posts: 9
- Joined: 31 May 2019, 10:06
Re: Please Help woth Simple Copy and Paste Script
I would be looking at an image using the windows photo viewer when I execute the script. I simply want the image im looking at to be copied to the last folder I have had open.
-
- Posts: 9
- Joined: 31 May 2019, 10:06
Re: Please Help woth Simple Copy and Paste Script
So what would the entire script be?
Re: Please Help woth Simple Copy and Paste Script
Well if it is that simple,why don't you just use Ctrl+S without the need of a script.
You are pressing Ctrl+Z as a hotkey,the "S" is just a tinny bit higher.
When you choose a folder once,it will always save there
~^s::
keywait,s
WinWaitActive,Save As
Send,{Enter}
Return
You can also choose where to save by using ConrolSetText but as I said,if you save manually once and choose the folder,then after that everything will be saved there
You are pressing Ctrl+Z as a hotkey,the "S" is just a tinny bit higher.
When you choose a folder once,it will always save there
~^s::
keywait,s
WinWaitActive,Save As
Send,{Enter}
Return
You can also choose where to save by using ConrolSetText but as I said,if you save manually once and choose the folder,then after that everything will be saved there
Re: Please Help woth Simple Copy and Paste Script
You can get the file path by using the clipboard, as in this script:
How can you extract the full path of the photo visible in photo gallery? - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=48993&p=218126#p218126
And then use AHK's FileCopy to copy the file.
How can you extract the full path of the photo visible in photo gallery? - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=48993&p=218126#p218126
And then use AHK's FileCopy to copy the file.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
-
- Posts: 9
- Joined: 31 May 2019, 10:06
Re: Please Help woth Simple Copy and Paste Script
I'm sorry, but I don't really understand enough about this to make use of that information. If you could provide the script that I can copy that would be much appreciated.
-
- Posts: 9
- Joined: 31 May 2019, 10:06
Re: Please Help woth Simple Copy and Paste Script
Anybody who can offer some help here? The script works sporadically. Probably 50% of the time it copies the file, and 25% of the time it doesn't switch back to the photo.
-
- Posts: 9
- Joined: 31 May 2019, 10:06
Re: Please Help woth Simple Copy and Paste Script
I like the idea of using control S to designate the save to folder, but dont know enough to complete the script.
-
- Posts: 9
- Joined: 31 May 2019, 10:06
Re: Please Help woth Simple Copy and Paste Script
anybody willing to assist?
Re: Please Help woth Simple Copy and Paste Script
Do you want the image to always be saved to a specific folder
Do you still want to use Ctrl+Z or it can be another hotkey
Do you still want to use Ctrl+Z or it can be another hotkey