picea892 Posted October 21, 2009 Share Posted October 21, 2009 (edited) I know exactly why this doesn't work but have no clue how to fix it. My inifile is setup like this: Sm Project Rm=Public Folders/All Public folders/Bookings/Meeting Rooms/Sm Project Rm I get the data and reformat it to look like this $objcal = $session.Folders("Public Folders").Folders("All Public folders").Folders("Bookings").Folders("Meeting Rooms").Folders("Sm Project Rm") however the script doesn't realize that it is not completely a string but actually a command to navigate to a certain folder in outlook. I could hardcode it correctly in my script. But I don't want to do this. I want the user to be able to change folder paths in the ini-file. Someone has to now how to do this. How do I read stuff from the .inifile and make the script know it's a command? Thanks in advance. expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ListViewConstants.au3> Local $listview, $button, $item1, $item2, $item3, $input1, $msg GUICreate("listview items", 420, 250, 100, 200, -1) GUISetBkColor(0x00E0FFFF) $listview = GUICtrlCreateListView("col1|col2|col3", 0, 0,420,250,bitor($LVS_NOCOLUMNHEADER,$LVS_SORTDESCENDING)) $objOL = ObjCreate("Outlook.Application") $session = $objOL.GetNameSpace("MAPI") $names=IniReadSectionNames(@scriptdir&"\ocal.ini") for $i=1 to $names[0] $sectionnames=IniReadSection(@scriptdir&"\ocal.ini",$names[$i]) for $j = 1 to $sectionnames[0][0] $calfullpath='.Folders("'&StringReplace($sectionnames[$j][1],'/','").Folders("')&')' Global $objcal = $session&$calfullpath calendar2() next Next $objcal = $session.GetDefaultFolder(9) func calendar2() For $m In $objcal.items if @YEAR&@MON&@MDAY >= StringLeft($m.start,8) and StringLeft($m.end,8) >= @YEAR&@MON&@MDAY then ;ToolTip(StringLeft($m.end,8)&" "& @YEAR&@MON&@MDAY) ;sleep(2000) $item1 = GUICtrlCreateListViewItem($m.subject&"|"&$m.end&"|"&$m.location, $listview) EndIf Next GUICtrlSendMsg($listview, $LVM_SETCOLUMNWIDTH, 0, $LVSCW_AUTOSIZE) $session.logoff GUISetState() sleep(10000) EndFunc Edited October 21, 2009 by picea892 Link to comment Share on other sites More sharing options...
FuryCell Posted October 21, 2009 Share Posted October 21, 2009 Take a look at execute in the helpfile. It can execute code stored in a string. HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code. Link to comment Share on other sites More sharing options...
picea892 Posted October 21, 2009 Author Share Posted October 21, 2009 Excellent, it worked like a charm, thank you for the prompt and easy solution. Link to comment Share on other sites More sharing options...
PsaltyDS Posted October 21, 2009 Share Posted October 21, 2009 Missing a closing double quote in the literal string: ; $calfullpath = '.Folders("' & StringReplace($sectionnames[$j][1], '/', '").Folders("') & ')' $calfullpath = '.Folders("' & StringReplace($sectionnames[$j][1], '/', '").Folders("') & '")' Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
picea892 Posted October 21, 2009 Author Share Posted October 21, 2009 Yes, saw that. I'll post the working version for others who have the same needs. expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ListViewConstants.au3> Local $listview, $button, $item1, $item2, $item3, $input1, $msg GUICreate("listview items", 420, 250, 100, 200, -1) GUISetBkColor(0x00E0FFFF) $listview = GUICtrlCreateListView("col1|col2|col3", 0, 0,420,250,bitor($LVS_NOCOLUMNHEADER,$LVS_SORTDESCENDING)) $objOL = ObjCreate("Outlook.Application") $session = $objOL.GetNameSpace("MAPI") $names=IniReadSectionNames(@scriptdir&"\ocal.ini") for $i=1 to $names[0] $sectionnames=IniReadSection(@scriptdir&"\ocal.ini",$names[$i]) for $j = 1 to $sectionnames[0][0] $calfullpath='$session.Folders("'&StringReplace($sectionnames[$j][1],'/','").Folders("')&'")' Global $objcal = Execute($calfullpath) $busyornot=calendar2() $item1 = GUICtrlCreateListViewItem($sectionnames[$j][0]&"|"&$busyornot, $listview) GUICtrlSendMsg($listview, $LVM_SETCOLUMNWIDTH, 0, $LVSCW_AUTOSIZE) next Next GUISetState() While 1 sleep(1000) WEnd ;$objcal = $session.GetDefaultFolder(9) func calendar2() For $m In $objcal.items if @YEAR&@MON&@MDAY >= StringLeft($m.start,8) and StringLeft($m.end,8) >= @YEAR&@MON&@MDAY then return "busy" EndIf Next GUICtrlSendMsg($listview, $LVM_SETCOLUMNWIDTH, 0, $LVSCW_AUTOSIZE) $session.logoff Return "available" EndFunc 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