autoreply in mail and one other script

I am working on two scripts that I cannot get to work

1

set {Ext_IP, Int_IP} to {word 25, word 32} of (do shell script "curl checkip.dyndns.org;ipconfig getifaddr en0")

set myip to Ext_IP & return & return & Int_IP

using terms from application "Mail"
	on perform mail action with messages theMessages for rule theRule
		repeat with theMessage in theMessages
			tell application "Mail"
				set thereply to reply theMessage with opening window
				delay 1
				tell thereply
					set content of thereply to myip
                                        send thereply
				end tell
			end tell
		end repeat
	end perform mail action with messages
end using terms from


I borrowed the ip information from a thread here. the script is pretty self explanatory script but i don’t get why the ip information isn’t entered into the reply window

2

display dialog "number of times" default answer "" buttons {"OK"} default button 1
set stopp to the text returned of the result



activate application "Safari"
tell application "System Events"
	tell process "Safari"
		repeat with counter from 1 to stopp by 1
			
			keystroke "p" using command down
			
			delay 1
			
			click menu button "PDF" of sheet 1 of window 1
			perform action "AXPress" of menu item "Save as PDF." of menu 1 of menu button "PDF" of sheet 1 of window 1
			delay 2
			
			keystroke counter
			
			delay 2
			
			keystroke return
			
			delay 2
			
			click menu item "Back" of menu "History" of menu bar 1
			delay 3
		end repeat
	end tell
end tell

I have Internet pages I want to print to pdf and so I load them in safari on by one and wrote this script to print them out one by one. However I can never get it write the value of the counter but it can say it without a problem.

Any help appreciated.

Hi,

1

you retrieve the IP outside the handler, the line will never be passed.
Put it in the handler

thank you very much stefan

I figured out the second script myself. All I needed was to change it to

keystroke counter as text 

The best way to learn things.