X4OX0

Jun 22, 2013, 10:43 PM

Hey All,

I'm building a script for Final Cut Pro (7) this is a small part of the entire script and I am having some difficulties getting this to work. So, the objective is to get a number from the user, then to have the number escalate as it repeats. I also need to make this number "Paste" in. However I cannot use the cliboard functions at all because they will be in use in a different part of the script.

What this part was designed to do, (but doesn't do all the time ) is take the number submitted by the user, and break it down by digit and spit it back out in the form of a variable key code. Another part of the script would do the escalation of the number. But what I really need is to find out why the greater than or equal to/ less than or equal to aren't correctly segmentig the numbers, so the script doesn't try to do the input number more than once.

set start_value to text returned of (display dialog "Start number?: " default answer "") as number

if start_value is greater than or equal to 0 then

if start_value is less than or equal to 9 then

set start_value to start_value as string

set start_value01 to 0

set start_value02 to 0

set start_value03 to the first item of start_value as number

end if

end if

if start_value is greater than or equal to 10 then

if start_value is less than or equal to 99 then

set start_value to start_value as string

set start_value01 to 0

set start_value02 to the first item of start_value as number

set start_value03 to the second item of start_value as number

end if

end if

if start_value is greater than or equal to 100 then

if start_value is less than or equal to 999 then

set start_value to start_value as string

set start_value01 to the first item of start_value as number

set start_value02 to the second item of start_value as number

set start_value03 to the third item of start_value as number

end if

end if

if start_value01 is 1 then set O1 to 18

if start_value01 is 2 then set O1 to 19

if start_value01 is 3 then set O1 to 20

if start_value01 is 4 then set O1 to 21

if start_value01 is 5 then set O1 to 23

if start_value01 is 6 then set O1 to 22

if start_value01 is 7 then set O1 to 26

if start_value01 is 8 then set O1 to 28

if start_value01 is 9 then set O1 to 25

if start_value01 is 0 then set O1 to 29

if start_value02 is 1 then set O2 to 18

if start_value02 is 2 then set O2 to 19

if start_value02 is 3 then set O2 to 20

if start_value02 is 4 then set O2 to 21

if start_value02 is 5 then set O2 to 23

if start_value02 is 6 then set O2 to 22

if start_value02 is 7 then set O2 to 26

if start_value02 is 8 then set O2 to 28

if start_value02 is 9 then set O2 to 25

if start_value02 is 0 then set O2 to 29

if start_value03 is 1 then set O3 to 18

if start_value03 is 2 then set O3 to 19

if start_value03 is 3 then set O3 to 20

if start_value03 is 4 then set O3 to 21

if start_value03 is 5 then set O3 to 23

if start_value03 is 6 then set O3 to 22

if start_value03 is 7 then set O3 to 26

if start_value03 is 8 then set O3 to 28

if start_value03 is 9 then set O3 to 25

if start_value03 is 0 then set O3 to 29

tell application "TextEdit"

activate

tell application "System Events"

tell process "TextEdit"

key code O1

delay 0.1

key code O2

delay 0.1

key code O3

end tell

end tell

end tell

Text Edit being my test dummy for this part of the operation. I am on 10.8, a couple others will be on 10.7.

Thanks for any help on this!

Gabe

I'm building a script for Final Cut Pro (7) this is a small part of the entire script and I am having some difficulties getting this to work. So, the objective is to get a number from the user, then to have the number escalate as it repeats. I also need to make this number "Paste" in. However I cannot use the cliboard functions at all because they will be in use in a different part of the script.

What this part was designed to do, (but doesn't do all the time ) is take the number submitted by the user, and break it down by digit and spit it back out in the form of a variable key code. Another part of the script would do the escalation of the number. But what I really need is to find out why the greater than or equal to/ less than or equal to aren't correctly segmentig the numbers, so the script doesn't try to do the input number more than once.

set start_value to text returned of (display dialog "Start number?: " default answer "") as number

if start_value is greater than or equal to 0 then

if start_value is less than or equal to 9 then

set start_value to start_value as string

set start_value01 to 0

set start_value02 to 0

set start_value03 to the first item of start_value as number

end if

end if

if start_value is greater than or equal to 10 then

if start_value is less than or equal to 99 then

set start_value to start_value as string

set start_value01 to 0

set start_value02 to the first item of start_value as number

set start_value03 to the second item of start_value as number

end if

end if

if start_value is greater than or equal to 100 then

if start_value is less than or equal to 999 then

set start_value to start_value as string

set start_value01 to the first item of start_value as number

set start_value02 to the second item of start_value as number

set start_value03 to the third item of start_value as number

end if

end if

if start_value01 is 1 then set O1 to 18

if start_value01 is 2 then set O1 to 19

if start_value01 is 3 then set O1 to 20

if start_value01 is 4 then set O1 to 21

if start_value01 is 5 then set O1 to 23

if start_value01 is 6 then set O1 to 22

if start_value01 is 7 then set O1 to 26

if start_value01 is 8 then set O1 to 28

if start_value01 is 9 then set O1 to 25

if start_value01 is 0 then set O1 to 29

if start_value02 is 1 then set O2 to 18

if start_value02 is 2 then set O2 to 19

if start_value02 is 3 then set O2 to 20

if start_value02 is 4 then set O2 to 21

if start_value02 is 5 then set O2 to 23

if start_value02 is 6 then set O2 to 22

if start_value02 is 7 then set O2 to 26

if start_value02 is 8 then set O2 to 28

if start_value02 is 9 then set O2 to 25

if start_value02 is 0 then set O2 to 29

if start_value03 is 1 then set O3 to 18

if start_value03 is 2 then set O3 to 19

if start_value03 is 3 then set O3 to 20

if start_value03 is 4 then set O3 to 21

if start_value03 is 5 then set O3 to 23

if start_value03 is 6 then set O3 to 22

if start_value03 is 7 then set O3 to 26

if start_value03 is 8 then set O3 to 28

if start_value03 is 9 then set O3 to 25

if start_value03 is 0 then set O3 to 29

tell application "TextEdit"

activate

tell application "System Events"

tell process "TextEdit"

key code O1

delay 0.1

key code O2

delay 0.1

key code O3

end tell

end tell

end tell

Text Edit being my test dummy for this part of the operation. I am on 10.8, a couple others will be on 10.7.

Thanks for any help on this!

Gabe