Ping Script with AppleScript

Joined
Feb 16, 2015
Messages
1
Reaction score
0
Hello,

I am looking for help with an AppleScript that I have.

It was working before I added the two rows for delay and closing the first Terminal window and now even without them it is causing the Automator application to crash.

Here is the script:

on run
tell application "Finder"
set DesktopBounds to bounds of window of desktop
set DesktopWidth to item 3 of DesktopBounds
set DesktopHeight to item 4 of DesktopBounds
end tell

set PingDestinations to {"192.168.0.1", "192.168.1.1", "192.168.2.1", "192.168.3.1", "192.168.4.1", "192.168.5.1", "192.168.6.1", "192.168.7.1", "192.168.8.1", "192.168.13.1", "192.168.190.10"}

set TheIncrementValueX to 445
set TheStartingValueX to 0
set NumberOfTerminalWindowsOnARowX to (DesktopWidth div TheIncrementValueX) as integer
set TheEndingValueX to (NumberOfTerminalWindowsOnARowX * TheIncrementValueX)

set TheIncrementValueY to 100
set TheStartingValueY to 22
set TheEndingValueY to (DesktopHeight - TheIncrementValueY)

set i to 1

tell application "Terminal"
activate
--delay 1
--tell application "Terminal" to close window 1

repeat with TheIncrementValueY from TheStartingValueY to TheEndingValueY by TheIncrementValueY
repeat with TheIncrementValueX from TheStartingValueX to TheEndingValueX by TheIncrementValueX

set theCurrentDestination to item i of PingDestinations

set newTab to do shell script "ping " & theCurrentDestination

--set the current settings of newTab to settings set "Homebrew"
set the number of columns of window 1 to 65
set the number of rows of window 1 to 5

set position of the first window to {TheIncrementValueX, TheIncrementValueY}

set i to (i + 1)

if (i > (count of PingDestinations)) then
exit repeat
end if

end repeat

if (i > (count of PingDestinations)) then
exit repeat
end if

end repeat

end tell

end run

Thank you in advance for your help!

Sincerely,
Anton Todorov, Bulgaria
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top