AutoHotkey Community

It is currently May 27th, 2012, 12:39 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 18 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: February 3rd, 2010, 4:08 am 
Offline

Joined: February 29th, 2008, 12:11 pm
Posts: 943
MasterFocus wrote:
It doesn't seem to support the "x = 1" line.
Only commands, I suppose.
I see. Thank you.

So, I think, before giving my script to a parsing loop, I need to come up with
a mechanism that would tell command lines from non-command ones.

I think it's not that hard.


Last edited by Benny-D on February 3rd, 2010, 5:40 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 3rd, 2010, 5:40 am 
Offline

Joined: February 29th, 2008, 12:11 pm
Posts: 943
Benny-D wrote:
I think it's not that hard.
I might've been too self-confident in saying that. On one hand, I kind of came up with
a script discerning the command lines (I don't know if this way is the best way, though) :
Code:
code =
(
Msgbox, about to start
x = 1
Msgbox, Here is x: %x%
)

CommandList=
(Join
AutoTrim,BlockInput,ClipWait,Control,ControlClick,ControlFocus,
ControlGet,ControlGetFocus,ControlGetPos,ControlGetText,
ControlMove,ControlSend,ControlSendRaw,ControlSetText,CoordMode,
DetectHiddenText,DetectHiddenWindows,Drive,DriveGet,
DriveSpaceFree,Edit,EnvAdd,EnvDiv,EnvMult,EnvSet,EnvSub,EnvUpdate,
ExitApp,FileAppend,FileCopy,FileCopyDir,FileCreateDir,
FileCreateShortcut,FileDelete,FileGetAttrib,FileGetShortcut,
FileGetSize,FileGetTime,FileGetVersion,FileMove,FileMoveDir,
FileRead,FileReadLine,FileRecycle,FileRecycleEmpty,FileRemoveDir,
FileSelectFile,FileSelectFolder,FileSetAttrib,FileSetTime,
GetKeyState,GroupActivate,GroupAdd,GroupClose,GroupDeactivate,Gui,
GuiControl,GuiControlGet,Hotkey,IfEqual,IfNotEqual,IfExist,
IfNotExist,IfGreater,IfGreaterOrEqual,IfInString,IfNotInString,
IfLess,IfLessOrEqual,IfMsgBox,IfWinActive,IfWinNotActive,IfWinExist,
IfWinNotExist,ImageSearch,IniDelete,IniRead,IniWrite,Input,InputBox,
KeyHistory,KeyWait,ListHotkeys,ListLines,ListVars,Menu,MouseClick,
MouseClickDrag,MouseGetPos,MouseMove,MsgBox,OnExit,OutputDebug,
Pause,PixelGetColor,PixelSearch,PostMessage,Process,Progress,Random,
RegDelete,RegRead,RegWrite,Reload,Run,RunAs,RunWait,Send,SendRaw,
SendMessage,SetBatchLines,SetCapslockState,SetControlDelay,
SetDefaultMouseSpeed,SetFormat,SetKeyDelay,SetMouseDelay,
SetNumlockState,SetScrollLockState,SetStoreCapslockMode,SetTimer,
SetTitleMatchMode,SetWinDelay,SetWorkingDir,Shutdown,Sleep,Sort,
SoundBeep,SoundGet,SoundGetWaveVolume,SoundPlay,SoundSet,
SoundSetWaveVolume,SplashImage,SplashTextOn,SplashTextOff,SplitPath,
StatusBarGetText,StatusBarWait,StringCaseSense,StringGetPos,
StringLeft,StringLen,StringLower,StringMid,StringReplace,StringRight,
StringSplit,StringTrimLeft,StringTrimRight,StringUpper,Suspend,
SysGet,Thread,ToolTip,Transform,TrayTip,URLDownloadToFile,
WinActivate,WinActivateBottom,WinClose,WinGetActiveStats,
WinGetActiveTitle,WinGetClass,WinGet,WinGetPos,WinGetText,
WinGetTitle,WinHide,WinKill,WinMaximize,WinMenuSelectItem,
WinMinimize,WinMinimizeAll,WinMinimizeAllUndo,WinMove,WinRestore,
WinSet,WinSetTitle,WinShow,WinWait,WinWaitActive,WinWaitClose,
WinWaitNotActive
)

loop, parse, code, `n
{
result := "is not"
CodeLine= %A_LoopField%
   loop, parse, CommandList, `,
   {
   FoundPos := InStr(CodeLine, A_LoopField)
   If FoundPos = 1
      {
      result := "is"
      break
      }
   }
msgbox, The code line # %A_Index% %result% a command line
}
But, on the other hand, when I was trying to incorporate it with that function, I realized
that I don't know how to turn the non-command lines in to "Run mode", i.e. if the
parsing loop sees that "X=1" line is not a command line, how can it let the script simply
run that line (assign value "1" to the variable "X")?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 4th, 2010, 2:59 am 
Offline

Joined: February 29th, 2008, 12:11 pm
Posts: 943
MasterFocus wrote:
It doesn't seem to support the "x = 1" line.
Only commands, I suppose.
I just discovered that it doesn't support loops and if-statements (blocks) either.
Oh boy, I am in trouble :(


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 18 posts ]  Go to page Previous  1, 2

All times are UTC [ DST ]


Who is online

Users browsing this forum: chaosad, jrav and 21 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group