AutoHotkey Community

It is currently May 26th, 2012, 4:46 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 23 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: April 1st, 2009, 9:00 pm 
Offline

Joined: April 1st, 2009, 1:12 am
Posts: 16
Location: Netherlands
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 2nd, 2009, 12:26 pm 
can you elaborate it more?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 2nd, 2009, 2:14 pm 
Offline

Joined: April 1st, 2009, 1:12 am
Posts: 16
Location: Netherlands
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 2nd, 2009, 2:50 pm 
Offline

Joined: April 1st, 2009, 1:12 am
Posts: 16
Location: Netherlands
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 3rd, 2009, 7:15 pm 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
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
   }

_________________
AHK FAQ
TF : Text files & strings lib, TF Forum


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 3rd, 2009, 11:02 pm 
Offline

Joined: April 1st, 2009, 1:12 am
Posts: 16
Location: Netherlands
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 3rd, 2009, 11:20 pm 
Offline

Joined: April 1st, 2009, 1:12 am
Posts: 16
Location: Netherlands
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 3rd, 2009, 11:35 pm 
Offline

Joined: April 1st, 2009, 1:12 am
Posts: 16
Location: Netherlands
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
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 4th, 2009, 12:03 am 
Offline

Joined: April 1st, 2009, 1:12 am
Posts: 16
Location: Netherlands
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 4th, 2009, 9:12 am 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
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

_________________
AHK FAQ
TF : Text files & strings lib, TF Forum


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 4th, 2009, 6:44 pm 
Offline

Joined: April 1st, 2009, 1:12 am
Posts: 16
Location: Netherlands
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 4th, 2009, 6:53 pm 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
`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.

_________________
AHK FAQ
TF : Text files & strings lib, TF Forum


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 4th, 2009, 7:15 pm 
Offline

Joined: April 1st, 2009, 1:12 am
Posts: 16
Location: Netherlands
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?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 4th, 2009, 7:20 pm 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
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
...

_________________
AHK FAQ
TF : Text files & strings lib, TF Forum


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 4th, 2009, 7:37 pm 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
Try this: Change the value 4 to 4100
Code:
MsgBox, 4100 .....

It will force the MsgBox to the foreground so that may solve your taskbar problem?

_________________
AHK FAQ
TF : Text files & strings lib, TF Forum


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 23 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, Miguel, notsoobvious, poserpro, Yahoo [Bot] and 17 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