AutoHotkey Community

It is currently May 27th, 2012, 12:55 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 12 posts ] 

Good Idea?
Poll ended at October 9th, 2011, 5:47 pm
Yes 50%  50%  [ 3 ]
No 33%  33%  [ 2 ]
Don't care 17%  17%  [ 1 ]
Total votes : 6
Author Message
 Post subject: #include http://...
PostPosted: September 9th, 2011, 5:47 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
Hello everyone,

There was always a problem sharing functions, also understanding and using stdlib or usrlib for beginners is rather difficult.
I remember where I tried to figure out how it works and then searched and collected all the functions which costs a lot of time :(

It would be great if we could have an option to include a script from the Internet.
That way it would be awsome simple to share scripts, also compiling would be much simpler.

For compiling it would be simple to change Ahk2Exe I think.
In AutoHotkey.exe we would need to be able to LoadIncludedScript from the internet.
Code:
; Here if the function does not exist in stdlib or usrlib, it would be downloaded and included in script
#include <_Struct=http://www.autohotkey.net/~HotKeyIt/AutoHotkey/_Struct.htm>
#include http://www.autohotkey.net/~HotKeyIt/AutoHotkey/_Struct.htm ;force to use function from internet


What do you think about it?

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 9th, 2011, 5:57 pm 
Offline

Joined: December 26th, 2010, 7:40 pm
Posts: 4172
Location: Awesometown, USA
This is an amazing idea. We often link a user to our library and post code that uses it, and they come back with an error. This would eliminate that entirely.

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 9th, 2011, 5:57 pm 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8667
Location: Salem, MA
what's the failure mode when no internet connection is available?

If it caches the last copy locally, then it might be ok.

The other issue is what if a function gets removed or changed in an upgrade. IT would suddenly break other people's scripts. If the owner is unwilling to put the old function, what is the user to do?

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 9th, 2011, 5:58 pm 
Offline

Joined: October 13th, 2009, 10:09 pm
Posts: 1389
I see a problem here because the poster of the online script can easily break it for many users. I would not want to access parts of a script from a location I can't control.

If anything, some sort of autoupdater would be nice. There would be some meta information in a script file that tells AHK where to look for an updated version and the user would have the possibility to update.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 9th, 2011, 8:19 pm 
Many users will think it is hard and complicated if a script requires multiple libraries regardless if it is from the Internet or the local drive, especially if one of them using #include in itself. The users do not want to spend wondering whether to rewrite the code in the library to manually include the files and whether it is safe to do. That is a very frustrating process for beginners and most of them will give up.

I suggest to keep a script as simple as possible if you publish it. You can rename classes and functions and put them in the script so that it does not have to require extra stuff. Still if you have to use libraries, just specify the version numbers. That's should be sufficient.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 10th, 2011, 1:34 am 
Offline

Joined: July 6th, 2011, 5:37 pm
Posts: 214
Location: Looking over my domain
here are some thoughts

the file will still need to be downloaded to be used your idea doesnt point out a destination.

Assuming it becomes part of the temporary internet files this may create a security concern since files executing localy with code from tem internet files may be identified by AV as malicious

since directives evaluates before any code is executed how should dl failure be handled.

I personally manage apps that DL code from intranet site on execution. I understand the point of having code always downloaded friesh but I dont think this is the way to do it

_________________
Image Stolen from SKAN


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 10th, 2011, 1:56 am 
Offline

Joined: December 26th, 2010, 7:40 pm
Posts: 4172
Location: Awesometown, USA
here's my awful workaround:
Code:
#Include *i <MsgBox2> ; just a test
If !IsFunc("MsgBox2")
{
   FileCreateDir %A_MyDocuments%\AutoHotkey\Lib
   UrlDownloadToFile, http://www.autohotkey.net/~crazyfirex/msgbox2.ahk, %A_MyDocuments%\AutoHotkey\Lib\MsgBox2.ahk
   If ErrorLevel
      exitApp
   reload
}
MsgBox2 = MsgBox2
%MsgBox2%()
After the first ugly 11 lines of code, you can call your function with a bit of extra work. If it is a "prefix" format, you could call it like %gdip%_BitmapFromHWND() to avoid so many variables.

Obviously, less than optimal :roll:

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 10th, 2011, 3:00 am 
Offline
User avatar

Joined: October 7th, 2006, 8:45 am
Posts: 3330
Location: Simi Valley, CA
@nimda. I couldn't think of an elegant way to do it either...:?

Personally, I think it would be more desirable to have a program with a nice gui that allows a user to graphically manage their lib folders.

The program could display file names, versions, functions and classes, help manuals (if applicable), and have an update option (if a standard can be agreed upon).

(I'd do it, but I'm swamped already).

_________________
Ternary (a ? b : c) guide     TSV Table Manipulation Library
Post code inside [code][/code] tags!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 10th, 2011, 3:05 am 
Offline
User avatar

Joined: November 2nd, 2008, 4:23 pm
Posts: 2906
Location: 127.0.0.1
It's an interesting idea. Pulling from the internet each run sounds awfully slow. In the worst case you get a connection that times out. More often scripts won't be available... and then what? It can't run without the includes.

It would be better to put them in a local Lib folder. That is, they only download when they can't be found. This primarily assumes you run the script after downloading it.

Should the user be asked first though? Whether or not they want to download it from some website?


@nimda, I just died a little inside...

but... if the includes are classes you can do If not ClassName { download it, reload }

_________________
aboutscriptappsscripts
Any code ⇈ above ⇈ requires AutoHotkey_L to run


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 10th, 2011, 8:32 am 
Offline

Joined: November 7th, 2006, 9:47 pm
Posts: 1934
Location: Germany
It is an interesting idea, failing on some problems. That script could not be used without internet connection, if the lib is not cached. Frankie pointed it already out, connection could be slow for many users. Including internet files requires incredible trust on them, as they can be changed without the notice of the user. I would never use this function nor trust them (excluding some gold members here).

If you have users who do not program, then give them scripts in compiled form. That should be sufficient enough. Hiding a problem would only transport the problem to another place, not really solving it. If every noob would be able to include files from internet, then we get more problems after some time, than it solves. This shouldn`t part of AutoHotkey, imho.

_________________
{1:"ahkstdlib", 2:"my libs", 3:"my apps", 4:"my license"}
--> Don't feed the troll! <--


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 10th, 2011, 9:45 am 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
Thanks for all comments :)
The idea was not to download the file to disk, you could simply compile the script if you want to run it offline.

I think in generally it would be good enough if Ahk2Exe could handle this (when compiling).
User would get a warning if a file is about to be downloaded showing the address and would be given an option to cancel.
We could also have a list of trusted websites in Ahk2Exe.

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 10th, 2011, 12:24 pm 
Offline
User avatar

Joined: May 10th, 2007, 10:54 am
Posts: 649
Location: .switzerland
IMHO this goes in a similar direction like the idea of an official AHK Script/Function packet-manager, because you need to care about versioning.

This means that there has to be a packetsource (Server with php Interface and MySQL backend) and a client which can download and update the lib. In conclusion, a simple URL is not enough info, as it misses any version dependencies. This is btw the second point: Dependecy management would be necessary and this is done easiest with a central lib service...

dR & I brainstormed some of those points some time ago, if someone is interested I might be able to present our ideas...

_________________
http://securityvision.ch
AHK 2D GAME ENGINE


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 3 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