Variable in filepath
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Variable in filepath
Hello
Here my problem:
--This works:
set the text of image "image" to url ("binfile:" & specialFolderPath("documents") & "/filename")
-- this doesn't work
set the text of image "image" to url ("binfile:" & specialFolderPath("documents") & "/tName")
Thanks for any help
Here my problem:
--This works:
set the text of image "image" to url ("binfile:" & specialFolderPath("documents") & "/filename")
-- this doesn't work
set the text of image "image" to url ("binfile:" & specialFolderPath("documents") & "/tName")
Thanks for any help
Re: Variable in filepath
Hi geo
Concatenate the literals within quotes, and the variables outside, joined with the & operator, just as you join the url file format to the value returned by the specialFolderPath function
Concatenate the literals within quotes, and the variables outside, joined with the & operator, just as you join the url file format to the value returned by the specialFolderPath function
Code: Select all
set the text of image "image" to url ("binfile:" & specialFolderPath("documents") & "/" & tName)
Last edited by SparkOut on Sun Aug 04, 2019 8:11 pm, edited 1 time in total.
Re: Variable in filepath
Hii geo,
welcome to the forum!
Well, when you quote the name of a variable, it becomes a STRING with the name, but we need the value of the variable not the name. Do like this:
Best
Klaus
welcome to the forum!
Well, when you quote the name of a variable, it becomes a STRING with the name, but we need the value of the variable not the name. Do like this:
Code: Select all
...
set the text of image "image" to url ("binfile:" & specialFolderPath("documents") & "/" & tName)
...
Klaus
Re: Variable in filepath
Hello, another beginner question:
I can call a command with
on mouseUp
databaseConnect
listMOU
end mouseUp
Now I have the listMOU stored in a variabel which I'm not able to get out of there to call the command.
Thanks for any help
I can call a command with
on mouseUp
databaseConnect
listMOU
end mouseUp
Now I have the listMOU stored in a variabel which I'm not able to get out of there to call the command.
Thanks for any help
Re: Variable in filepath
Hi geo,
it is always a good idea to open a new thread for a new problem!
Sorry, don't understand your question, what is listMOU?
Best
Klaus
it is always a good idea to open a new thread for a new problem!
Sorry, don't understand your question, what is listMOU?
Best
Klaus
Re: Variable in filepath
Hi Klaus
listMOU calls the command
listMOU calls the command
Re: Variable in filepath
So listMOU is the name of a handler, right? Where did you put this handler?
Sound like it is not in the message hierarchie.
Here good article about the "message hierarchie" in LC and how to effectively use it:
http://www.fourthworld.com/embassy/arti ... _path.html
Sound like it is not in the message hierarchie.
Here good article about the "message hierarchie" in LC and how to effectively use it:
http://www.fourthworld.com/embassy/arti ... _path.html
Re: Variable in filepath
listMOU ist the name of the handler, it is on the stack
on mouseUp
databaseConnect
listMOU
end mouseUp
this works fine, it shows the correct values
now I would like to use a segmented control where I get the name of the handler from the tab:
on hiliteChanged
put the hiliteditemNames of me into tHilited
answer tHilited
put list before tHilited
answer tHilited
end hiliteChanged
the tHilited contains listMOU, but how do I get the value out of the variabel so it would look something like that:
on hiliteChanged
put the hiliteditemNames of me into tHilited
put list before tHilited
databaseConnect
tHilited
end hiliteChanged
on mouseUp
databaseConnect
listMOU
end mouseUp
this works fine, it shows the correct values
now I would like to use a segmented control where I get the name of the handler from the tab:
on hiliteChanged
put the hiliteditemNames of me into tHilited
answer tHilited
put list before tHilited
answer tHilited
end hiliteChanged
the tHilited contains listMOU, but how do I get the value out of the variabel so it would look something like that:
on hiliteChanged
put the hiliteditemNames of me into tHilited
put list before tHilited
databaseConnect
tHilited
end hiliteChanged
Re: Variable in filepath
Ah, I think I get it now, you want to build the string "listMOU" from two singll strings "list" and "MOU". Is that correct?
In that case you could do something like this:
And please use the CODE tags after you pasted your script(s), this way formatting like identation will be kept!
In that case you could do something like this:
Code: Select all
on hiliteChanged
put the hiliteditemNames of me into tHilited
## Always put strings in QUOTES!
put "list" before tHilited
databaseConnect
## In cases like this we need to DO the concatenated handlername:
do tHilited
end hiliteChanged
Re: Variable in filepath
Perfect, that's what I needed
Thanky you very much
Thanky you very much