Jump to content
Sign in to follow this  
b3vad

set a key to press as a variable

Recommended Posts

b3vad

Hi  ^_^ 
I'm trying to define a key inside a variable but I have no idea what I'm doing. >_< 
can somebody point me at the right direction please.
trying to define

Send("{DEL 4}")

as

$key='"{DEL'+4+'}"'

Send($key)

Func breakit()
   $jdi = StringSplit($for, ".")
EndFunc

Func doit()
   send("{F2}")
   if $jdi[0]=0 Then
      send("{HOME}")
      $s="{LEFT "
      $d="{DEL "
   Else
      send("{END}")
      $s='"{RIGHT '+2+'}"'
      $d='"{BS '+2+'}"'
   EndIf
   rest()
EndFunc

as you can see tried some things but nothing works so far. :whistle: thank you


[center]My language! gets the job done![/center]

Share this post


Link to post
Share on other sites
PhoenixXL

You should use concatenation, use for concatenation

$key='{DEL' & 4 & '}'

Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites
FireFox

Hi,

You are using the wrong operators.

From the helpfile:

Assignment operator

&: Concatenates/joins two strings. e.g. "one" & 10 (equals "one10")

Mathematical operator

+: Adds two numbers. e.g. 10 + 20 (equals 30)

$key='"{DEL'+4+'}"'

;should be:
$key='"{DEL' & 4 & '}"'

;but:
Send($key)
;gives:
Send('"{DEL4}"')

;so the right string is:
$key = "{DEL " & 4 & "}"
Do not hesitate to make some debugging with the MsgBox/ConsoleWrite functions.

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
b3vad

so that's what I was doing wrong thanks  :thumbsup:


[center]My language! gets the job done![/center]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×