Bert Posted May 29, 2008 Share Posted May 29, 2008 I'm reading a entry in a ini file. It is a saved macro I wish to use. looks like this: <B>More Information:</B><BR>'&@CRLF&' What I need to happen is after I read the ini entry, the code will format it so when I do a controlsend it looks like this: <B>More Information:</B><BR> What is wierd is if I do this, it works: ControlSend($hWnd,"","Edit1",'<B>More Information:</B><BR>'&@CR&' ') If I do this: $iniR20 = iniread(@ScriptDir&"/b_set.ini", "2", "1", "");allow for raw - I tried both 1 and 0, same result $iniR20a = iniread(@ScriptDir&"/b_set.ini", "2", "2", "") ControlSend($hWnd,"","Edit1",$iniR20a,$iniR20) I get this for output: <B>More Information:</B><BR>'&@CRLF&' The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Bert Posted May 29, 2008 Author Share Posted May 29, 2008 I've tried to do stringReplace with using @LF to @CR, but no luck. This is quite puzzling. it is as if when one uses a INI, the data will be sent raw no matter if controlsend uses the 0 flag or the 1 flag. Very odd. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 29, 2008 Moderators Share Posted May 29, 2008 Volly, the data is read as a string from the ini functions, so it's like wrapping it in quotes, which would make it "<B>More Information:</B><BR>'&@CRLF&' " So...MsgBox(64, "info", "<B>More Information:</B><BR>'&@CRLF&' ") would not separate the lines either. The idea that if you manually separate the "string" into sections and it works is not "weird" in fact lol it's logical . You would need to write a function to do that leg work for you. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
monoceres Posted May 29, 2008 Share Posted May 29, 2008 I think you can solve this with Execute() $iniR20 = iniread(@ScriptDir&"/b_set.ini", "2", "1", "");allow for raw - I tried both 1 and 0, same result $iniR20a = iniread(@ScriptDir&"/b_set.ini", "2", "2", "") ControlSend($hWnd,"","Edit1",Execute($iniR20),Execute($iniR20a)) Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 29, 2008 Moderators Share Posted May 29, 2008 I think you can solve this with Execute() $iniR20 = iniread(@ScriptDir&"/b_set.ini", "2", "1", "");allow for raw - I tried both 1 and 0, same result $iniR20a = iniread(@ScriptDir&"/b_set.ini", "2", "2", "") ControlSend($hWnd,"","Edit1",Execute($iniR20),Execute($iniR20a))oÝ÷ Ûú®¢×¢}ý¶ØbA1yË{¥ +·jëÊ·ö·¶×¦¦Ø§ÚÅç.µëayéí·¬¶¸§br¾*.²¢²}ýµ©ÚºÚ"µÊ&©Ýjëh×6$sStrTest = "<B>More Information:</B><BR>'&@CRLF&' " _IniExecuteMacro($sStrTest) MsgBox(64, "info", $sStrTest) ;You could add all the macros in this for a nice udf ;You could also use StringRegExpReplace so you don't replace the wrong thing... but this works for your need Func _IniExecuteMacro(ByRef $sString) Local $strMacro = StringSplit("@CRLF,@CR,@LF", ",");List could go on but you get the idea Local $m_Macro[4] = ["", @CRLF, @CR, @LF];List could go on but you get the idea For $iCC = 1 To $strMacro[0] $sString = StringReplace($sString, $strMacro[$iCC], $m_Macro[$iCC]) Next;$iCC EndFunc Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Bert Posted May 29, 2008 Author Share Posted May 29, 2008 I even tried this, but no luck: $rev1 = _StringReverse($iniR20) $rev2 = _StringReverse($rev1) no change. I also tried to see if send would work any different. no luck. I also thought it was a matter of quotes. I can send the string to Scite when using send, and it formats so that if I place the cursor inside the command in the correct spot, it formats right. I did think of putting the entire command in the ini file, but how does one exacute the command? The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Bert Posted May 29, 2008 Author Share Posted May 29, 2008 Volly, the data is read as a string from the ini functions, so it's like wrapping it in quotes, which would make it "<B>More Information:</B><BR>'&@CRLF&' " So...MsgBox(64, "info", "<B>More Information:</B><BR>'&@CRLF&' ") would not separate the lines either. The idea that if you manually separate the "string" into sections and it works is not "weird" in fact lol it's logical . You would need to write a function to do that leg work for you. The problem is I'm trying to run this like a macro. I'm not sure on how to approach it with what you are suggesting. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Bert Posted May 29, 2008 Author Share Posted May 29, 2008 Got it. What I did was this: $iniR20 = iniread(@ScriptDir&"/b_set.ini", "2", "2", "") Execute($iniR20) The ini looks like this: [2] 1=ControlSend($hWnd,"","Edit1", '<B>More Information:</B><BR>'& @CR &' ') works perfectly. Thanks guys! The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 29, 2008 Moderators Share Posted May 29, 2008 (edited) This was my general idea Volly:expandcollapse popup$sStrTest = "<B>More Information:</B><BR>&@CRLF& " $sTest = _StringExecuteMacro($sStrTest) MsgBox(64, "Replaced: " & @extended, $sTest) Func _StringExecuteMacro($sString) If StringInStr($sString, "@") = 0 Then Return SetExtended(0, $sString) Local $strMacro = _StringMacroCreate() Local $aMacro = StringSplit($strMacro, ",") Local $nExtendedCount = 0 For $iCC = 1 To $aMacro[0] $sString = StringRegExpReplace($sString, $aMacro[$iCC] & "(?!:\w+)", Execute($aMacro[$iCC])) $nExtendedCount += @extended Next;$iCC Return SetExtended($nExtendedCount, $sString) EndFunc Func _StringMacroCreate() $strMacro = "@AppDataCommonDir,@DesktopCommonDir,@DocumentsCommonDir" $strMacro &= ",@FavoritesCommonDir,@ProgramsCommonDir,@StartMenuCommonDir,@StartupCommonDir" $strMacro &= ",@AppDataDir,@DesktopDir,@MyDocumentsDir,@FavoritesDir" $strMacro &= ",@ProgramsDir,@StartMenuDir,@StartupDir,@UserProfileDir" $strMacro &= ",@HomeDrive,@HomePath,@HomeShare,@LogonDNSDomain" $strMacro &= ",@LogonDomain,@LogonServer,@ProgramFilesDir,@CommonFilesDir" $strMacro &= ",@WindowsDir,@SystemDir,@TempDir,@ComSpec" $strMacro &= ",@Unicode,@AutoItUnicode,@compiled,@error" $strMacro &= ",@exitCode,@exitMethod,@extended,@NumParams" $strMacro &= ",@ScriptName,@ScriptDir,@ScriptFullPath,@ScriptLineNumber" $strMacro &= ",@WorkingDir,@AutoItExe,@AutoItPID,@AutoItVersion" $strMacro &= ",@AutoItX64,@InetGetActive,@InetGetBytesRead,@COM_EventObj" $strMacro &= ",@GUI_CtrlId,@GUI_CtrlHandle,@GUI_DragID,@GUI_DragFile" $strMacro &= ",@GUI_DropID,@GUI_WinHandle,@HotKeyPressed,@SW_DISABLE" $strMacro &= ",@SW_ENABLE,@SW_HIDE,@SW_LOCK,@SW_MAXIMIZE" $strMacro &= ",@SW_MINIMIZE,@SW_RESTORE,@SW_SHOWDEFAULT,@SW_SHOWMAXIMIZED" $strMacro &= ",@SW_SHOWMINIMIZED,@SW_SHOWMINNOACTIVE,@SW_SHOWNA,@SW_SHOW" $strMacro &= ",@SW_SHOWNOACTIVATE,@SW_SHOWNORMAL,@SW_UNLOCK,@TRAY_ID" $strMacro &= ",@TrayIconFlashing,@TrayIconVisible,@CRLF,@CR" $strMacro &= ",@LF,@TAB,@KBLayout,@OSLang" $strMacro &= ",@OSType,@OSVersion,@OSBuild,@OSServicePack" $strMacro &= ",@ProcessorArch,@ComputerName,@UserName,@IPAddress1" $strMacro &= ",@IPAddress2,@IPAddress3,@IPAddress4,@DesktopHeight" $strMacro &= ",@DesktopWidth,@DesktopDepth,@DesktopRefresh,@SEC" $strMacro &= ",@MIN,@HOUR,@MDAY,@MON" $strMacro &= ",@YEAR,@WDAY,@YDAY" Return $strMacro EndFunc Edited May 29, 2008 by SmOke_N Had a variable incorrect Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
enaiman Posted May 29, 2008 Share Posted May 29, 2008 You can always use a sequence of characters (like @@) to represent @CRLF in the ini file - after you read the ini value you can easily replace @@ with @CRLF. Just my 2 cents ... SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
Bert Posted May 30, 2008 Author Share Posted May 30, 2008 The solution Smoke came up with looks good. I'm going to file that one in my stash. Thanks! The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now