I am trying to monitor a cell in excel, however when the value of this
cell changes it stops the programs and gives an error. I would like to
know if there is a better way to do this so I can check it on every
scan.
While images==true
PLCV=parameters.range(‘b8’)[‘value’]
if PLCV==Trigger
now=Time.now
hour=now.hour
min=now.min
sec=now.sec
day=now.day
month=now.month
year=now.year
dest="#{StoredImgDir}\#{month}-#{day}-#{year}
#{hour};#{min};#{sec}"
Dir.mkdir(dest)
Dir.chdir(LogDir)
T=File.new("Log.txt", "a")
T.puts "There was a jam at #{now}"
end
if PLCV=Trigger
Dir.chdir("#{FTPDir}")
sleep(recordpostbuffer)
dir2=Dir.new("#{FTPDir}")
dir2.each do|file|
copy= true
if file=="."
copy=false
end
if file==".."
copy=false
end
if copy==true
FileUtils.copy(file,"#{dest}")
end
end
dir1=Dir.new(FTPDir)
dir1.each do |file|
ft=File.atime(FTPDir)
now=Time.now
nd=false
if file == "."
nd=true
end
if file ==".."
nd=true
end
if nd==false
File.new("#{file}", "w+").close
File.delete("#{file}")
end
end
end
end