Define With and Height based on variable

Hi
I was trying this function on a floating menu and i think there might be an issue.
My width's variable give the correct size to the floating menu but the height's variable do nothing.
I was trying this with a simple floating menu, nothing specific, i have an applescript creating 2 variables for BTT. When i choose manually the size, in my script, the width change but not the height.

Intel Imac, Sequoia, last BTT

I just tried but it seems to work ok here

Example prese:

width_test2.bttpreset (168.5 KB)

Can you post the code you use to set the width variable?

In the code i use set_string_variable, it is only for testing your app's capabilities. The result give me the 2 variables i need

use framework "AppKit"
use framework "Foundation"
use scripting additions
set visibleDisplayPositionSize to getVisibleDisplayPositionSize()
on getVisibleDisplayPositionSize()
	set theScreen to current application's NSScreen's mainScreen()
	set {{x1, y1}, {w1, h1}} to theScreen's frame()
	set {{x2, y2}, {w2, h2}} to theScreen's visibleFrame()
	tell application "System Events" to set frontmostVisibleApp to name of first process whose frontmost is true
	tell application "System Events" to tell process frontmostVisibleApp
		set PP to position of window 1
		set FF to size of window 1
		set FF1 to item 1 of FF
		set FF2 to item 2 of FF
	end tell
	set XXX to (w2 - FF1) as integer
	set YYY to XXX - (item 1 of PP)
	tell application "BetterTouchTool"
		set_string_variable "RESO1" to XXX
		set_string_variable "RESO2" to YYY
	end tell
end getVisibleDisplayPositionSize

XXX and YYY give me 2 numbers
And when i try without my script, just :

tell application "BetterTouchTool"
	set_string_variable "RESO1" to "400"
	set_string_variable "RESO2" to "400"
end tell

the height don't change also.

ah width and height must be numbers, it can not interpret strings.
So you'd just need to replace set_string_variable with set_number_variable

e.g. set_number_variable "RES01" to 500

Ah ok ! It's good
Sorry for the mistake.
The strange thing is that the width was changing with set_string_variable, or maybe my eyes were too closed :slight_smile:
Thanks anyway !

that's weird, possibly it was falling back to some default or some implicit conversion happened somewhere. I'll probably add some code to make this also work with strings as a fallback solution.