AutoHotkey Community

It is currently May 27th, 2012, 6:43 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 13 posts ] 
Author Message
 Post subject: Using clipboard
PostPosted: August 3rd, 2011, 8:48 pm 
Offline

Joined: July 10th, 2011, 5:03 am
Posts: 272
Hey guys,

I want to check the data contained in the clipboard.

Eg

Quote:
If clipboard=1 Click button1


Except so far that is not working. Could someone let me know whats wrong with that expression?

ty

Ben


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 3rd, 2011, 8:50 pm 
Offline

Joined: December 26th, 2010, 7:40 pm
Posts: 4172
Location: Awesometown, USA
Code:
If Clipboard = 1
   Click

_________________
Autofire, AutoClick, Toggle, SpamWindow Control Tools
Recommended: AutoHotkey_L


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 3rd, 2011, 9:47 pm 
Offline

Joined: July 10th, 2011, 5:03 am
Posts: 272
Hi thanks for the response;

I tried this exact code and the click wasn't executed on button1.

Quote:
IfWinExist Enter positions
Winactivate

If clipboard = 1
Click


I also tried this to no avail;


Quote:
IfWinExist Enter positions
Winactivate

If clipboard = 1
Click Button1


I'm really stumped as to why this isn't working.

I'm 100% that
a) 1 is copied to the clipboard
b)the button I'm trying to click is button1
c)The window exists


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 3rd, 2011, 9:55 pm 
Offline

Joined: December 26th, 2010, 7:40 pm
Posts: 4172
Location: Awesometown, USA
Loop - your code only executes once
ControlClick vs Click - understand the difference

_________________
Autofire, AutoClick, Toggle, SpamWindow Control Tools
Recommended: AutoHotkey_L


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 3rd, 2011, 9:57 pm 
Offline

Joined: July 10th, 2011, 5:03 am
Posts: 272
Sorry I should have mentioned I used ControlClick also.

The problem is in my expression on the line that uses the clipboard variable, as when I remove that line and run it it executes fine.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 3rd, 2011, 10:24 pm 
Offline

Joined: April 8th, 2009, 7:49 pm
Posts: 6073
Location: San Diego, California
Hi bmoore45, welcome to the forum.

In AutoHotkey, the variable named "Clipboard" refers to the clipboard for Windows that is used in common amoung programs
"http://www.autohotkey.com/docs/misc/Clipboard.htm

The following AHk script will show my what is on the clipboard.

For example:
Say I had Notepad open, typed a 1 and used ^c to copy that character to the clipboard.
Pressing F1 with the script running would show me the 1 on the clipboard.

Using a script like the following is kinda weird.
Code:
 IfWinExist Enter positions
Winactivate

If clipboard = 1
Click


To make it click, you have to copy (or store a value in the variable cliboard, and then run the program "Enter positions" and then run the script. Or at least use a a hotkey to run the few lines.

What is it you are really trying to do?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 3rd, 2011, 10:44 pm 
Offline

Joined: July 10th, 2011, 5:03 am
Posts: 272
Hi, thx for the welcome :D

I'm using an excel document as a makeshift GUI- where "1" entered into an input cell means that its corresponding option will be checked on the program I'm trying to interact with.

This might help:
Image
So if this was read as it was it is now it would generate a daily graph, and not a weekly or a monthly.

So the idea is to copy each pink cell's data and if it contains a '1' then I'll use controlclick to activate what it represents.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 3rd, 2011, 10:47 pm 
Offline

Joined: April 8th, 2009, 7:49 pm
Posts: 6073
Location: San Diego, California
bmoore45 wrote:
Hi, thx for the welcome :D

I'm using an excel document as a makeshift GUI- where "1" entered into an input cell means that its corresponding option will be checked on the program I'm trying to interact with.


Is excel used for any other purpose, or just for the GUI?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 3rd, 2011, 11:00 pm 
Offline

Joined: July 10th, 2011, 5:03 am
Posts: 272
Just for the gui


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 3rd, 2011, 11:10 pm 
Offline

Joined: April 8th, 2009, 7:49 pm
Posts: 6073
Location: San Diego, California
an AHk gui would:

1. look nicer (IMHO)
2. easier to use and faster to open then Excel
3. doesn't need the clipboard


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 3rd, 2011, 11:30 pm 
Offline

Joined: April 8th, 2009, 7:49 pm
Posts: 6073
Location: San Diego, California
For example:
Code:
#singleinstance force

wintitle=Enter positions
wintitle=junk1698.ahk; <--- this is the name of this script file
                     ;        I left the file open in notepad

gui, add, text, ,What type of graph do you want?
gui, add, button,  gday, Daily
gui, add, button, x+10 yp gweek, Weekly
gui, add, button, x+10 yp gmonth, Monthly
gui, show,,my_gui
return

day:
what_to_click=x65 y168
goto do_it

week:
what_to_click=x109 y183
goto do_it

month:
what_to_click=x19 y200

do_it:
IfWinExist Enter positions
Winactivate
ControlClick , %what_to_click%, %wintitle%, , Left, 1

sleep, 4000
Winactivate my_gui
return

esc::exitapp
f12::reload

guiescape:
guiclose:
exitapp


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 4th, 2011, 12:47 am 
Offline

Joined: July 10th, 2011, 5:03 am
Posts: 272
Thanks, I'm working with gui creator and am finding it very tough to figure out, that was the only reason I tried to work with excel. Guess I have to bite the bullet.. lol


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 8th, 2011, 4:14 pm 
Offline

Joined: March 23rd, 2005, 7:53 am
Posts: 321
Location: Germany
Hi bmoore45,

if you copy a cell in Excel the clipboard always not only keeps the cell content but an additional line break. So your clipboard contains "1\n". You only have to remove the last character to get the desired result.

_________________
Hasso

Programmers don't die, they GOSUB without RETURN


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: batto, Bing [Bot], JSLover, sjc1000 and 64 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group