Re: System info
Re: System info
- Subject: Re: System info
- From: Iurista GmbH <email@hidden>
- Date: Tue, 29 Apr 2014 19:39:52 +0200
First, thanks everybody for contributing, even if that seems a little bit a late answer (I was without Internet for a few days).
Second: Yes Ron, you have perfectly summarized my problem, and you're surely right with your answer, but I'm not so skilled with terminal or shells to reach my information otherwise than applescript :-(
Third: to Ron and Shane
I extract from system info the system version, the short user name, the home directory, the boot volume and the computer name.
Usually system info is quite fast, but without internet, it takes sometimes minutes for system info to get that the item "IPv4 address" (which I do not need at all) has a missing value...
Rudolf
> On Apr 25, 2014, at 8:27 AM, Iurista GmbH <email@hidden> wrote:
>
>> Hi
>>
>> Sometimes, some of my scripts are executing far too slow (10 to 20 seconds...). I figured out that this were all scripts calling for "system info", and that in most cases, it seemed to be the item "IPv4 address" resulting in a missing value statement. At first sight, it appeared that this only happened when I'm not connected to the internet, but now it starts also be slow while connected. Unfortunately I need some of the informations from system info quite very often, and some of such scripts are part of my QuicKeys shortcuts (which in turn naturally seems to hang).
>> How can I fix that problem?
>
> If I understand your situation correctly:
>
> a) Your script needs some piece of information
> b) That information is part of what 'system info' returns
> c) 'system info' ALSO returns your IP address, but that's not the information you're looking for
> d) Sometimes, 'system info' takes a long time trying to get your IP address.
>
> 'system info' won't tell you anything until it knows everything, so if it has to wait for any piece of data, so do you. Which is a real nuisance if the info it's hanging on (IP address, in this case) is info you don't care about. You still have to wait.
>
> This is an instance of a general problem I see again and again in scripts. Not only in AppleScripts, but in shell scripts as well. The script writer invokes a tool that will provide gobs and gobs of information, then uses 'grep' or 'sed' or 'awk' to whittle away all but the one line of information they were looking for. I once saw a shell script that, to determine whether a file with a given name existed, used 'ls' to get a complete listing of all files in the parent directory and piped that into 'grep' to see if the given name was in the list. My protestations that the shell could already do that efficiently using the builtin [[ -e filename ]] test, without having to spawn two subordinate processes and pipe gobs of data between them, fell on deaf ears. That's an extreme case; more often you see it as invoking some information source that will tell you everything it knows if called without parameters, and then filtering its voluminous output through grep.
>
> The solution, of course, is: ask ONLY for the data you're interested in. It's easy (but not efficient) to throw away useless information from an encyclopedic response, but it's a whole lot more efficient to avoid generating that useless information in the first place.
>
> So, what piece(s) of information DO you need in your script(s). See if there's a more focused way to ask for it. After all, 'system info' has to get all that data from somewhere. Why not skip the middleman, and go straight to the source yourself?
>
> -Ron Hunsinger
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> AppleScript-Users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> Archives: http://lists.apple.com/archives/applescript-users
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden