 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
tcp800
Joined: 01 Apr 2009 Posts: 16 Location: Netherlands
|
Posted: Wed Apr 01, 2009 8:00 pm Post subject: Who can help to get pastebeeper function. (paste exist) |
|
|
Problem:
Active on a social site with friendsrelations.
Use clipmagic to paste friendrequested user in notepathfile.
Don't want to trouble user twice ever to make him a friendrequest.
Looking for this solution:
I can paste from clipmagic to pastebpr.exe that searches in pastebpr.txt and beebs twice (false sound) on found(paste) else pastes to pastebpr.txt and beebs one time (ok sound).
pastebpr.txt format like in a notepath textfile.
I could not find this anywhere. Ok for any other solution with same ease of use. I have no scripting experience. Who likes to help? Can imagine this can be used for more applications.
If someone can give me a clue where to start to make it myself that's ok too, but that does not close my topic. I can imagine it might be to difficult for me to make it or whould take the rest of my life. d
Jos on tcp800. |
|
| Back to top |
|
 |
Guest
|
Posted: Thu Apr 02, 2009 11:26 am Post subject: |
|
|
| can you elaborate it more? |
|
| Back to top |
|
 |
tcp800
Joined: 01 Apr 2009 Posts: 16 Location: Netherlands
|
Posted: Thu Apr 02, 2009 1:14 pm Post subject: |
|
|
Hi Guest,
Ofcourse I can imagine more about, but i can not program, so my suggestions whould be of no interest. I think the main problem is posted well. So please ask me more specific where you don't understand it so I can put it in an other way.
Maybe clipmagic is not known. With that url and copy/paste utility you can safe your windows copies/clips to a file and get them sorted altered or if url open it. You casn install filters to sort the clips to folders or send them right away to an other program. It is a reliable program. You can paste from a list later. And keep the clips on stock. Clipmagic is active on browsing time. So url's and HTML content can be clipped and sorted out. These in my own words, and not quite a user manual.
So a clip taken from a site can be send rightaway to an other program. This program I called pastebpr.exe I coul have called it clipbpr.exe aswell.
Thanks for your attention Guest.
Jos from tcp800 |
|
| Back to top |
|
 |
tcp800
Joined: 01 Apr 2009 Posts: 16 Location: Netherlands
|
Posted: Thu Apr 02, 2009 1:50 pm Post subject: |
|
|
| Reading again, it might be of help that the clips to transport and process in this case are user url's from the social site I use to visit. |
|
| Back to top |
|
 |
hugov
Joined: 27 May 2007 Posts: 2181
|
Posted: Fri Apr 03, 2009 6:15 pm Post subject: |
|
|
Not sure what it is you want, but try this to start with | Code: | File=testpastelist.txt
Add=0
pastelist= ; this can be replaced by the fileread action
(
http://www.google.com/
http://www.yahoo.com/
)
FileDelete, %File%
FileAppend, %pastelist%, %File%
FileRead, FileList, %File%
; example 1: clipboard = http://www.autohotkey.com/ not in pastelist so should be added
; example 2: clipboard = http://www.google.com/ is in pastelist so should not be added
Clipboard = http://www.autohotkey.com/
Loop, Parse, FileList, `n, `r
{
If (Clipboard = A_LoopField)
Add:=!Add ; toggle so it will not ADD it when found
}
If (!Add) ; append to file because it wasn't found and beep
{
FileAppend, %clipboard%`n, %File%
SoundBeep
} |
_________________ Tut 4 Newbies
TF : Text file & string lib, TF Forum |
|
| Back to top |
|
 |
tcp800
Joined: 01 Apr 2009 Posts: 16 Location: Netherlands
|
Posted: Fri Apr 03, 2009 10:02 pm Post subject: |
|
|
Thanks Hugo,
Away from details this comes to what I need. This beebs when not there so, I can make the friendrequest to the candidate.
On run I have to open my browser with the social site,
When I have copied the url to the clipboard I guess I have to call the script. And do that over again for every new clip. I am not sure, but I think we have to asign a hotkey, that launches the script, or nest it in a loop that waits for the clip to be changed and run it again, isn't it?
I know you want me to test it and I will. To do that I will name this script pastebpr.ahk, right? Then I copy url_a to the clipboard and double click pastebppr.ahk and get beeb. Again for url_b and get beeb. And again for url_a and get no beep. Ofcourse url_a and url_b are none of your examples.
I will repeat your script in an other post to ask some explanation, please wait untill I ran the test and give you a report. |
|
| Back to top |
|
 |
tcp800
Joined: 01 Apr 2009 Posts: 16 Location: Netherlands
|
Posted: Fri Apr 03, 2009 10:20 pm Post subject: |
|
|
Hugo,
The test is ok, you can see I edited the script so it works for any string I clip. That is ok but as I wrote, it needs to launch more userfriendly
How can I get that?
And how can I get the java copy on top here? And what is the 'expand' for? Newbe indeed! It has been years I did some Basic on an Exidy Sorcerer with CP/M much like a Commodore 64. Did quite some dBase later in MS DOS days. And tried VB later but could not get in that tree high enough to really manage it.
File=testpastelist.txt
Add=0
;pastelist= ; this can be replaced by the fileread action
;(
;http://www.google.com/
;http://www.yahoo.com/
;
;FileDelete, %File%
;FileAppend, %pastelist%, %File%
FileRead, FileList, %File%
; example 1: clipboard = http://www.autohotkey.com/ not in pastelist so should be added
; example 2: clipboard = http://www.google.com/ is in pastelist so should not be added
;Clipboard = http://www.autohotkey.com/
Loop, Parse, FileList, `n, `r
{
If (Clipboard = A_LoopField)
Add:=!Add ; toggle so it will not ADD it when found
}
If (!Add) ; append to file because it wasn't found and beep
{
FileAppend, %clipboard%`n, %File%
SoundBeep
}
Thanks again for your help, astonishing to have this with such a few lines.
Jos |
|
| Back to top |
|
 |
tcp800
Joined: 01 Apr 2009 Posts: 16 Location: Netherlands
|
Posted: Fri Apr 03, 2009 10:35 pm Post subject: |
|
|
File=testpastelist.txt
Add=0
FileRead, FileList, %File%
Loop, Parse, FileList, `n, `r
{ ;What are these for?
If (Clipboard = A_LoopField) ;Why does A_Loopfield not has to be declared like Add
Add:=!Add ; toggle so it will not ADD it when found
}
If (!Add) ; append to file because it wasn't found and beep
{
FileAppend, %clipboard%`n, %File%
SoundBeep
} |
|
| Back to top |
|
 |
tcp800
Joined: 01 Apr 2009 Posts: 16 Location: Netherlands
|
Posted: Fri Apr 03, 2009 11:03 pm Post subject: |
|
|
Hugo, sorry one more,
In clipmagic, which I like to use in between to select and cathagorize the selected url's I can set a filter, this filterform says: Paste into this window: But I guess we cannot use that to have the pastebpr.ahk launched? Think I don't need clipmagic when I am selecting candidates. I have a lot of friends, over 2000 now, I try to get them in a petition. Just to explain you why I need this.
I will wait for you now,
Jos |
|
| Back to top |
|
 |
hugov
Joined: 27 May 2007 Posts: 2181
|
Posted: Sat Apr 04, 2009 8:12 am Post subject: |
|
|
This will work with a hotkey, select something and press windowskey C to run this script
| Code: | #c:: ; hotkey, press windowskey C to run this script
File=testpastelist.txt
clipboard= ; clear clipboard just to be sure
Send ^c ; this will copy a selection to the clipboard
Clipwait, 2
FileRead, FileList, %File% ; change this to real file...
Loop, Parse, FileList, `n, `r
{ ; this is called a block http://www.autohotkey.com/docs/commands/Block.htm
If (Clipboard = A_LoopField)
{
Return ; we can stop the script here because we found it and don't need to add it
}
}
; if we get here we haven't found it so add it
FileAppend, %clipboard%`n, %File%
SoundBeep
Return |
See http://www.autohotkey.com/docs/commands.htm
for a list of all command or the helpfile that came with AHK
Use a menu to select which file you want to check, that way
you can make various lists
| Code: | #c:: ; hotkey, press windowskey C to run this script
FileList=
clipboard= ; clear clipboard just to be sure
Send ^c ; this will copy a selection to the clipboard
Clipwait, 2
SelectFile=File1.txt|File2.txt|File3.txt|File4.txt ; list of files
Loop, Parse, SelectFile, |
Menu, MyMenu, Add, %A_LoopField%, MenuHandler
Menu, MyMenu, Show
MenuHandler:
FileRead, FileList, %A_ThisMenuItem% ; read selected file
Loop, Parse, FileList, `n, `r
{ ; this is called a block http://www.autohotkey.com/docs/commands/Block.htm
If (Clipboard = A_LoopField)
{
Return ; we can stop the script here because we found it and don't need to add it
}
}
; if we get here we haven't found it so add it
MsgBox, 4, Ask , Do you want to add %clipboard%`nto %A_ThisMenuItem%
IfMsgBox, Yes
{
FileAppend, %clipboard%`n, %A_ThisMenuItem%
SoundBeep
}
Return |
_________________ Tut 4 Newbies
TF : Text file & string lib, TF Forum |
|
| Back to top |
|
 |
tcp800
Joined: 01 Apr 2009 Posts: 16 Location: Netherlands
|
Posted: Sat Apr 04, 2009 5:44 pm Post subject: |
|
|
Hugo,
The ask 'do you want...' sometimes ends in the systembar, vista shows me the box in small on mouseover, this also seems to be the cause of accepting more than once the same clip. Is the 'n on the right place? clipboard 'n ?
If, from start, I get this question in the normal askbox on screen, the files are filled or not, as expected. I get a vista warning when the askbox apears in the systembar. So I think I can come around this, but I don't know why it happens.
Jos |
|
| Back to top |
|
 |
hugov
Joined: 27 May 2007 Posts: 2181
|
Posted: Sat Apr 04, 2009 5:53 pm Post subject: |
|
|
`n is "new line" in the MsgBox, don't know why it appears in the taskbar, I don't have vista so I can't replicate the issue. You can simply comment the MsgBox and IfMsgBox lines to skip it, I just thought it was a nice feature. _________________ Tut 4 Newbies
TF : Text file & string lib, TF Forum |
|
| Back to top |
|
 |
tcp800
Joined: 01 Apr 2009 Posts: 16 Location: Netherlands
|
Posted: Sat Apr 04, 2009 6:15 pm Post subject: |
|
|
Ofcourse Hugo, thanks for your help it is ok and I will use it like this and maybe make some careful changes. My last 2 questions:
1. Does last 'If Msgbox' need a Return?
2. Can I say:
Wait 'This clip allready exist' ;?
or does this need another syntax to wait for a key from the user with a message? |
|
| Back to top |
|
 |
hugov
Joined: 27 May 2007 Posts: 2181
|
Posted: Sat Apr 04, 2009 6:20 pm Post subject: |
|
|
See IfMsgBox docs, no it doesnt, it simply runs the line directly below it, if you need more commands you can use a block {}
| Code: | ...
MsgBox Already in %A_ThisMenuItem% ; add this line
Return ; we can stop the script here because we found it and don't need to add it
... |
_________________ Tut 4 Newbies
TF : Text file & string lib, TF Forum |
|
| Back to top |
|
 |
hugov
Joined: 27 May 2007 Posts: 2181
|
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|