Rule attribute - if connected on WIFI

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Rule attribute - if connected on WIFI Tue May 05, 2015 8:24 am • by seasea
Hello

I am very new to Hazel (after giving up on Automator as the "engine"). I would like to learn if Hazel rule attributes include ability to check if connected via WIFI, and if so do move to folder x, and if Mac OSX connection is by iphone USB (Hotspotting) do move to folder y.

I could not see this rule attribute in automators list of actions. So maybe Hazel has thought of this common condition for iphone/mac users.

Thankyou
seasea
 
Posts: 10
Joined: Tue May 05, 2015 7:12 am

Re: Rule attribute - if connected on WIFI Tue May 05, 2015 10:48 am • by Mr_Noodle
You can't check for those directly, except through a script. I've thought about adding some sort of attribute for Network Location or Wifi network but am still looking for cases where it's used. Can you elaborate more on why you want to do this?
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Rule attribute - if connected on WIFI Tue May 05, 2015 4:02 pm • by seasea
Sure.

Essentially, I live in a country where mobile broadband is very pricey, so if I am travelling, or simply out on a client's site with my macbook, I do not want to pay mobile broadband prices for any file movement. Rather these just go into the holding folder, and when I am connected to WIFI with some time, I kick off hazel to do her wonder!

Use cases are for me, identical to those of the Iphone. All the IOS Apps I have that move files in someway, get books, get music, check a book catalog etc..have this setting (e.g. only send files/download from any app store etc. if on WIFI )

My email app has this e.g. to do not download attachments unless on WIFI.

Hazel just runs, so I guessed if I had a conditional statement like these IOS Apps, she could get busy doing the correct assigned task, beautifully.

This style of condition check means for me, my workflow is more robust. I do not have to think about what to do, just I know when I connect, there is always stuff to go up/down. Secondly, when I am working at home, on own WIFI, or at a public library, I do not want things queueing (like on a to do list), they can just get done immediately.

Movement of files between my macbook and cloud happens all the time. Quite amazed at how often actually something is going up or coming down. My main drive is in the cloud and my local is my mirror as I travel alot.

When I am in USA, the mobile broadband is much more affordable, or public free wifi is readily available so one is not so concerned.

Do you by chance know the AppleScript to check network status? As I could create a workflow to call AppleScript as a workaround.)
seasea
 
Posts: 10
Joined: Tue May 05, 2015 7:12 am

Re: Rule attribute - if connected on WIFI Wed May 06, 2015 12:12 pm • by Mr_Noodle
Don't have an AppleScript handy. I suggest searching the net for something.
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Rule attribute - if connected on WIFI Sat Dec 24, 2016 1:00 pm • by Zigzagi
Mr_Noodle wrote:You can't check for those directly, except through a script. I've thought about adding some sort of attribute for Network Location or Wifi network but am still looking for cases where it's used. Can you elaborate more on why you want to do this?


I have a similar use case and I think adding a wifi network attribute will come in extremely handy. Applescript is hard to understand for non-geeks like me. That is the whole essence of using Hazel for stuff like this.
Zigzagi
 
Posts: 5
Joined: Sat Dec 24, 2016 12:51 pm

Re: Rule attribute - if connected on WIFI Mon Dec 26, 2016 12:33 pm • by Mr_Noodle
Can you describe your case in more detail?
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Rule attribute - if connected on WIFI Mon Dec 26, 2016 1:45 pm • by Zigzagi
Mr_Noodle wrote:Can you describe your case in more detail?

I download document files on my mac at work and home. I will like to have the document files uploaded to my home network drive when I connect to its wifi network.
However, I have several wifi networks that I connect to in my home and so, using a location rule is not very useful.

Is there any way to ensure that Hazel runs a rule when my mac is connected to the particular wifi network and the files are present?
Zigzagi
 
Posts: 5
Joined: Sat Dec 24, 2016 12:51 pm

Re: Rule attribute - if connected on WIFI Tue Dec 27, 2016 2:16 pm • by Mr_Noodle
Is the destination drive only available on that wifi network? If so, just create the rule to move the files there. Hazel will run the rule when the drive is available.
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Rule attribute - if connected on WIFI Tue Jan 03, 2017 3:37 am • by Zigzagi
Mr_Noodle wrote:Is the destination drive only available on that wifi network? If so, just create the rule to move the files there. Hazel will run the rule when the drive is available.

The rule was designed in such a way that the files are uploaded to a local server on the wifi network via FTP. The network location is not actually mounted as a drive.
Zigzagi
 
Posts: 5
Joined: Sat Dec 24, 2016 12:51 pm

Re: Rule attribute - if connected on WIFI Tue Jan 03, 2017 12:24 pm • by Mr_Noodle
Fair enough. Thanks for the details.
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Rule attribute - if connected on WIFI Sat Jan 07, 2017 5:25 am • by Zigzagi
Mr_Noodle wrote:Fair enough. Thanks for the details.

So, are we getting a wifi network attribute with the next update?
Zigzagi
 
Posts: 5
Joined: Sat Dec 24, 2016 12:51 pm

Re: Rule attribute - if connected on WIFI Mon Jan 09, 2017 12:17 pm • by Mr_Noodle
Can't say if/when it will happen. It is in the feature database.

In the meantime, you can look into a script to do what you want. On the commandline you can do:

networksetup -getcurrentlocation

That will return your current network location. Maybe you can leverage that to get what you want.
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Rule attribute - if connected on WIFI Thu Jan 12, 2017 7:37 am • by paul
Hi!
I had a similar task:
print documents from print folder if I’m at home and between given times

My rule looks like this:
Image

The condition "Passes AppleScript" contains this script:
Code: Select all
-- Check if connected to given Wifi network (SSID)
set monitoredSSID to "YOUR-NETWORK-NAME"

set currentSSID to do shell script "/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | awk '/ SSID/ {print substr($0, index($0, $2))}'"
if (currentSSID as string is monitoredSSID) then
   return true
end if


Hope that helps.
Cheers,
Paul
paul
 
Posts: 3
Joined: Fri Jan 06, 2017 4:31 am


Return to Support