Be warned, I'm a novice in AppleScript and most programmers in general. The main purpose of the script I've been working on is reading information from Excel files and saving it to a FileMaker Pro database. So far, everything works fine except when trying to determine the value of cells with dates. Since the data in the Excel file for the database in which they are to be inserted is already formatted correctly (MM / DD / YY), I would simply like to read them and write them as strings.
The problem occurs here, where AppleScript outputs the values as dates in the format (day of the week, month DD, YYYY at 00:00), even though I tried to read them as strings. Below is a shortened version of the script that shows where the problem occurs.
tell application "Finder" activate application "Microsoft Excel" open the first file in folder "Macintosh HD:Users:theUser:Documents:attachments test" tell application "Microsoft Excel" tell active sheet tell used range set rowCount to count of rows repeat with i from 2 to rowCount set colA to "A" & i & ":A" & i set theDate to get value of range colA as string set rowB to "B" & i & ":B" & i set theTime to get value of range rowB as real set colC to "C" & i & ":C" & i set serialNo to get value of range colC as integer set colD to "D" & i & ":D" & i set pH to get value of range colD as real set colE to "E" & i & ":E" & i set theVolume to get value of range colE as real display dialog "The serial number of row " & i & " is: " & serialNo & " and the pH value is: " & pH & " and the volume is: " & theVolume & " and the date is: " & theDate & " and the time is: " & theTime end repeat end tell end tell end tell end tell
I also tried to solve the problem with a different method by setting a variable for each day, month, and year. However, another problem has been identified where the month is not recognized as a purple word (whatever that means) and instead is blue (again). Nowhere can I find such terms. The screenshot below shows three different methods that I have tried to retrieve from the date in the format (day of the week, month DD, YYYY at 00:00), so that they can be manually reorganized.
My only guess for the initial problem is that & # 39; as string & # 39; does not work if it is placed after the other parts of the line, but I have no idea why month refuses cooperation. Every guide would be very grateful!