Hi All,
I am fairly new to AppleScript but learning quite quickly and enjoy doing so! I have used MacScripter for a while by searching for other people with similar issues - Im having some trouble with my script and havent found any ‘similar’ scenarios online.
What is the script:
Ultimalty I am building a GUI using Pashua which is linking to 2 sqlite3 databases (1 local and 1 networked one)
The database is to store customer information that can be queried and overwritten by using the GUI - It will then link to something else in the future.
Issue 1:
Im struggling to link my databases to other areas other than the desktop.
I want to store ‘local.db’ in the same folder as the script and the ‘customers.db’ on a network drive
--this is set to run to my desktop which works
set headlocal to "sqlite3 -column ~/desktop/local.db " & quote
--I have tried something like this to give the db location an absolute path with no success
set thisFolder to (container of (path to me)) as string
set headlocal to "sqlite3 -column " & POSIX path of thisFolder & "/local.db " & quote
Issue 2:
This part of the code asks for a customer code then if it finds it in the db it sets the variables and sets the default text fields to allow editing. This area works as intended but when it sets the variables it breaks the string if there is a @ symbol in the strong for example.
repeat while customerCode = ""
set customerCode to text returned of (display dialog "ENTER CUSTOMER CODE" default answer "" with title "Testing" with icon caution)
set customerCode to do shell script "echo " & customerCode & " | tr [:lower:] [:upper:]"
end repeat
set pullData to "select customername, customersite, contactemail, ftpemail, ftppassword from printers where customercode = '" & customerCode & "'; "
set {customerName, customerSite, contactEmail, ftpEmail, ftpPassword} to words of (do shell script head & pullData & quote)
-- Lets say I enter this info in: customer1, London, customer1@email.com, customer1@ftp.com, Password 1
-- The Results would be: customer1, London, customer1, email, com
-- It is only showing me the words (which I know its what ive specified:
to words of
-- Ive tried other classes such as paragraph, string etc
-- Words gives me most of the wording
Any help would be great
Thanks in advance