AutoHotkey Community

It is currently May 27th, 2012, 2:16 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 83 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next
Author Message
 Post subject:
PostPosted: February 4th, 2010, 2:44 pm 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
nigelle wrote:
I was not aware of www.autohotkey.net , now I am registered to it. If I upload a file, who has the rights to
-modify it ?
-read and download it ?

If you don't share your user id & password you will be the only to modify (upload) material, if you make the links to the material available here on the forum or on a webpage hosted at www.autohotkey.net everyone can find and download them.

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 5th, 2010, 12:07 am 
Offline

Joined: November 8th, 2009, 2:46 am
Posts: 234
Location: Canberra Oz
Quote:
I was not aware of www.autohotkey.net , now I am registered to it. If I upload a file, who has the rights to
-modify it ?
-read and download it ?
I have not found this information on the site.

Others can access files if they know the name & where they are, I don't think others can modify/delete. Try to delete/modify this I have copies so go for it.
Quote:
What does functions_for_keyconfig does when I just want to modify a key which is already defined?
Using Keyconfig, select the FFK definition then press the Disable button - it clears the key shortcut, then the Apply button. Then you can define your own. If you duplicate a shortcut, a message tells you it is duplicated but 'may work'

Quote:
Let us wait that the readers ask for more translations !


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 5th, 2010, 12:00 pm 
Offline

Joined: September 26th, 2008, 6:09 pm
Posts: 82
Location: France
Quote:
Others can access files if they know the name & where they are, I don't think others can modify/delete. Try to delete/modify this I have copies so go for it.
I have first tried to click on "this" : I received a screen proposing to open with xxx (with xxx set to my editor it opened a local copy in "my documents" in read only mode) or to download. Then I right clicked on "this" chose properties that gave me an URL, I put it in my address bar and obtained the same screen. It does not seems possible to modify !

Quote:
What does functions_for_keyconfig does when I just want to modify a key which is already defined?
Using Keyconfig, select the FFK definition then press the Disable button - it clears the key shortcut, then the Apply button. Then you can define your own. If you duplicate a shortcut, a message tells you it is duplicated but 'may work'

Misunderstanding ! I had understood (I may be wrong) that running a modified version of functions_for_keyconfig you think you may, in the future, add our short-cuts in Keyconfig. My question is what occurs if you do this twice : the second time with the coding of a key slightly modified...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 5th, 2010, 11:10 pm 
Offline

Joined: November 8th, 2009, 2:46 am
Posts: 234
Location: Canberra Oz
Quote:
My question is what occurs if you do this twice : the second time with the coding of a key slightly modified...

I would make it unique, not a modified FFK overlay. eg
    <overlay id="AHK_for_keyconfig_overlay"


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 6th, 2010, 4:00 pm 
Offline

Joined: September 26th, 2008, 6:09 pm
Posts: 82
Location: France
To Michael@oz
Quote:
I would make it unique, not a modified FFK overlay. eg

Does this means that the last definitions replace the previous ones ?


Report this post
Top
 Profile  
Reply with quote  
 Post subject: The content of a script
PostPosted: February 6th, 2010, 5:20 pm 
Offline

Joined: September 26th, 2008, 6:09 pm
Posts: 82
Location: France
This is the last text that I plan to enter to share with you my experience. It describes the structure of my scripts.

Code:
The content of a script

General considerations
a) When I was at school (during the mainframe era) it was generally admitted that the user needed 2 to 5 seconds between the reception of the application screen and the key that send it back to the application having filled the various fields. Now the processor are smaller and more powerful but the users remain the same... So I add a fixed sleep before each actions except the last one that has a random sleep to make simulation more realistic. Total of sleeps is in the low part of the 2 to 5 s. range because I don't take into account processing time.
b) Ahk is fast (order of magnitude few ms.), FF and its Javascript functions is slow (order of magnitude few 1/10 of a s.). You need to synchronize them : sometimes it is not needed (e.g. you change the size of the screen), in the functions of the library it is built in (using the content of the clipboard), but when the page call a Javascript function during or at the end of loading or when you have clicked a button, I don't know a method to verify that the function has finished so I put a long sleep (order of magnitude 1 s.) : this is included in the range of a) .
c) the servers and the programming of an application have a cost. It is paid by your country, a foundation, a company that uses it as a service to its customers, or by advertisement. In this case, either the advertisement use a part of each screen and you don't take it into account or the application forces (before going to its next screen) a choice between some banners that bring you to an advertisement screen that you have to close in the processing of your script (see below).

The structure of a script is always the same : start part, N screens, closing part. You can see that in the distributed scripts.

1) start part
a) Call to the application site using e.g. :
Run, www.autohotkey.com/forum/login.php,Max ; i.e. any URL can be launched.
If there is a disconnect/logoff link or function it is often good to use it here to be sure to start in a clean situation. You are redirected to a more classic screen.
b) initialization of parameters of the script
c) wait till the page has finished loading using :
 rc := fini()

2) for each screen
a) verify that we are on a right screen. In fact there can be several right screens according the circumstances e.g. nothing new since your last access, something new, loop finished, etc. and the processing may change according this. This is the reason why I have put this here and not at the end of the previous item.
To verify this you have different methods and functions already written, if they are not sufficient code your own and propose it for inclusion in the library if you use it several scripts.
You can verify on Title, URL, Source or a combination or a part of them.
 There are basic functions : AHK WinGetTitle command, retURL() RETurns URL (in fact the content of the address bar that with some systems include the true URL and parameters generally separated by a ? ), sdom() returns Source of DOM.
 There are also elaborate functions that do verification, exit from the script if this fail (be cautious if you have to accept several screens) and set global the verified variable (Title, vURL, source) : vertit(x) VERifies that TITle contains x, verURL(x) VERifies that the URL is x or URLcont(x) verifies that the URL CONTains x, versourc(x) VERify that the SOURCe of DOM contains x.
b) do the processing of the screen : fill fields, click on buttons, extract some informations or a combination of these with the programming that goes around, eventually log some results. The last action is generally to click somewhere (a link or a function) to go to the next screen of the application.
c) special case : the application has forced (before going to its next screen) a choice between some banners that bring you to an advertisement screen. I close it with :
SetTitleMatchMode 2
;WinClose [, WinTitle, WinText, SecondsToWait, ExcludeTitle, ExcludeText]
WinClose , Firefox, ,0 , The_application_screen_I_wait_for_Title,
d) wait till the page has finished loading using :
 rc := fini()

3) Closing part
If there is a disconnect/logoff button click it (to have a clean end of the application) and wait : This may also be considered as a particular case of 2) .
I close (at the end of the script) the instance of FFX opened by run with :
SetTitleMatchMode 2
WinClose , Firefox, ,0
Then you may do some log recording e.g. using Dur(x) DURation of script to write the last record of the log before
exit ; end of script
or any other cleaning process.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Wiki
PostPosted: February 6th, 2010, 10:16 pm 
Offline

Joined: September 26th, 2008, 6:09 pm
Posts: 82
Location: France
Thanks to whom has improved my first entry in it !
It is nearly perfect except that I have used - as a bullet in some lists and that it remains in the line instead of going to the line below.

Now I have to enter the other texts :
0) Do we need to enter my original post ?
1) Reserved variables.
2) Preparing to script : what I do. Already entered
3) How I write an xpath instruction
4) The content of a script
Do you prefer an other order ? Please suggest it.
Which is the best way to enter them ? paste from the forum ? From the text file in which I prepared my posts ? From this text adding some coding extracted of the source of wiki ? Asking notepad++ to translate to html ?
Please teach me...

Do we need other texts in Wiki ? Who is prepared to write them ?

For the library, the short-cut definitions and the 2 examples of scripts I think that it is better to put them on AutoHotkey.net to avoid modification by inadvertent or malicious readers and to give a link in the Wiki.

What are your positions ?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 7th, 2010, 5:12 am 
Offline

Joined: November 8th, 2009, 2:46 am
Posts: 234
Location: Canberra Oz
nigelle wrote:
To Michael@oz
Quote:
I would make it unique, not a modified FFK overlay. eg

Does this means that the last definitions replace the previous ones ?
I suppose I won't know until I get it working...[/quote]


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 7th, 2010, 11:38 am 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
I've setup the structure here just copy / paste in the correct place (via the edit link at each section NOT via the top EDIT link)
http://www.autohotkey.com/wiki/index.ph ... te_FireFox

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 8th, 2010, 6:17 pm 
Offline

Joined: September 26th, 2008, 6:09 pm
Posts: 82
Location: France
To hugov
Quote:
I've setup the structure here

I have filled it ! Thanks to your help.
I have problems to format it nicely. I have found <br> to force a line break but I have not found how to format a list <li> put a round bullet but how to finish the list and go back to normal text ? So I have kept my old - but it does not show nicely even in bold !


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 9th, 2010, 10:03 am 
Offline

Joined: February 2nd, 2008, 4:35 am
Posts: 643
This is just a temporary place to put the English translation for "short text" (firefox shortcuts) for the wiki

Code:
1) Define the necessary additional shortcuts to AHK

Open Firefox .. Tools tab .. choose "configure keys" or "KeyConfig" (or press Ctrl-Shift-F12 hotkey) to open the small KeyConfig window.
Choose "Add a new key" to open open the small "KeyConfig - Key Editor" window.
At the "Name" field, enter the name or "identity" for the hotkey (eg "AHK loading in progress"). This will help you to locate it later if wish to change it (KeyConfig displays them in alphabetical order). I suggest using the prefix "ahk_" for any autohotkeys you add.
Click in main area (text "/*CODE*/" will disappear), and paste the JavaScript code for the hotkey (what is between "Code:" and the "---" separator line). Click "OK", and you will return to the "KeyConfig" main window.
Ensure your newly-created shortcut is selected, and click in the blank edit box at the bottom.
Hold-down your desired hotkey combination (eg Ctrl-Alt-b). You will see some text appear in box representing the hotkey combination you just pressed.
Click "Apply" then "close"


2) Modify an existing shortcut

Open Firefox .. Tools tab .. choose "configure keys" or "KeyConfig" (or press Ctrl-Shift-F12 hotkey) to open the KeyConfig window.
Click the key you want to change. If it can be changed the button will change to "Edit this key". Click on this button.
Make the changes (for example adding "ahk_" before the name).
You can also edit other entries by double clicking the item Which opens the "keyconfig - Key Editor" screen view with a new random name for the key, which you can type over (ie it creates a copy of the definition), you can then edit the JavaScript code and assign a key combination as above if required.
Click "Apply" then "close"


3) List of shortcuts
=================================================================================================
The line "---------------" is not part of the code : it is only there to separate shortcuts
=================================================================================================
Ctrl-Alt-b

Name: AHK Loading in progress
Note: b as "Busy": "NotBusy

Code:
    var ClipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"]
    . getService(Components.interfaces.nsIClipboardHelper);

    ClipboardHelper.copyString(gBrowser.mIsBusy ? "Busy" : "NotBusy");
-------------------------------------------------------------------------------------------------
Shift-Ctrl-F / Ctrl-Shift-F

Name: AHK result of Find
Note: Companion of Ctrl f, f as "found": "Not_found"

Code:
    var ClipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"]
    . getService(Components.interfaces.nsIClipboardHelper);

    if(gFindBar._findField.getAttribute("status") == "notfound")
      ClipboardHelper.copyString("Not_found");
    else
      ClipboardHelper.copyString("found");
-------------------------------------------------------------------------------------------------
Shift-Ctrl-U / Ctrl-Shift-U

Name: AHK source clipboard
Note: Ctrl U shows the source

Code:
    var ClipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"]
    . getService(Components.interfaces.nsIClipboardHelper);

    var request = new XMLHttpRequest();
    request.open("GET", "view-source:"+content.location, false);
    request.send(null);

    ClipboardHelper.copyString(request.responseText.replace (/\n/g, "\ r\n"));
-------------------------------------------------------------------------------------------------
Shift-Alt-U / Alt-Shift-U

Name: AHK source into DOM clipboard
Note: Ctrl U shows the source

Code:
    var node = content.document.documentElement.cloneNode(true);
    var dummy = content.document.createElement(dummy);
    dummy.appendChild(node);

    html = dummy.innerHTML.replace(/\n/g, "\r\n");

    var ClipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"]
    . getService(Components.interfaces.nsIClipboardHelper);
    ClipboardHelper.copyString(html);
-------------------------------------------------------------------------------------------------
Shift-Ctrl-M / Ctrl-Shift-M   (or Shift-Alt-M / Alt-Shift-M)

Name: AHK Maximize
Note: Maximize the window

Code:
    window.maximize();
-------------------------------------------------------------------------------------------------
? ? ?

Name: AHK Minimize
Note: Minimize the window (not used by any script)

Code:
    window.restore();
-------------------------------------------------------------------------------------------------
Ctrl-m

Name: Maximize AHK to 3 quarters
Note: The former combination of Minimize

Code:
    window.resizeTo(window.screen.availWidth /4 *3, window.screen.availHeight /4 *3);
-------------------------------------------------------------------------------------------------
Ctrl q

Name: AHK Xpath
Note: Ctrl X too dangerous, already used ctrl p, Q is near P
      Xpath select an html tag and click on it

Code:
    var ClipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"]
    . getService(Components.interfaces.nsIClipboardHelper);

    var clipboard = readFromClipboard().match(/(Nigel);([0-9]+);(.*)/);
    if(!clipboard) return;

    try {
    var node = content.document.evaluate(clipboard [3], content.document, null, 7, null).snapshotItem(clipboard[2]-1);
    } Catch(err) { ClipboardHelper.copyString(err); return; }

    if(!node) {
     ClipboardHelper.copyString("NotFound"); return;
    }

    ClipboardHelper.copyString("Found");
    node.focus();

    var e = content.document.createEvent("MouseEvents");
    e.initMouseEvent("click", true, true, null, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
    node.dispatchEvent(e);
-------------------------------------------------------------------------------------------------
Shift-Alt-L / Alt-Shift-L

Name: AHK URL into clipboard
Note: The letter is not one. The equivalent Ctrl-C

Code:
    var ClipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"]
    . getService(Components.interfaces.nsIClipboardHelper);

    ClipboardHelper.copyString(gURLBar.value);
-------------------------------------------------------------------------------------------------


Last edited by a_h_k on March 15th, 2010, 3:18 am, edited 2 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 26th, 2010, 9:35 am 
Offline

Joined: February 2nd, 2008, 4:35 am
Posts: 643
I'm just trying to get versourc() working

Code:
rc := versourc("Google - Mozilla Firefox")

Get "??? * Error ClipWait in function sdom" error

I even tried 20s in sdom(), & pressing !+u myself, but nothing is returned (clipboard says empty)

Could there be a problem with the javascript?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 26th, 2010, 11:08 pm 
Offline

Joined: November 8th, 2009, 2:46 am
Posts: 234
Location: Canberra Oz
a_h_k wrote:
I'm just trying to get versourc() working

Code:
rc := versourc("Google - Mozilla Firefox")

Get "??? * Error ClipWait in function sdom" error

I even tried 20s in sdom(), & pressing !+u myself, but nothing is returned (clipboard says empty)

Could there be a problem with the javascript?


If your using the code from the above post I suspect this may be the problem

    var node = content.document.documentElement.cloneNode (true); Del Space before (
    var dummy = content.document.createElement (dummy); Del Space before (
    dummy.appendChild (node); Del Space before (

    html = dummy.innerHTML.replace (/ \ n / g, "\ r \ n");
    Del Space before ( Del Spaces before and after the 3 \'s

    var ClipboardHelper = Components.classes [ "@ mozilla.org / widget / clipboardhelper; 1"]
    Del Space before [ & around /'s space before 1 could also be an issue
    . getService (Components.interfaces.nsIClipboardHelper); Del Space before (
    ClipboardHelper.copyString (html); Del Space before (


Report this post
Top
 Profile  
Reply with quote  
PostPosted: March 14th, 2010, 7:22 pm 
Offline

Joined: September 26th, 2008, 6:09 pm
Posts: 82
Location: France
I am back from vacation.

To Michael@oz
You proposals of corrections are right : the spaces are neither in my old personal version that works well for me and my children nor in my first contribution in page 1. They seems to appear for the first time in the Google translation.

To a_h_k
Please correct your post. It seems that there are other spurious spaces...

To all
The original codes for shortcuts were given in the Keyconfig forum by Dorando in page 73, 74, 75, 84, 92. In this forum my pseudo is also nigelle.
The copy of all codes for shortcuts in my first contribution in the bottom of page 1 have been tested for a long time and should not include errors !


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 31st, 2010, 6:43 pm 
Offline

Joined: December 22nd, 2010, 1:32 pm
Posts: 37
Hello, I've read a lot of this, and I'm creating a script to navigate FF, and using the tab method for finding links, I have a pretty solid script so far. =] I'm stuck at this one part and I would like to know how to do this please...

When I type in Ctrl + f in FF, and the result is "phrase not found", I want the script to sleep (for XXXX millseconds). If the text IS found, I want my computer to do something.

I don't know how to test for "no matches found" in an "if" function when i use "ctrl + f". So I'm posting here to see if someone can help provide the code to trigger this please.

Thank you very much!

Appreciate you being generous with your awesome scripting skills & time =]


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 83 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], Google Feedfetcher, LazyMan, nimda, poserpro, rbrtryn, sjc1000, Yahoo [Bot] and 15 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