Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Paste in Adobe photoshop
#1
Hi,
I am new to this program and I was trying to write a macro to automate the pasting of numbers from Excell to a picture in Adobe photoshop. It seemed to work initially but then the command 'Cv seems not to work properly. In Adobe you need to activate a particulaer window and then highlight the text to be able to paste. I did it and seemed to work, but when I try to repeat the operation and paste another number macro 2 does not activate properly the feature in Adobe and the pasting does not happen. Any suggestions?
Thanks Luisa
#2
I'd like to see the macro.
#3
Thank you for your reply. I like this program very much and was a bit upset with its behavior in this sort of easy case. Find attached the text of the macro I wrote. There are some commands that help me open and close the files I need and they are connected to my directories but, I am sure you can figure that out.

As I told you in another e-mail I sent to your support, I ran the script for 100 files to be created and I think 50% of the time it was pasting the other one not.

Looking forward to hearing soon from you,
Cheers Luisa


Attached Files
.txt   function for above program.txt (Size: 190 bytes / Downloads: 480)
.txt   macro quick time 2.txt (Size: 1.96 KB / Downloads: 885)
#4
The attached macros are unreadable.

Place them in a folder, export to a file (menu File -> Export), and attach the file. Or, export them separately.

Or, copy text using menu Edit -> Other formats -> Copy BBCode or Copy escaped. Then paste here directly, not as attachments.
#5
Hi,

find below the text of the macro and function which is called inside.

Cheers Luisa

--------------------------------

Macro:

int i=1
int N=100
str s
str file_name
str file_name2

------- Clean directories -----------------
del- "C:\WINDOWS\Desktop\overseas 100\files to convert\*.*"
del- "C:\WINDOWS\Desktop\overseas 100\files converted bmp\*.*"
---------- copy files in files to convert and open in adobe---------

cop "C:\WINDOWS\Desktop\overseas 100\OVERSEAS BRAND REF.psd" "C:\WINDOWS\Desktop\overseas 100\files to convert\OVERSEAS BRAND REF.psd"

--------- Input Excell file name -------------------
mes- "Excell File Name"
out "Excell file name"
inp file_name
out file_name
file_name+".xls"
file_name2=file_name
file_name2-"Microsoft Excel - "
out file_name2
file_name-"C:\WINDOWS\Desktop\overseas 100\"
out file_name

---------- Open Adobe and Excell --------
run "C:\WINDOWS\Desktop\overseas 100\files to convert\OVERSEAS BRAND REF.psd"
10
out "adobe "

run file_name
5
out "Excell"

int w1=act(win(file_name2 "XLMAIN"))
act w1
1
move_in_excell(file_name2 "C2")
3
int w3=act(win("" "PSFloatC"))

---------------- Activate Adobe -----------
g1
act w3
2
lef 69 99 w3
2
out i
dou 69 99 w3
2
act win("Adobe Photoshop" "Photoshop")
'Cv
10
out i
act w3
lef+ 69 99 w3
lef- 70 99 w3
2
out i
s=i
out s
men 33 "Adobe Photoshop"
int w4=act(win("Save As" "#32770"))
outp s
lef 374 213 w4

if(i=N)
act w1
clo w1
int w2=act(win("Microsoft Excel" "#32770"))
lef 205 90 w2
act win("Adobe Photoshop" "Photoshop")
int w5=act(win("Adobe Photoshop" "Photoshop"))
2
lef 405 91 w5
2
'Cw
4
end
else out "continuo"

------------------ Copy from Excell ----------
i=i+1
out "before jump"
out "i value="; out i
out "N/2+1"; out N/2+1
if(i=N/2+1) goto g2; else goto g3

g2
move_in_excell(file_name2 "G2")
out "going on 2nd column"
out i
goto g4


g3
out "still in first column"
act w1
2
'Y
2
dou 511 79 w1
'Cc
2
g4
out "jumped to g4"
goto g1




FUNCTION

/
function lpstr's1 str'cell
out s1
int w1=act(win(s1 "XLMAIN"))
2
'Y
1
'Cg
5
int w3=act(win("Go To" "bosa_sdm_XL9"))
outp cell
lef 136 249 w3

dou 402 82 w1
1
'Cc
2
ret
#6
Code:
Copy      Help
opt clip 1

Try to insert this at the beginning of the macro, and at the beginning of the function too. This command disables clipboard restoring.

Normally, outp and other clipboard commands restore clipboard text. To give application time to retrieve text from the clipboard, restoring occurs with about 1 s delay. This can conflict with key Cc and key Cv.
#7
Thanks, I will give it a try and let you know probably on Monday, Have a great week end. Luisa
#8
No, clipboard restoring don't conflict with 'Cc. But try opt clip 1 anyway.

Code:
Copy      Help
,act win("Adobe Photoshop" "Photoshop")
,'Cv

What you think is the reason why pasting does not work?:
1. When Photoshop window is activated, the area where the macro must paste does not receive focus. Even when you insert a delay before 'Cv. In this case, pasting manually also would not work until you click it.
2. The clipboard is empty. To test, use this: out _s.getclip
3. ...
[/code]
#9
Hi,
I am back. I was busy working. I tried what you suggested and somehow it did work better, but not totally perfect. Over 20 files I created the number was correctly pasted in the adobe file 17 times, surely better than before. I also ran the macro with out _s.getclip as you suggested and it seems like the right number is in the clippord but for some reason it does not paste it in a random fashion I would say.
Concerning your observation in point 1, when the macro runs it highlights the area where I want to paste the number as it happens when I do it manually, but sometimes the number is not pasted.
Any further suggestions?
Cheers Luisa
#10
Maybe try to replace 'Cv to

Code:
Copy      Help
1
key+ C
0.5
key+ v
0.5
key- v
0.5
key- C
#11
Or, try to replace 'Cv to menu Edit -> Paste or similar:

Code:
Copy      Help
key A{ep}

Or, use men. In QM, click menu Tools -> Record Menu. Then click menu Edit -> Paste in Adobe.

Or, use WM_PASTE:

Code:
Copy      Help
SendMessage child WM_PASTE 0 0
#12
Hi,
Thank you very much for your suggestions. The first one was the one that worked. I created my 100 files and the pasting happened with no fail.
I really like QM it is a great tool and fun to work with.
Cheers Luisa


Forum Jump:


Users browsing this thread: 3 Guest(s)