I am working on applescript and it used to work but after some update It stopped working. but I have another script that is identical execpt with a diffrent files and locations and that one works. This one used to work until I created that one.
I run it through alfred
It runs normally until tell application “finder” then it get an error about can´t find finder
on alfred_script(q)
-- Asks for info and defines variables
set verkkaupi to the text returned of (display dialog "Verkkaupi(contractor)" default answer "")
set verk to the text returned of (display dialog "Verk(job)" default answer "")
set theDate to current date
set master to "Users/SvabbiKing/Dropbox/HagvÃs 2012/Svavar Hagvis/Tilboð/tilboðsnr/Masterskjal.xlsx"
set nafn to verkkaupi & " " & verk & " " & "IV" & ".xlsx" as string
set skjal to "Macintosh HD:Users:SvabbiKing:Dropbox:HagvÃs 2012:Svavar Hagvis:Tilboð:Heras Tilboð:" & nafn
-- making changes to master document
tell application "com.microsoft.Excel"
open master
tell active workbook
activate object worksheet "Sheet1"
end tell
set lastFilledCell to get end (range "A65536") direction toward the top
set firstBlankCell to get offset lastFilledCell row offset 1
set VK to get offset lastFilledCell column offset 1 row offset 1
set ver to get offset lastFilledCell column offset 2 row offset 1
set dags to get offset lastFilledCell column offset 3 row offset 1
set status to get offset lastFilledCell column offset 4 row offset 1
set file_ID to get offset lastFilledCell column offset 5 row offset 1
copy value of lastFilledCell to myvar
set nr to myvar + 1
set value of firstBlankCell to nr
set value of VK to verkkaupi
set value of dags to theDate
set value of ver to verk
set value of status to "opið"
set value of file_ID to skjal
save
close active workbook
end tell
--make new document out of template
set TheFile to "Macintosh HD:Users:SvabbiKing:Google Drive:Arctic Delta:Forrit:applescript hagvÃs tilboð:Efni:HagvÃsTilboðÚtreikningar.xlsx"
set DestinationPath to "Macintosh HD:Users:SvabbiKing:Dropbox:HagvÃs 2012:Svavar Hagvis:Tilboð:Tilboð"
set destinationFilename to nafn
tell application "Finder"
set theDupe to duplicate TheFile to folder DestinationPath
set name of theDupe to destinationFilename
end tell
--fill out new document
tell application "com.microsoft.Excel"
open skjal
tell active workbook
activate object worksheet "Innfluttingur"
end tell
set value of cell "B2" to verkkaupi
set value of cell "B3" to verk
set value of cell "I3" to theDate
set value of cell "H1" to nr
end tell
end alfred_script