DPenfold
Members-
Posts
84 -
Joined
-
Last visited
Content Type
Forums
News
20th
EduGeek EDIT Conference
Blogs
Everything posted by DPenfold
-
Hi We've not long had some x2 Creality Ender-3 Pro at work but I'm having some slight trouble with one of the printers; 1st printer set up prints about 98-99% Perfect (thought just now it's messing up a print I'm trying so I don't know whats happened there...) 2nd Printer originally prints most sides nicely but the rear is horrible but now good sizes are 'bad' but the rear is horrible, plus supports mess up entirely (see attached rar for pics of a benchy boat print) 3rd Printer prints perfectly (at least to my knwoledge). so the 1st/3rd printers I'm fine with but the 2nd I just can't figure out what I have to do to print out as good as the others; I've re-aligned the print bed several times, I've adjust the x axis belt/wheel/tighter thats on the right hand side, adjusted the wheels on the x axis/extruder, checked settings and it's fine for the other printers but just not for this printer. Any advice (or where to ask) would be great, atm my knowledge is slowly building from youtube inbetween practical lessons and spare time etc. Thanks p.s. if I've posted this question in the wrong section of EduGeek just let me know and I'll move/repost in the right place etc. Benchy Photos.rar
-
Hi Background; years ago I created a html page that would open .swf files in the browser (using the flahs plugins etc.), however web browsers have phased flash out of thier programs and rundering the html page useless. We can up with a work around that allows that if we open the .swf using a flash player it will work however we couldn't do it via the html page and we want to avoid using shotcuts (clutter etc.) so I created a visual basic prgram and it all works but the the teach that uses it wants the student to access it from home but we can't (out right) give them the .swf files. So my problrm; I want it so the students can easily download it as one single .exe program and use it home with no trouble, my thought is to dump flash player .exe and the .swf files in to my program (I'm using visual studio) and have the code reffere to them rather than using a network path then when I 'build' the program I want it to combine all the files into a single .exe. I'm sure there is a way as I've mamanged to add image files into my projects before but I can't add .exe and .swf in a way I can access them etc. and then build them in to a single .exe I hope I've explained it well enough, if not feel free to let me know. thanks!
-
Tried using this for something else but I'm getting errors if I use strArr(1) Public Class Form1 Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load 'Open the file for reading Using reader As StreamReader = New StreamReader("P:\Scripts\Powershell\Adding Users to Teams (from CSV lists)\Get Users and Teams\TeamsList.csv") 'Read the first line in the file and save to variables Dim line As String = reader.ReadLine line.Replace("""", "") While Not line Is Nothing 'Keep looping till we have read all the lines 'Split the current line everytime there is a comma and place int on array Dim strArr() As String = line.Split(",") 'Dim OldLines As String = RichTextBox1.Text Dim TeamID As String = strArr(0) 'Dim TeamName As String = strArr(1) Dim TeamLine As String = TeamID & "-" '& TeamName & vbNewLine 'MsgBox(strArr(0)) 'TeamLine.Replace("""", "") ListBox1.Items.Add(TeamLine) 'RichTextBox1.Text = strArr(1) & vbNewLine 'Move onto the next line in the file line = reader.ReadLine End While End Using End SubEnd Class Sorry in a rush to finish for the day so I haven't coloured it etc.
-
Update: There was an issue with our system where the passwords weren't syncing (ticket raised by a staff member who changed their password etc.) this has no been fixed by Microsoft so I don't need to update my program to run the PowerShell Script/Code (thank god!) as the system will sync about every 2 minutes or so. Thanks to Steve21 for their input!
-
I've added the complete project, added features; Advance editing; -increases the the form window and shows richtextbox and command buttons (Load, Save, Update) -Load loads the AppData.ini file -Saves edited information to AppData.ini with needed shorthand labels for the code to identify where to put information while updating the rich textbox -Updates the rich textbox with the data from the single textboxes -Rich textbox shows the raw data from the app.ini, this can be edited and it will update the text boxes (can't not do it in reverse with out multiple change subs) Better form resizing and label location (kinda) control bar hides when program not in use Option to show time and duration of current period above the lesson label and I think thats it compaired to previous release I've also added another program I was working on (but it's missing allot of it's notes) just thought if someone wanted it as well as the lesson idicator. It's called time table indicator very simlar to the lesson idicator but shows class code and tutor initials of the class for that peroid. I've not added any note (or much notes) I will do late, I had trouble with it updating but I got it to work now (looking at it now I don't think it's updated lol *update below*) but it should. Feel free to tweek the programs if you like I'm not fussed, any issues please do let me know and I'll see what I can do . Update found the error; When the ticker checks the day, for Friday it stores the variable as "varDay = "Fr" " (line 134 of From1.vb), "Fr" is wrong as it should be just "F", I've updated it at my end but to save me reuploading it I'd thought I'd put a message here.
-
spoke to colleague he isn't sure how our syncs are set up, this is where my technician skills get weak on the network side of things sadly I'll try and find out more. If you know where I can find out (as I do have access to everything) then I can go look/check The program will force a default password we use on new accounts or when we manually reset passwords (the program does the same specifying a password), the user themselves would need to update their password when they have logged in
-
The simple doe (echo etc.) works but trying to get it to call or use the line of code I need it complains; [color=#0000ff]Connect-MsolService[/color] -Credential (New-Object -TypeName [color=#800080]System.Management.Automation.PSCredential[/color] -ArgumentList [color=#a52a2a]"my-email"[/color], ([color=#0000ff]Get-Content[/color] -Path [color=#a52a2a]"C:\dpenfold.txt"[/color] | [color=#0000ff]ConvertTo-SecureString[/color])) [color=#0000ff]Set-MsolUserPassword[/color] -UserPrincipalName [color=#800080]student-email[/color] -NewPassword [color=#800080]p/w[/color] -ForceChangePassword [color=#a52a2a]$False[/color] The system don't sync as quickly to office 365 and it takes a while for the email/password to sync with AD, so i need both passwords to be reset at the same time, thought it will be come more tricky if they student changes their password once they are logged in to explain further the program I originally made calls in info from AD based on what the user selects; Staff/Tutor selects the year from dropdown menu, then the program collates all the names from AD into another dropdown menu for the staff/tutor to select, then it shows in label the select students' info(forename and surname, email address in full and their username) and generates buttons that will open their homedrive (based on homedrive path in AD) and resets user password to the original default (it also messages the staff/tutor that the student will need to make a new password when they log in). If you like I can send the program your way it has been quite useful but I see the homedrive will be replaced down the line due to SharePoint (which I'm fine with tbh).
-
My aim is to update my existing visual basic program that is design (in short) to reset a student password on Active Directory however this doesn't update their office 365 email credentials so we have to wait for the system to sync it self which can take a while to do (plus wasn't really great when school is were doing remote lessons recently etc.), so I was asked if there was a way to reset both AD and Office 365 credentials at the same time. Now I've tried myself with google and while I got a line of code for PowerShell and I can get a test VB program to create the line of code (even save it as a .ps1 file etc.), I can not get it to run. I believe the issue is it thinks it needs the MSOnline module for PowerShell but I have all that installed already. I tried simplifying the command for it to "write-host hello (username)' and even start notepad but it doesn't want to work. it does if i run the script manually... Alternatively I has the test program create a batch file/code to call the .ps1 file but again it doesn't want to do it. It looks like it wants to launch something but nothing happens (no hello (username) and no notepad etc.). I've tried various methods but I can't figure out why it won't run the code/script (PS or Bat > PS etc.) my latest code; [color=#0000ff]Dim [/color]BATCH_FILE_NAME [color=#0000ff]As String[/color] = [color=#b22222]"network path\test.bat" [/color] [color=#0000FF]Dim [/color]Bat_FILE_NAME [color=#0000ff]As String[/color] = [color=#b22222]"mapped drive path\test.bat" [/color] [color=#0000FF]Dim [/color]PS_FILE_NAME As String =[color=#b22222] "network path\test.ps1" [/color] [color=#0000FF]Dim [/color]BATCH_Code [color=#0000ff]As String[/color] = [color=#b22222]"Powershell.exe -ExecutionPolicy Bypass -noexit -file " [/color]& [color=#b22222]""""[/color] & [color=#b22222]"test.ps1"[/color] & [color=#b22222]"""" [/color] [color=#0000FF]Dim [/color]PS_Code [color=#0000ff]As String [/color] [color=#0000FF]Dim [/color]Name [color=#0000ff]As String [/color] [color=#0000ff]Private Sub[/color] Button1_Click(sender [color=#0000ff]As Object[/color], e [color=#0000ff]As [/color][color=#40e0d0]EventArgs[/color]) [color=#0000ff]Handles[/color] Button1.Click PS_Code = [color=#b22222]"Write-Host "[/color] & [color=#b22222]""""[/color] & cboNames.SelectedItem &[color=#b22222] """"[/color] & [color=#b22222]" | pause" [/color]& vbNewLine & [color=#b22222]"notepad.exe" [/color] [color=#808080]System[/color].IO.[color=#40e0d0]File[/color].WriteAllText(PS_FILE_NAME, PS_Code) [color=#808080]System[/color].IO.[color=#40e0d0]File[/color].WriteAllText(BATCH_FILE_NAME, BATCH_Code) [color=#0000ff]End Sub Private Sub[/color] Form1_Load(sender [color=#0000ff]As Object[/color], e [color=#0000ff]As [/color][color=#40e0d0]EventArgs[/color]) [color=#0000ff]Handles MyBase[/color].Load [color=#0000ff]With[/color] cboNames .Items.Add([color=#b22222]"dpenfold"[/color]) [color=#0000ff]End With End Sub[/color] [color=#0000ff]Private Sub[/color] Button2_Click(sender [color=#0000ff]As Object[/color], e [color=#0000ff]As [/color]EventArgs) [color=#0000ff]Handles [/color]Button2.Click [color=#008000]'System.Diagnostics.Process.Start("mapped drive path\test.bat") [/color] Shell([color=#b22222]"mapped drive path\test.bat"[/color]) [color=#0000ff]End Sub [/color]
-
Dragnog thanks for the input, while I got something sorted for the program itself but this will be usefor another program I'm thinking/planning where it can inport info from csv file (inporting serveral users all in to several teams on MS Teams). I'll upload the load/save update by friday I hope, it'll be the complete project so feel free to tweek etc.
-
I actually didn't know which was which as the both had close lol, but sorted, removed and even made the menu appear as right mouse click lol I got mixed up first (still tired and dyslexia over looking changed state to click etc.) but I got what you mean and changed it, I've also added fix to identify what the current selection is when edit form opens up; [color=#008000]'checks the current timetable type and applies it to the check box [/color] [color=#0000ff]If[/color] frmMain.TimeTableType = [color=#b22222]"Normal"[/color] [color=#0000ff]Then [/color] chkNormal.Checked = [color=#0000ff]True [/color] [color=#0000ff]ElseIf[/color] frmMain.TimeTableType = [color=#b22222]"Lockdown"[/color] [color=#0000ff]Then [/color] chkLockdown.Checked = [color=#0000ff]True [/color] [color=#0000ff]ElseIf[/color] frmMain.TimeTableType = [color=#b22222]"SocialDistancing"[/color] [color=#0000ff]Then [/color] chkSocialDistancing.Checked = [color=#0000ff]True [/color] [color=#0000ff]ElseIf [/color]frmMain.TimeTableType = [color=#b22222]"Custom"[/color] [color=#0000ff]Then [/color] chkCustom.Checked = [color=#0000ff]True [/color] [color=#0000ff]End If [/color] and in the clicked check boxes it changes the form (now that I know I can do this) [color=#008000]'Changes the variable in main form[/color] frmMain.TimeTableType = [color=#b22222]"Lockdown"[/color] So now, when user opens program and goes to edit it will have the default social distancing selected, from here if the user changes the type in either menu or check boxes it will all sync correctly I have an idea, I got a test working but it's fair bit of coding plus figuring out how to do a fail safe where it can create the file (maybe if statement if file not exist, created it using the default values etc.), my test works nicely and saves but doesn't take in to account if use changes a text box (not the saved file), to lightly explain the test i did; had richtextbox, I can call a file (.ini/textfile) and loaded it in to the textbox; test1: Hello test2: Right test3: Bye The code can read each line, if statement triggers if it finds "test 2". If statement removes "test 2:" and stores remains in label, then reads next line etc. [color=#008000]'file location [/color][color=#0000ff]Dim [/color]FILE_NAME [color=#0000ff]As String[/color] = [color=#a52a2a]"C:\test.ini"[/color] [color=#008000]'Will add code to determine program location and use that to store/load .ini[/color][color=#008000]'loads .ini and extracts needed variables [/color][color=#0000ff]If[/color] [color=#a9a9a9]System[/color].IO.[color=#40e0d0]File[/color].Exists(FILE_NAME) = [color=#0000ff]True Then [/color] RichTextBox1.Clear() RichTextBox1.Text = [color=#a9a9a9]System[/color].IO.[color=#40E0D0]File[/color].ReadAllText(FILE_NAME) [color=#0000ff]Else [/color] MessageBox.Show([color=#a52a2a]"File Does Not Exist"[/color]) [color=#0000ff]End If [/color] [color=#0000ff]For Each[/color] line [color=#0000ff]As String In[/color] RichTextBox1.Lines [color=#0000ff]If[/color] line.Contains("test1") [color=#0000ff]Then [/color] lblRB1.Text = line.Replace[color=#a52a2a]("test1: "[/color], [color=#a52a2a]""[/color]) [color=#0000ff]ElseIf[/color] line.Contains("test2") [color=#0000ff]Then [/color] lblRB2.Text = line.Replace([color=#a52a2a]"test2: "[/color], [color=#A52A2A]""[/color]) [color=#0000ff]ElseIf [/color]line.Contains("test3") [color=#0000ff]Then [/color] lblRB3.Text = line.Replace([color=#a52a2a]"test3: "[/color], [color=#A52A2A]""[/color]) [color=#0000ff]End If [/color] [color=#0000ff]Next[/color][color=#008000]'saves text box to file [/color][color=#a9a9a9]System[/color].IO.[color=#40E0D0]File[/color].WriteAllText(FILE_NAME, RichTextBox1.Text) I'd most likely put in a 3rd form "advance edit" or something and use the same set up buttons of Load, Save, Update and Ok, when pulling info from the textboxes in the "simple" edit, I can just pull the textboxes together adding a label (test2: )and rewrite it in the textbox before it saves (same way for it to create the .ini) so that way I can have a back and forth situation; edit in the simple textboxes and import it to .ini or import from .ini into the simple textboxes (think I explained that well enough x_x) Another small edit i might add is the time stamps in the main form and maybe current time too thank fully it's just simple labels and pull existing variables xD Sorry for the mass read x_x
-
Great! I noticed that couldn't find out why, it should be close via the menus (both) and the "X" minizine to tray Now this confused me (the program), it's a simple thing I did of it just making sure only one is ticked but normal wouldn't be ticked if I went to edit times and I can't figure out why, if you have better suggestions to enforce only one checkbox is ticked let me know Now that is something I want to do (save files or something) but I don't know how in any shape or form and how to reference it! At first, I thought maybe a CSV/Excel file and tell the text boxes to pull the data from that but the issue is the program forces the excel to open in the background and close. I didn't want that, I wanted to be little more streamlined/smoother, to my understanding unless set in coding variables can't be saved/stored it's volatile/temp memory right?
-
"Finished" the program if anyone was interested, based on time shows what the current period/lesson/break, has present times based on the school I work at (Normal, Lockdown (remote learning), Social Distancing and custom (for half days). Feel free for anyone contact me if there is any issues I'll do my best to respond/fix anything etc.
-
Think that was the problem I was getting in the mornings 07, 08, 09 but chances are I would have gotten it on minutes when I sort the other times out and add custom times, its running smoothly at the moment shwoing "before school" when i logged in this morning. I'll let you know if I figure out the other stuff to lol
-
God F*&@"$% Damn it! lol I changed it from string as it caused an error and i found the time variables and it worked, I've kept it all time based for now, so you can adjust the code to above and increase variables my a minute etc. I just gotta figure out the context menu for the tray icon, something for tomorrow as I need to head home lol Thanks again!!!! (note: when I add the note information who made it version etc. I'll put your name in as you did help out too!!)
-
Forum went down, worried if it was me as it wasn't uploaded haha, I've cleaned it up now so it looks decent and not a generic vb project, added comments etc., it has a try icon (and it will hide if closed - to close clock on the program, options > close - or click stop if your using VS etc.), not sure about the context menu? wouldn't appear for me, I think it comes up if you right click the tray icon but it wouldn't for me if you see it let me know. The current variables ARE off, by 1 minute, at the moment due to the error I was having so just change them when you debug it etc. no immediate rush at the moment still tinkering with it etc. feel free to use it yourself if you find a use (maybe new staff?)
-
when the real time hits 15:40 it doesn't change anything.... but when it turns to 15:41 the label shows Lesson 4 then same with After School but at 15:42 not 15:41 varLesson 4 = 15:40 VarAfterSchool = 1541 Current time = 15:39 (so no change) Current time = 15:40 (no change? Should be Lesson 4) Current time = 15:41 (Lesson 4, should be afterschool) Current time = 15:42 (After school) Code is the same as yours when you posted cases , I can send over the project folder for MS Visual Studio if the forum will accept zipped files
-
I'm trying the cases and it's off by a minute, like doing a test now 15:39, so I set Lesson 4 to 15:40 and After School for 15:41 but the label doesn't change until 15:40 (L4) and 15:41 (AS), it's like the code is ignoring the "=" part, I even added seconds to the variable in case that was the cause, weird!
-
Nice I'll look into that, my knowledge was quite basic when I first did VB (well VB6 lol) in college and we didn't use cases then just if statements and I've been able to migrate that over to excel, some scripting and VBS. Your code does clear up allot than repeated variables etc. took ageist to figure out to check a time between the start/end times etc. I'll give it a try, thank you!!
-
[color=#0000ff]Private Sub[/color] Form1_Load(sender [color=#0000ff]As Object[/color], e [color=#0000ff]As [/color]EventArgs) [color=#0000ff]Handles Me[/color].Load Timer1.Enabled = [color=#0000ff]True [/color] Timer1.Start() [color=#add8e6]Me[/color].TopMost = [color=#0000ff]True[/color] [color=#0000ff]End Sub [/color][color=#0000ff]Private Sub[/color] Timer1_Tick(sender [color=#0000ff]As Object[/color], e [color=#0000ff]As [/color]EventArgs) [color=#0000ff]Handles [/color]Timer1.Tick [color=#008000]'Varables for times of the day, st = Start, ed = End [/color][color=#0000ff]Dim [/color]varBefore_SchoolSt [color=#0000ff]As String[/color] [color=#0000ff]Dim [/color]varBefore_SchoolEd [color=#0000ff]As String[/color] [color=#0000ff]Dim [/color]varForm_TimeSt [color=#0000ff]As String[/color] [color=#0000ff]Dim [/color]varForm_TimeEd [color=#0000ff]As String[/color] [color=#0000ff]Dim [/color]varLesson_1St [color=#0000ff]As String [/color] [color=#0000ff]Dim [/color]varLesson_1Ed [color=#0000ff]As String [/color] [color=#0000ff]Dim [/color]varBreak1St [color=#0000ff]As String [/color] [color=#0000ff]Dim [/color]varBreak1Ed [color=#0000ff]As String [/color] [color=#0000ff]Dim [/color]varLesson_2St [color=#0000ff]As String [/color] [color=#0000ff]Dim [/color]varLesson_2Ed [color=#0000ff]As String [/color] [color=#0000ff]Dim [/color]varBreak2St [color=#0000ff]As String Dim[/color] varBreak2Ed [color=#0000ff]As String Dim [/color]varLesson_3St [color=#0000ff]As String Dim[/color] varLesson_3Ed [color=#0000ff]As String Dim[/color] varLunchSt [color=#0000ff]As String Dim[/color] varLunchEd [color=#0000ff]As String Dim [/color]varLesson_4St [color=#0000ff]As String Dim[/color] varLesson_4Ed [color=#0000ff]As String Dim[/color] varAfterSchoolSt [color=#0000ff]As String Dim[/color] varAfterSchoolEd [color=#0000ff]As String[/color] [color=#008000]'Set varables with times (testing atm, will adjust depending on option selected in combobox) [/color] varBefore_SchoolSt = [color=#b22222]"07:00"[/color] varBefore_SchoolEd = [color=#b22222]"08:55" [/color] varForm_TimeSt = [color=#b22222]"08:55" [/color] varForm_TimeEd =[color=#b22222] "09:15"[/color] varLesson_1St = [color=#b22222]"09:15"[/color] varLesson_1Ed = [color=#b22222]"10:15"[/color] varBreak1St = [color=#b22222]"10:15"[/color] varBreak1Ed = [color=#b22222]"10:30"[/color] varLesson_2St = [color=#b22222]"10:30"[/color] varLesson_2Ed = [color=#b22222]"11:30"[/color] varBreak2St = [color=#b22222]"11:30" [/color] varBreak2Ed = [color=#b22222]"11:45" [/color] varLesson_3St = [color=#b22222]"11:45" [/color] varLesson_3Ed = [color=#b22222]"12:45" [/color] varLunchSt = [color=#b22222]"12:45" [/color] varLunchEd = [color=#b22222]"13:30" [/color] varLesson_4St = [color=#b22222]"13:30" [/color] varLesson_4Ed = [color=#b22222]"14:30"[/color] varAfterSchoolSt = [color=#b22222]"14:30" [/color] varAfterSchoolEd = [color=#b22222]"17:40"[/color] [color=#008000]'Current time Varable [/color] [color=#0000ff]Dim [/color]varTime [color=#0000ff]As String [/color] [color=#008000]'Current time varable set as hh:mm [/color] varTime = Hour(TimeOfDay) & [color=#b22222]":"[/color] & Minute(TimeOfDay) [color=#008000]'Varable for result for bellow if statments [/color] [color=#0000ff]Dim [/color]varResult [color=#0000ff]As String[/color] [color=#008000]'If statments to where there current time falls under [/color] [color=#008000]'Before school 07:00 - 08:55[/color] [color=#0000ff]If [/color]varTime >= varBefore_SchoolSt [color=#0000ff]And [/color]varTime <= varBefore_SchoolEd [color=#0000ff]Then[/color] [color=#008000]'Set result varable to Before School[/color] varResult = [color=#b22222]"Before School"[/color] [color=#008000]'Set label to show the string in result varable[/color] lblLesson.Text = varResult [color=#008000]'Formtime 08:55 - 09:15 [/color] [color=#0000ff]ElseIf [/color]varTime >= varForm_TimeSt [color=#0000ff]And [/color]varTime <= varForm_TimeEd [color=#0000ff]Then[/color] [color=#008000]'Set result varable to Form Time[/color] varResult = [color=#b22222]"Form Time"[/color] [color=#008000]'Set label to show the string in result varable [/color] lblLesson.Text = varResult [color=#008000]'Lesson 1 09:15 - 10:15[/color] [color=#0000ff]ElseIf [/color]varTime >= varLesson_1St [color=#0000ff]And[/color] varTime <= varLesson_1Ed [color=#0000ff]Then[/color] [color=#008000]'Set result varable to Lesson 1[/color] varResult = [color=#b22222]"Lesson 1"[/color] [color=#008000]'Set label to show the string in result varable[/color] lblLesson.Text = varResult [color=#008000]'1st Break 10:15 - 10:30[/color] [color=#0000ff]ElseIf [/color]varTime >= varBreak1St [color=#0000ff]And [/color]varTime <= varBreak1Ed [color=#0000ff]Then[/color] [color=#008000]'Set result varable to Break[/color] varResult = [color=#b22222]"Break"[/color] [color=#008000]'Set label to show the string in result varable[/color] lblLesson.Text = varResult [color=#008000]'Lesson 2 10:30 - 11:30[/color] [color=#0000ff]ElseIf [/color]varTime >= varLesson_2St [color=#0000ff]And [/color]varTime <= varLesson_2Ed [color=#0000ff]Then[/color] [color=#008000]'Set result varable to Lesson 2[/color] varResult = [color=#b22222]"Lesson 2"[/color] [color=#008000]'Set label to show the string in result varable[/color] lblLesson.Text = varResult [color=#008000]'2nd Break 11:30 - 11:45[/color] [color=#0000ff]ElseIf [/color]varTime >= varBreak2St [color=#0000ff]And [/color]varTime <= varBreak2Ed [color=#0000ff]Then[/color] [color=#008000] 'Set result varable to Break[/color] varResult = [color=#b22222]"Break"[/color] [color=#008000]'Set label to show the string in result varable[/color] lblLesson.Text = varResult [color=#008000]'Lesson 3 11:45 - 12:45 [/color] [color=#0000ff]ElseIf [/color]varTime >= varLesson_3St [color=#0000ff]And [/color]varTime <= varLesson_3Ed [color=#0000ff]Then[/color] [color=#008000]'Set result varable to Lesson 3[/color] varResult = [color=#b22222]"Lesson 3"[/color] [color=#008000]'Set label to show the string in result varable[/color] lblLesson.Text = varResult [color=#008000]'Lunch 12:45 - 13:30 [/color] [color=#0000ff]ElseIf [/color]varTime >= varLunchSt [color=#0000ff]And [/color]varTime <= varLunchEd [color=#0000ff]Then[/color] [color=#008000]'Set result varable to Lunch[/color] varResult = [color=#b22222]"Lunch"[/color] [color=#008000]'Set label to show the string in result varable[/color] lblLesson.Text = varResult [color=#008000]'Lesson 4 13:30 - 14:30 [/color] [color=#0000ff]ElseIf [/color]varTime >= varLesson_4St [color=#0000ff]And [/color]varTime <= varLesson_4Ed [color=#0000ff]Then[/color] [color=#008000]'Set result varable to Lesson 4[/color] varResult = [color=#b22222]"Lesson 4"[/color] [color=#008000] 'Set label to show the string in result varable[/color] lblLesson.Text = varResult [color=#008000]'After school 14:30 - 17:40 [/color] [color=#0000ff]ElseIf [/color]varTime >= varAfterSchoolSt [color=#0000ff]And [/color]varTime <= varAfterSchoolEd [color=#0000ff]Then[/color] [color=#008000]'Set result varable to Afterschool[/color] varResult = [color=#b22222]"AfterSchool"[/color] [color=#008000]'Set label to show the string in result varable[/color] lblLesson.Text = varResult [color=#0000ff]End If[/color] [color=#0000ff] [/color][color=#0000FF]End Sub[/color] Think I got it (looked up timers), I've put the updated code above, just gotta figure out a way to keep it in the foreground now lol UPDATE: It works AND I got it to stay the foreground, thanks for the input Steve21 Post can be closed now
-
From, Label, combo box (explain in a moment), and thats about it atm, might add more later but it's early stages; [color=#008000]'Varables for times of the day, st = Start, ed = End [/color][color=#0000ff]Dim [/color]varBefore_SchoolSt [color=#0000ff]As String[/color] [color=#0000ff]Dim [/color]varBefore_SchoolEd [color=#0000ff]As String[/color] [color=#0000ff]Dim [/color]varForm_TimeSt [color=#0000ff]As String[/color] [color=#0000ff]Dim [/color]varForm_TimeEd [color=#0000ff]As String[/color] [color=#0000ff]Dim [/color]varLesson_1St [color=#0000ff]As String [/color] [color=#0000ff]Dim [/color]varLesson_1Ed [color=#0000ff]As String [/color] [color=#0000ff]Dim [/color]varBreak1St [color=#0000ff]As String [/color] [color=#0000ff]Dim [/color]varBreak1Ed [color=#0000ff]As String [/color] [color=#0000ff]Dim [/color]varLesson_2St [color=#0000ff]As String [/color] [color=#0000ff]Dim [/color]varLesson_2Ed [color=#0000ff]As String [/color] [color=#0000ff]Dim [/color]varBreak2St [color=#0000ff]As String Dim[/color] varBreak2Ed [color=#0000ff]As String Dim [/color]varLesson_3St [color=#0000ff]As String Dim[/color] varLesson_3Ed [color=#0000ff]As String Dim[/color] varLunchSt [color=#0000ff]As String Dim[/color] varLunchEd [color=#0000ff]As String Dim [/color]varLesson_4St [color=#0000ff]As String Dim[/color] varLesson_4Ed [color=#0000ff]As String Dim[/color] varAfterSchoolSt [color=#0000ff]As String Dim[/color] varAfterSchoolEd [color=#0000ff]As String[/color] [color=#008000]'Set varables with times (testing atm, will adjust depending on option selected in combobox) [/color] varBefore_SchoolSt = [color=#b22222]"07:00"[/color] varBefore_SchoolEd = [color=#b22222]"08:55" [/color] varForm_TimeSt = [color=#b22222]"08:55" [/color] varForm_TimeEd =[color=#b22222] "09:15"[/color] varLesson_1St = [color=#b22222]"09:15"[/color] varLesson_1Ed = [color=#b22222]"10:15"[/color] varBreak1St = [color=#b22222]"10:15"[/color] varBreak1Ed = [color=#b22222]"10:30"[/color] varLesson_2St = [color=#b22222]"10:30"[/color] varLesson_2Ed = [color=#b22222]"11:30"[/color] varBreak2St = [color=#b22222]"11:30" [/color] varBreak2Ed = [color=#b22222]"11:45" [/color] varLesson_3St = [color=#b22222]"11:45" [/color] varLesson_3Ed = [color=#b22222]"12:45" [/color] varLunchSt = [color=#b22222]"12:45" [/color] varLunchEd = [color=#b22222]"13:30" [/color] varLesson_4St = [color=#b22222]"13:30" [/color] varLesson_4Ed = [color=#b22222]"14:30"[/color] varAfterSchoolSt = [color=#b22222]"14:30" [/color] varAfterSchoolEd = [color=#b22222]"17:40"[/color] [color=#008000]'Current time Varable [/color] [color=#0000ff]Dim [/color]varTime [color=#0000ff]As String [/color] [color=#008000]'Current time varable set as hh:mm [/color] varTime = Hour(TimeOfDay) & [color=#b22222]":"[/color] & Minute(TimeOfDay) [color=#008000]'Varable for result for bellow if statments [/color] [color=#0000ff]Dim [/color]varResult [color=#0000ff]As String[/color] [color=#008000]'If statments to where there current time falls under [/color] [color=#008000]'Before school 07:00 - 08:55[/color] [color=#0000ff]If [/color]varTime >= varBefore_SchoolSt [color=#0000ff]And [/color]varTime <= varBefore_SchoolEd [color=#0000ff]Then[/color] [color=#008000]'Set result varable to Before School[/color] varResult = [color=#b22222]"Before School"[/color] [color=#008000]'Set label to show the string in result varable[/color] lblLesson.Text = varResult [color=#008000]'Formtime 08:55 - 09:15 [/color] [color=#0000ff]ElseIf [/color]varTime >= varForm_TimeSt [color=#0000ff]And [/color]varTime <= varForm_TimeEd [color=#0000ff]Then[/color] [color=#008000]'Set result varable to Form Time[/color] varResult = [color=#b22222]"Form Time"[/color] [color=#008000]'Set label to show the string in result varable [/color] lblLesson.Text = varResult [color=#008000]'Lesson 1 09:15 - 10:15[/color] [color=#0000ff]ElseIf [/color]varTime >= varLesson_1St [color=#0000ff]And[/color] varTime <= varLesson_1Ed [color=#0000ff]Then[/color] [color=#008000]'Set result varable to Lesson 1[/color] varResult = [color=#b22222]"Lesson 1"[/color] [color=#008000]'Set label to show the string in result varable[/color] lblLesson.Text = varResult [color=#008000]'1st Break 10:15 - 10:30[/color] [color=#0000ff]ElseIf [/color]varTime >= varBreak1St [color=#0000ff]And [/color]varTime <= varBreak1Ed [color=#0000ff]Then[/color] [color=#008000]'Set result varable to Break[/color] varResult = [color=#b22222]"Break"[/color] [color=#008000]'Set label to show the string in result varable[/color] lblLesson.Text = varResult [color=#008000]'Lesson 2 10:30 - 11:30[/color] [color=#0000ff]ElseIf [/color]varTime >= varLesson_2St [color=#0000ff]And [/color]varTime <= varLesson_2Ed [color=#0000ff]Then[/color] [color=#008000]'Set result varable to Lesson 2[/color] varResult = [color=#b22222]"Lesson 2"[/color] [color=#008000]'Set label to show the string in result varable[/color] lblLesson.Text = varResult [color=#008000]'2nd Break 11:30 - 11:45[/color] [color=#0000ff]ElseIf [/color]varTime >= varBreak2St [color=#0000ff]And [/color]varTime <= varBreak2Ed [color=#0000ff]Then[/color] [color=#008000] 'Set result varable to Break[/color] varResult = [color=#b22222]"Break"[/color] [color=#008000]'Set label to show the string in result varable[/color] lblLesson.Text = varResult [color=#008000]'Lesson 3 11:45 - 12:45 [/color] [color=#0000ff]ElseIf [/color]varTime >= varLesson_3St [color=#0000ff]And [/color]varTime <= varLesson_3Ed [color=#0000ff]Then[/color] [color=#008000]'Set result varable to Lesson 3[/color] varResult = [color=#b22222]"Lesson 3"[/color] [color=#008000]'Set label to show the string in result varable[/color] lblLesson.Text = varResult [color=#008000]'Lunch 12:45 - 13:30 [/color] [color=#0000ff]ElseIf [/color]varTime >= varLunchSt [color=#0000ff]And [/color]varTime <= varLunchEd [color=#0000ff]Then[/color] [color=#008000]'Set result varable to Lunch[/color] varResult = [color=#b22222]"Lunch"[/color] [color=#008000]'Set label to show the string in result varable[/color] lblLesson.Text = varResult [color=#008000]'Lesson 4 13:30 - 14:30 [/color] [color=#0000ff]ElseIf [/color]varTime >= varLesson_4St [color=#0000ff]And [/color]varTime <= varLesson_4Ed [color=#0000ff]Then[/color] [color=#008000]'Set result varable to Lesson 4[/color] varResult = [color=#b22222]"Lesson 4"[/color] [color=#008000] 'Set label to show the string in result varable[/color] lblLesson.Text = varResult [color=#008000]'After school 14:30 - 17:40 [/color] [color=#0000ff]ElseIf [/color]varTime >= varAfterSchoolSt [color=#0000ff]And [/color]varTime <= varAfterSchoolEd [color=#0000ff]Then[/color] [color=#008000]'Set result varable to Afterschool[/color] varResult = [color=#b22222]"AfterSchool"[/color] [color=#008000]'Set label to show the string in result varable[/color] lblLesson.Text = varResult [color=#0000ff]End If [/color] (Took a while to sort that mess of a code x_x), I've not included any subs as tbh it could go anywhere but that the general idea of the code, the combo box would determin the times being set and I can create a seperate ifstatment and a public varable to chnage the times accordingly etc. I'm not sure how to get it to auto refresh and run constantly in the background etc. (Sure I've said this but I've slept since then lol), it's just a program to run in the bottom right of the screen and when the time changes the caption in the label changes depending on the time. Hope that helps, thanks again
-
I'm trying to get a code run in the background and autoupdate with out any prompt from myself, easier if I explain the program and what I've got; I'm trying to make a basic program that will change the text of a label based on time, Between 9:15 am and 10:30 am the label will show Lesson 1 etc. I can get it to work as long as the window is active but I can't have the window active as I need to carry on with other peaces of work, I've tried load, active, deavtive and it just wont run in the background. Also if there is a way for it to alwyas be in the foreground/window on top (not sure of the lingo) then that would be great to (it's just gonna be a small window in the bottom right of the screen when running etc.). Thanks if any one can help
-
We've not migrated over to azure yet (still AD), for now staff are added as owners and students as members based on SIM info/timetable, this script witll help add additional staff to groups/teams that couldn't be done with SIM info etc. I will pass this over to the other technicians so we all know when ever we do migrate, thanks! .
-
It worked plus see secound post, it worked on the actual test of adding the list of users (2 users to 3 different teams). So thanks again!
