🏠 ホーム 🔧 自作ツール 📓 日常のブログ 🍜 飯のブログ 📚 勉強のブログ 🗂️ その他のブログ
👃 TTManager32's Code - NoseScape

てんともち / TTManager32 Public

config_loader.hsp 4,815 Bytes
*Config_load
title AppName+" v"+AppVer+" - ロード中"
redraw 0
//ボタン類のロック
if isLoaded {
	objprm 62,"再ロード中..."
	repeat 66
		objenable cnt,0
	loop
}
//ファイルの存在確認
exist "weekly.ini" : if strsize<1 { dialog "weekly.iniが見つかりません。これでは続行できません。",1,"設定ファイル不足" : end }
exist "todo.ini"   : if strsize<1 { dialog "todo.iniが見つかりません。これでは続行できません。",1,"設定ファイル不足" : end }

objprm 55,""
objprm 56,""
objprm 57,""
objprm 58,""

//時間割のロード
sdim buffers
notesel buffers
noteload "weekly.ini"

//月曜(0)~土曜(5)
TargetYOUBI = "Mon","Tue","Wed","Thu","Fri","Sat"
Mode    = -1
sdim DataStorage,6,6

//実際の取得
repeat 6
	x=cnt
	y=0
	repeat 6
		y=cnt
		DataStorage(x,y)=""
	loop
loop

//配列変数への反映
repeat notemax
	noteget tmp,cnt
	if Mode<5 {
		if 0=instr(tmp,0,"["+TargetYOUBI(Mode+1)+"]") { Mode++ : continue}
	}
	if Mode=-1 : continue
	if 0=instr(tmp,0,"slot1") { DataStorage(Mode,0)=TextFormat(tmp) : continue }
	if 0=instr(tmp,0,"slot2") { DataStorage(Mode,1)=TextFormat(tmp) : continue }
	if 0=instr(tmp,0,"slot3") { DataStorage(Mode,2)=TextFormat(tmp) : continue }
	if 0=instr(tmp,0,"slot4") { DataStorage(Mode,3)=TextFormat(tmp) : continue }
	if 0=instr(tmp,0,"slot5") { DataStorage(Mode,4)=TextFormat(tmp) : continue }
	if 0=instr(tmp,0,"slot6") { DataStorage(Mode,5)=TextFormat(tmp) : continue }
loop

//実際の反映
z=0
repeat 6
	x=cnt
	y=0
	repeat 6
		y=cnt
		if DataStorage(x,y)!="" {
			SetWindowLong objinfo(z, 2), -16, $50000000 | $2000
			tmp=DataStorage(x,y)
			split tmp,"|",tmp
			objprm z,""+tmp(0)+"\n\n"+tmp(1)
		}else{
			objprm z,""
		}
		objenable z,1
		z++
	loop
loop

noteunsel

//終了したエリアの解放
repeat 6
	objenable 36+cnt,1
loop

//Todoリストのロード
sdim buffers
notesel buffers
noteload "todo.ini"

//ファイルからのロード
repeat notemax
	t=cnt
	sdim tmp
	noteget tmp,cnt
	if instr(tmp,0,"[data]")=0 : t++ : break
loop

//構造解釈
sdim TaskList
repeat notemax-t
	x=cnt+t
	sdim tmp
	noteget tmp,x
	split tmp,"=",tmp
	if length(tmp)!=2 : continue
	
	sdim dates : sdim times
	split tmp(0),"/",dates
	split dates(3),":",times
	TaskList(length(TaskList))=""+time2ut(int(dates(0)),int(dates(1)),int(dates(2)),int(times(0)),int(times(1)),0)+"@"+tmp(1)
loop

sortstr TaskList,0 //小さい順でソート

//表示
store=""
repeat length(TaskList)
	if TaskList(cnt)="" : continue
	sdim tmp
	split TaskList(cnt),"@",tmp
	ut2time y,m,d,h,mi,s,int(tmp(0))
	sdim p
	split tmp(1),"|",p
	store+=p(0)+"\n"
	objprm 55,store
loop

//gettime(2)は日曜始まり(0) DataStorageは月曜始まり(0)なので、gettime-1が相当する
//リスト化
sdim TodayList,6
dim today
i=gettime(2)-1
repeat 7
	y=0
	p=cnt
	if i=-1 : i++ : continue
	if i=6 : i=0 : continue
	repeat 6
		sdim tmp1
		tmp=DataStorage(i,y)
		if tmp="" : y++ : continue
		dim h
		dim m
		switch y
			case 0 : split Var_Slot1,"-",tmp1 : swbreak
			case 1 : split Var_Slot2,"-",tmp1 : swbreak
			case 2 : split Var_Slot3,"-",tmp1 : swbreak
			case 3 : split Var_Slot4,"-",tmp1 : swbreak
			case 4 : split Var_Slot5,"-",tmp1 : swbreak
			case 5 : split Var_Slot6,"-",tmp1 : swbreak
		swend
		split tmp1(0),":",h,m
		h=int(h) : m=int(m)
		y++
		split tmp,"|",tmp
		TodayList(length(TodayList))=""+str(time2ut(gettime(0),gettime(1),gettime(3),h,m,0)+86400*p)+"@"+tmp(0)+"|"+tmp(1)+"|"+tmp(2)
	loop
	i++
loop

sortstr TodayList,0

//予定タイムラインの用意
sdim RawList,256

//時間割リストのロード
repeat length(TaskList)
	if TaskList(cnt)!="" : {
		RawList(length(RawList))=TaskList(cnt)
	}
loop
//Tidiリストからのロード
repeat length(TodayList)
	if TodayList(cnt)!="" : {
		sdim tmp
		tmp=TodayList(cnt)
		split tmp,"@",tmp
		if time2ut(gettime(0),gettime(1),gettime(3),gettime(4),gettime(5),00)-1800>tmp : continue
		RawList(length(RawList))=TodayList(cnt)
	}
loop
//現在時刻の追加
//(*を先頭に入れたものは通知されない)
RawList(length(RawList))=""+time2ut(gettime(0),gettime(1),gettime(3),gettime(4),gettime(5),0)+"@*タイムラインの最終更新"

//UNIX時間ベースでソート
sortstr RawList,0

//表示
sdim out
sdim last_time
out="タイムライン:"
repeat length(RawList)
	sdim tmp
	sdim date
	tmp=RawList(cnt)
	if tmp="" : continue
	split tmp,"@",date,tmp
	strrep tmp,"*",""
	split tmp,"|",tmp
	ut2time y,m,d,h,mi,s,int(date)
	if last_time!=strf("%04d/%02d/%02d",y,m,d) {
		last_time=strf("%04d/%02d/%02d",y,m,d)
		out+=strf("\n★ %04d/%02d/%02d\n",y,m,d)
	}
	out+=strf("%02d:%02d , ",h,mi)+tmp(0)+"\n"
	objprm 61,out
loop

//ボタンの解放
repeat 11
	objenable 55+cnt,1
loop

dim IgnoreList,length(RawList),10

objprm 62,"再ロードする"
title AppName+" v"+AppVer+" - 稼働中"
isLoaded=1
redraw 1
return