Diana (Cda) Posted January 1 Posted January 1 Hello! Happy New Year 2025! Having trouble over last while to get this to work. I'm not sure I'm using FileWrite correctly and have looked over documentation, but to no avail. Using Inputbox, it's meant to just create series of place documents (no extension necessary) that will be overwritten once created. But nothing happens. ; ; AutoIt 3x ; #NoTrayIcon ; AutoIt's icon doesn't show in systray TraySetIcon("Shell32.dll", 153) ; changes the icon displayed in the systray AutoItSetOption("WinTitleMatchMode", 2) ; this allows partial window titles to be valid! ;------------------------------------------------------------------------------------------------------------------------- #Region --- CodeWizard generated code Start --- ;InputBox features: Title=Yes, Prompt=Yes, Default Text=No, Input Length=4, Width=500, Height=125 If Not IsDeclared("sInputBoxAnswer") Then Local $sInputBoxAnswer $sInputBoxAnswer = InputBox("Year?","What year do you wish to create calendars for?",""," 4","500","125","250","250") Select Case @Error = 0 ;OK - The string returned is valid FileWrite(@ScriptDir, $sInputBoxAnswer & ".01 - JAN " & $sInputBoxAnswer & " - Wall Calendar") FileWrite(@ScriptDir, $sInputBoxAnswer & ".02 - FEB " & $sInputBoxAnswer & " - Wall Calendar") FileWrite(@ScriptDir, $sInputBoxAnswer & ".03 - MAR " & $sInputBoxAnswer & " - Wall Calendar") FileWrite(@ScriptDir, $sInputBoxAnswer & ".04 - APR " & $sInputBoxAnswer & " - Wall Calendar") FileWrite(@ScriptDir, $sInputBoxAnswer & ".05 - MAY " & $sInputBoxAnswer & " - Wall Calendar") FileWrite(@ScriptDir, $sInputBoxAnswer & ".06 - JUN " & $sInputBoxAnswer & " - Wall Calendar") FileWrite(@ScriptDir, $sInputBoxAnswer & ".07 - JUL " & $sInputBoxAnswer & " - Wall Calendar") FileWrite(@ScriptDir, $sInputBoxAnswer & ".08 - AUG " & $sInputBoxAnswer & " - Wall Calendar") FileWrite(@ScriptDir, $sInputBoxAnswer & ".09 - SEP " & $sInputBoxAnswer & " - Wall Calendar") FileWrite(@ScriptDir, $sInputBoxAnswer & ".10 - OCT " & $sInputBoxAnswer & " - Wall Calendar") FileWrite(@ScriptDir, $sInputBoxAnswer & ".11 - NOV " & $sInputBoxAnswer & " - Wall Calendar") FileWrite(@ScriptDir, $sInputBoxAnswer & ".12 - DEC " & $sInputBoxAnswer & " - Wall Calendar") Case @Error = 1 ;The Cancel button was pushed Exit ; finished Case @Error = 3 ;The InputBox failed to open Exit ; finished EndSelect #EndRegion --- CodeWizard generated code End --- Any help greatly appreciated!
ioa747 Posted January 1 Posted January 1 (edited) ; AutoIt 3x ; #NoTrayIcon ; AutoIt's icon doesn't show in systray TraySetIcon("Shell32.dll", 153) ; changes the icon displayed in the systray AutoItSetOption("WinTitleMatchMode", 2) ; this allows partial window titles to be valid! ;------------------------------------------------------------------------------------------------------------------------- #Region --- CodeWizard generated code Start --- ;InputBox features: Title=Yes, Prompt=Yes, Default Text=No, Input Length=4, Width=500, Height=125 If Not IsDeclared("sInputBoxAnswer") Then Local $sInputBoxAnswer $sInputBoxAnswer = InputBox("Year?","What year do you wish to create calendars for?",""," 4","500","125","250","250") Select Case @Error = 0 ;OK - The string returned is valid Local $sCalendar = @ScriptDir & "\Calendar.txt" if FileExists($sCalendar) Then FileDelete($sCalendar) FileWriteLine($sCalendar, $sInputBoxAnswer & ".01 - JAN " & $sInputBoxAnswer & " - Wall Calendar") FileWriteLine($sCalendar, $sInputBoxAnswer & ".02 - FEB " & $sInputBoxAnswer & " - Wall Calendar") FileWriteLine($sCalendar, $sInputBoxAnswer & ".03 - MAR " & $sInputBoxAnswer & " - Wall Calendar") FileWriteLine($sCalendar, $sInputBoxAnswer & ".04 - APR " & $sInputBoxAnswer & " - Wall Calendar") FileWriteLine($sCalendar, $sInputBoxAnswer & ".05 - MAY " & $sInputBoxAnswer & " - Wall Calendar") FileWriteLine($sCalendar, $sInputBoxAnswer & ".06 - JUN " & $sInputBoxAnswer & " - Wall Calendar") FileWriteLine($sCalendar, $sInputBoxAnswer & ".07 - JUL " & $sInputBoxAnswer & " - Wall Calendar") FileWriteLine($sCalendar, $sInputBoxAnswer & ".08 - AUG " & $sInputBoxAnswer & " - Wall Calendar") FileWriteLine($sCalendar, $sInputBoxAnswer & ".09 - SEP " & $sInputBoxAnswer & " - Wall Calendar") FileWriteLine($sCalendar, $sInputBoxAnswer & ".10 - OCT " & $sInputBoxAnswer & " - Wall Calendar") FileWriteLine($sCalendar, $sInputBoxAnswer & ".11 - NOV " & $sInputBoxAnswer & " - Wall Calendar") FileWriteLine($sCalendar, $sInputBoxAnswer & ".12 - DEC " & $sInputBoxAnswer & " - Wall Calendar") ShellExecute($sCalendar) Case @Error = 1 ;The Cancel button was pushed Exit ; finished Case @Error = 3 ;The InputBox failed to open Exit ; finished EndSelect #EndRegion --- CodeWizard generated code End --- or expandcollapse popup; AutoIt 3x ; #NoTrayIcon ; AutoIt's icon doesn't show in systray TraySetIcon("Shell32.dll", 153) ; changes the icon displayed in the systray AutoItSetOption("WinTitleMatchMode", 2) ; this allows partial window titles to be valid! ;------------------------------------------------------------------------------------------------------------------------- #Region --- CodeWizard generated code Start --- ;InputBox features: Title=Yes, Prompt=Yes, Default Text=No, Input Length=4, Width=500, Height=125 If Not IsDeclared("sInputBoxAnswer") Then Local $sInputBoxAnswer $sInputBoxAnswer = InputBox("Year?", "What year do you wish to create calendars for?", "", " 4", "500", "125", "250", "250") Select Case @error = 0 ;OK - The string returned is valid Local $sCalendar = @ScriptDir & "\Calendar.txt" If FileExists($sCalendar) Then FileDelete($sCalendar) Local $sText = $sInputBoxAnswer & ".01 - JAN " & $sInputBoxAnswer & " - Wall Calendar" & @CRLF & _ $sInputBoxAnswer & ".02 - FEB " & $sInputBoxAnswer & " - Wall Calendar" & @CRLF & _ $sInputBoxAnswer & ".03 - MAR " & $sInputBoxAnswer & " - Wall Calendar" & @CRLF & _ $sInputBoxAnswer & ".04 - APR " & $sInputBoxAnswer & " - Wall Calendar" & @CRLF & _ $sInputBoxAnswer & ".05 - MAY " & $sInputBoxAnswer & " - Wall Calendar" & @CRLF & _ $sInputBoxAnswer & ".06 - JUN " & $sInputBoxAnswer & " - Wall Calendar" & @CRLF & _ $sInputBoxAnswer & ".07 - JUL " & $sInputBoxAnswer & " - Wall Calendar" & @CRLF & _ $sInputBoxAnswer & ".08 - AUG " & $sInputBoxAnswer & " - Wall Calendar" & @CRLF & _ $sInputBoxAnswer & ".09 - SEP " & $sInputBoxAnswer & " - Wall Calendar" & @CRLF & _ $sInputBoxAnswer & ".10 - OCT " & $sInputBoxAnswer & " - Wall Calendar" & @CRLF & _ $sInputBoxAnswer & ".11 - NOV " & $sInputBoxAnswer & " - Wall Calendar" & @CRLF & _ $sInputBoxAnswer & ".12 - DEC " & $sInputBoxAnswer & " - Wall Calendar" FileWrite($sCalendar, $sText) ShellExecute($sCalendar) Case @error = 1 ;The Cancel button was pushed Exit ; finished Case @error = 3 ;The InputBox failed to open Exit ; finished EndSelect #EndRegion --- CodeWizard generated code Start --- or (the one I prefer) expandcollapse popup; AutoIt 3x ; #NoTrayIcon ; AutoIt's icon doesn't show in systray TraySetIcon("Shell32.dll", 153) ; changes the icon displayed in the systray AutoItSetOption("WinTitleMatchMode", 2) ; this allows partial window titles to be valid! ;------------------------------------------------------------------------------------------------------------------------- #Region --- CodeWizard generated code Start --- ;InputBox features: Title=Yes, Prompt=Yes, Default Text=No, Input Length=4, Width=500, Height=125 If Not IsDeclared("sInputBoxAnswer") Then Local $sInputBoxAnswer $sInputBoxAnswer = InputBox("Year?", "What year do you wish to create calendars for?", "", " 4", "500", "125", "250", "250") Select Case @error = 0 ;OK - The string returned is valid Local $sCalendar = @ScriptDir & "\Calendar.txt" If FileExists($sCalendar) Then FileDelete($sCalendar) Local $sText = "" ; Calendar $sText &= $sInputBoxAnswer & ".01 - JAN " & $sInputBoxAnswer & " - Wall Calendar" & @CRLF $sText &= $sInputBoxAnswer & ".02 - FEB " & $sInputBoxAnswer & " - Wall Calendar" & @CRLF $sText &= $sInputBoxAnswer & ".03 - MAR " & $sInputBoxAnswer & " - Wall Calendar" & @CRLF $sText &= $sInputBoxAnswer & ".04 - APR " & $sInputBoxAnswer & " - Wall Calendar" & @CRLF $sText &= $sInputBoxAnswer & ".05 - MAY " & $sInputBoxAnswer & " - Wall Calendar" & @CRLF $sText &= $sInputBoxAnswer & ".06 - JUN " & $sInputBoxAnswer & " - Wall Calendar" & @CRLF $sText &= $sInputBoxAnswer & ".07 - JUL " & $sInputBoxAnswer & " - Wall Calendar" & @CRLF $sText &= $sInputBoxAnswer & ".08 - AUG " & $sInputBoxAnswer & " - Wall Calendar" & @CRLF $sText &= $sInputBoxAnswer & ".09 - SEP " & $sInputBoxAnswer & " - Wall Calendar" & @CRLF $sText &= $sInputBoxAnswer & ".10 - OCT " & $sInputBoxAnswer & " - Wall Calendar" & @CRLF $sText &= $sInputBoxAnswer & ".11 - NOV " & $sInputBoxAnswer & " - Wall Calendar" & @CRLF $sText &= $sInputBoxAnswer & ".12 - DEC " & $sInputBoxAnswer & " - Wall Calendar" FileWrite($sCalendar, $sText) ShellExecute($sCalendar) Case @error = 1 ;The Cancel button was pushed Exit ; finished Case @error = 3 ;The InputBox failed to open Exit ; finished EndSelect #EndRegion --- CodeWizard generated code Start --- Edited January 1 by ioa747 pixelsearch 1 I know that I know nothing
pixelsearch Posted January 1 Posted January 1 (edited) Another way, using a loop #include <Date.au3> ; #NoTrayIcon ; AutoIt's icon doesn't show in systray TraySetIcon("Shell32.dll", 153) ; changes the icon displayed in the systray AutoItSetOption("WinTitleMatchMode", 2) ; this allows partial window titles to be valid! ;------------------------------------------------------------------------------------------------------------------------- #Region --- CodeWizard generated code Start --- ;InputBox features: Title=Yes, Prompt=Yes, Default Text=No, Input Length=4, Width=500, Height=125 If Not IsDeclared("sInputBoxAnswer") Then Local $sInputBoxAnswer $sInputBoxAnswer = InputBox("Year?", "What year do you wish to create calendars for?", "", " 4", "500", "125", "250", "250") Select Case @error = 0 ;OK - The string returned is valid Local $sCalendar = @ScriptDir & "\Calendar.txt", $sText If FileExists($sCalendar) Then FileDelete($sCalendar) For $i = 1 To 12 $sText &= $sInputBoxAnswer & StringFormat(".%02i", $i) & " - " & StringUpper(_DateToMonth($i, $DMW_SHORTNAME)) & _ " " & $sInputBoxAnswer & " - Wall Calendar" & ($i < 12 ? @CRLF : "") Next FileWrite($sCalendar, $sText) ShellExecute($sCalendar) Case Else Exit ; finished EndSelect #EndRegion --- CodeWizard generated code Start --- Edit: @ioa747 before posting, I tested the output was exactly the same as yours. When I saw it was not ("Jan" versus "JAN") then I had to add StringUpper Edited January 1 by pixelsearch ioa747 1 "I think you are searching a bug where there is no bug..."
Nine Posted January 1 Posted January 1 2 hours ago, Diana (Cda) said: create series of place documents I think she meant create a document for each month, maybe ? pixelsearch 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy
ioa747 Posted January 1 Posted January 1 (edited) Now that you mention it, I see it too but with the data being a bit contiguous, so that I can't distinguish the file name from its text. So I improvised, to make a example P.S. In such cases, the ability of scite to mark and fill the entire column with alt + shift is very practical expandcollapse popup; AutoIt 3x ; #NoTrayIcon ; AutoIt's icon doesn't show in systray TraySetIcon("Shell32.dll", 153) ; changes the icon displayed in the systray AutoItSetOption("WinTitleMatchMode", 2) ; this allows partial window titles to be valid! ;------------------------------------------------------------------------------------------------------------------------- #Region --- CodeWizard generated code Start --- ;InputBox features: Title=Yes, Prompt=Yes, Default Text=No, Input Length=4, Width=500, Height=125 If Not IsDeclared("sInputBoxAnswer") Then Local $sInputBoxAnswer $sInputBoxAnswer = InputBox("Year?", "What year do you wish to create calendars for?", "", " 4", "500", "125", "250", "250") Select Case @error = 0 ;OK - The string returned is valid FileDelete(@ScriptDir & "\Calendar_*.txt") FileWrite(@ScriptDir & "\Calendar_01.txt", $sInputBoxAnswer & ".01 - JAN " & $sInputBoxAnswer & " - Wall Calendar") FileWrite(@ScriptDir & "\Calendar_02.txt", $sInputBoxAnswer & ".02 - FEB " & $sInputBoxAnswer & " - Wall Calendar") FileWrite(@ScriptDir & "\Calendar_03.txt", $sInputBoxAnswer & ".03 - MAR " & $sInputBoxAnswer & " - Wall Calendar") FileWrite(@ScriptDir & "\Calendar_04.txt", $sInputBoxAnswer & ".04 - APR " & $sInputBoxAnswer & " - Wall Calendar") FileWrite(@ScriptDir & "\Calendar_05.txt", $sInputBoxAnswer & ".05 - MAY " & $sInputBoxAnswer & " - Wall Calendar") FileWrite(@ScriptDir & "\Calendar_06.txt", $sInputBoxAnswer & ".06 - JUN " & $sInputBoxAnswer & " - Wall Calendar") FileWrite(@ScriptDir & "\Calendar_07.txt", $sInputBoxAnswer & ".07 - JUL " & $sInputBoxAnswer & " - Wall Calendar") FileWrite(@ScriptDir & "\Calendar_08.txt", $sInputBoxAnswer & ".08 - AUG " & $sInputBoxAnswer & " - Wall Calendar") FileWrite(@ScriptDir & "\Calendar_09.txt", $sInputBoxAnswer & ".09 - SEP " & $sInputBoxAnswer & " - Wall Calendar") FileWrite(@ScriptDir & "\Calendar_10.txt", $sInputBoxAnswer & ".10 - OCT " & $sInputBoxAnswer & " - Wall Calendar") FileWrite(@ScriptDir & "\Calendar_11.txt", $sInputBoxAnswer & ".11 - NOV " & $sInputBoxAnswer & " - Wall Calendar") FileWrite(@ScriptDir & "\Calendar_12.txt", $sInputBoxAnswer & ".12 - DEC " & $sInputBoxAnswer & " - Wall Calendar") ShellExecute(@ScriptDir) Case @error = 1 ;The Cancel button was pushed Exit ; finished Case @error = 3 ;The InputBox failed to open Exit ; finished EndSelect #EndRegion --- CodeWizard generated code Start --- Edited January 1 by ioa747 I know that I know nothing
Diana (Cda) Posted January 2 Author Posted January 2 (edited) Oops, I see I wasn't clear. Sorry! The last script example above did create placer files but not with the structure put in with all those "$sInputBoxAnswer" lines. Sorry, about that. By just inputting the target year, was hoping 12 placer files would be created using that date to get this type of result if I input 2024, for example (no extension necessary at this stage): 2024.01 - JAN 2024 - Wall Calendar 2024.02 - FEB 2024 - Wall Calendar 2024.03 - MAR 2024 - Wall Calendar 2024.04 - APR 2024 - Wall Calendar 2024.05 - MAY 2024 - Wall Calendar 2024.06 - JUN 2024 - Wall Calendar 2024.07 - JUL 2024 - Wall Calendar 2024.08 - AUG 2024 - Wall Calendar 2024.09 - SEP 2024 - Wall Calendar 2024.10 - OCT 2024 - Wall Calendar 2024.11 - NOV 2024 - Wall Calendar 2024.12 - DEC 2024 - Wall Calendar The above script example kindly given creates these text files below but with no details given as in my file structure above. Sorry for confusion. It did create something, where my code doesn't, but just missing the details: Calendar.txt Calendar_01.txt Calendar_02.txt Calendar_03.txt Calendar_04.txt Calendar_05.txt Calendar_06.txt Calendar_07.txt Calendar_08.txt Calendar_09.txt Calendar_10.txt Calendar_11.txt Calendar_12.txt My code above should work (according to me, lol), but it doesn't. So I'm obviously missing something in the syntax that I don't know. Was hoping someone could help with that, so that these lines: FileWrite(@ScriptDir, $sInputBoxAnswer & ".01 - JAN " & $sInputBoxAnswer & " - Wall Calendar") Result in this (using 2024 as an example, again) and in the folder the script located in (hence @scriptdir): 2024.01 - JAN 2024 - Wall Calendar.pdf Again, here is my original script: ; ; AutoIt 3x ; #NoTrayIcon ; AutoIt's icon doesn't show in systray TraySetIcon("Shell32.dll", 153) ; changes the icon displayed in the systray AutoItSetOption("WinTitleMatchMode", 2) ; this allows partial window titles to be valid! ;------------------------------------------------------------------------------------------------------------------------- #Region --- CodeWizard generated code Start --- ;InputBox features: Title=Yes, Prompt=Yes, Default Text=No, Input Length=4, Width=500, Height=125 If Not IsDeclared("sInputBoxAnswer") Then Local $sInputBoxAnswer $sInputBoxAnswer = InputBox("Year?","What year do you wish to create calendars for?",""," 4","500","125","250","250") Select Case @Error = 0 ;OK - The string returned is valid FileWrite(@ScriptDir, $sInputBoxAnswer & ".01 - JAN " & $sInputBoxAnswer & " - Wall Calendar") FileWrite(@ScriptDir, $sInputBoxAnswer & ".02 - FEB " & $sInputBoxAnswer & " - Wall Calendar") FileWrite(@ScriptDir, $sInputBoxAnswer & ".03 - MAR " & $sInputBoxAnswer & " - Wall Calendar") FileWrite(@ScriptDir, $sInputBoxAnswer & ".04 - APR " & $sInputBoxAnswer & " - Wall Calendar") FileWrite(@ScriptDir, $sInputBoxAnswer & ".05 - MAY " & $sInputBoxAnswer & " - Wall Calendar") FileWrite(@ScriptDir, $sInputBoxAnswer & ".06 - JUN " & $sInputBoxAnswer & " - Wall Calendar") FileWrite(@ScriptDir, $sInputBoxAnswer & ".07 - JUL " & $sInputBoxAnswer & " - Wall Calendar") FileWrite(@ScriptDir, $sInputBoxAnswer & ".08 - AUG " & $sInputBoxAnswer & " - Wall Calendar") FileWrite(@ScriptDir, $sInputBoxAnswer & ".09 - SEP " & $sInputBoxAnswer & " - Wall Calendar") FileWrite(@ScriptDir, $sInputBoxAnswer & ".10 - OCT " & $sInputBoxAnswer & " - Wall Calendar") FileWrite(@ScriptDir, $sInputBoxAnswer & ".11 - NOV " & $sInputBoxAnswer & " - Wall Calendar") FileWrite(@ScriptDir, $sInputBoxAnswer & ".12 - DEC " & $sInputBoxAnswer & " - Wall Calendar") Case @Error = 1 ;The Cancel button was pushed Exit ; finished Case @Error = 3 ;The InputBox failed to open Exit ; finished EndSelect #EndRegion --- CodeWizard generated code End --- It's something in the syntax that I haven't figured out despite searches and searches and trying to decipher what to do as per the help. I've never been very good at fixing things like this when they don't work <sigh> ... Thank you!! Edited January 2 by Diana (Cda)
Nine Posted January 2 Posted January 2 (edited) #pragma compile(inputboxres, True) ; if the script is to be compiled #include <Constants.au3> #include <Date.au3> TraySetIcon("Shell32.dll", 153) ; changes the icon displayed in the systray Local $hFile, $sInputBoxAnswer = InputBox("Year?", "What year do you wish to create calendars for?", "", " M4", 500, 125, 250, 250) If @error Then Exit ; cancel or failure For $i = 1 To 12 $hFile = FileOpen(@ScriptDir & "\" & $sInputBoxAnswer & StringFormat(".%02i", $i) & " - " & _ StringUpper(_DateToMonth($i, $DMW_SHORTNAME)) & " " & $sInputBoxAnswer & " - Wall Calendar", $FO_OVERWRITE) FileClose($hFile) Next Try this. Edited January 2 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy
Solution ioa747 Posted January 2 Solution Posted January 2 FileWrite ( "filehandle/filename", "text/data" ) for a file like this 2024.01 - JAN 2024 - Wall Calendar you had FileWrite(@ScriptDir, $sInputBoxAnswer & ".01 - JAN " & $sInputBoxAnswer & " - Wall Calendar") while you should have FileWrite(@ScriptDir & "\" & $sInputBoxAnswer & ".01 - JAN " & $sInputBoxAnswer & " - Wall Calendar", "") ; empty file or FileWrite(@ScriptDir & "\" & $sInputBoxAnswer & ".01 - JAN " & $sInputBoxAnswer & " - Wall Calendar", $sInputBoxAnswer & ".01 - JAN ") ; with date in it I hope it's more useful now. I know that I know nothing
Diana (Cda) Posted February 7 Author Posted February 7 (edited) On 1/2/2025 at 9:23 AM, ioa747 said: FileWrite ( "filehandle/filename", "text/data" ) for a file like this 2024.01 - JAN 2024 - Wall Calendar you had FileWrite(@ScriptDir, $sInputBoxAnswer & ".01 - JAN " & $sInputBoxAnswer & " - Wall Calendar") while you should have FileWrite(@ScriptDir & "\" & $sInputBoxAnswer & ".01 - JAN " & $sInputBoxAnswer & " - Wall Calendar", "") ; empty file or FileWrite(@ScriptDir & "\" & $sInputBoxAnswer & ".01 - JAN " & $sInputBoxAnswer & " - Wall Calendar", $sInputBoxAnswer & ".01 - JAN ") ; with date in it I hope it's more useful now. Thank you so much! Yes, that's works just fine now! I'm greatly relieved. The other codes above with loops and stuff, they're great in structure but I don't work with fancy stuff like that very well <lol>. So just fixing my syntax errors above is so very useful as I have a couple of other instances where I need this type of script and so will be able to edit it easily (primitive, but within my grasp! <g>). Here is my working script now: ; Script kindly fixed by ioa747, Posted January 2, 2025: https://www.autoitscript.com/forum/topic/212593-creating-files-from-inputbox-im-missing-something/#findComment-1539972 ; ; AutoIt 3x ; #NoTrayIcon ; AutoIt's icon doesn't show in systray TraySetIcon("Shell32.dll", 153) ; changes the icon displayed in the systray AutoItSetOption("WinTitleMatchMode", 2) ; this allows partial window titles to be valid! ;------------------------------------------------------------------------------------------------------------------------- #Region --- CodeWizard generated code Start --- ;InputBox features: Title=Yes, Prompt=Yes, Default Text=No, Input Length=4, Width=500, Height=125 If Not IsDeclared("sInputBoxAnswer") Then Local $sInputBoxAnswer $sInputBoxAnswer = InputBox("Year?","What year do you wish to create calendars for?",""," 4","500","125","250","250") Select Case @Error = 0 ;OK - The string returned is valid FileWrite(@ScriptDir & "\" & $sInputBoxAnswer & ".01 - JAN " & $sInputBoxAnswer & " - Wall Calendar", "") ; empty file FileWrite(@ScriptDir & "\" & $sInputBoxAnswer & ".02 - FEB " & $sInputBoxAnswer & " - Wall Calendar", "") ; empty file FileWrite(@ScriptDir & "\" & $sInputBoxAnswer & ".03 - MAR " & $sInputBoxAnswer & " - Wall Calendar", "") ; empty file FileWrite(@ScriptDir & "\" & $sInputBoxAnswer & ".04 - APR " & $sInputBoxAnswer & " - Wall Calendar", "") ; empty file FileWrite(@ScriptDir & "\" & $sInputBoxAnswer & ".05 - MAY " & $sInputBoxAnswer & " - Wall Calendar", "") ; empty file FileWrite(@ScriptDir & "\" & $sInputBoxAnswer & ".06 - JUN " & $sInputBoxAnswer & " - Wall Calendar", "") ; empty file FileWrite(@ScriptDir & "\" & $sInputBoxAnswer & ".07 - JUL " & $sInputBoxAnswer & " - Wall Calendar", "") ; empty file FileWrite(@ScriptDir & "\" & $sInputBoxAnswer & ".08 - AUG " & $sInputBoxAnswer & " - Wall Calendar", "") ; empty file FileWrite(@ScriptDir & "\" & $sInputBoxAnswer & ".09 - SEP " & $sInputBoxAnswer & " - Wall Calendar", "") ; empty file FileWrite(@ScriptDir & "\" & $sInputBoxAnswer & ".10 - OCT " & $sInputBoxAnswer & " - Wall Calendar", "") ; empty file FileWrite(@ScriptDir & "\" & $sInputBoxAnswer & ".11 - NOV " & $sInputBoxAnswer & " - Wall Calendar", "") ; empty file FileWrite(@ScriptDir & "\" & $sInputBoxAnswer & ".12 - DEC " & $sInputBoxAnswer & " - Wall Calendar", "") ; empty file Case @Error = 1 ;The Cancel button was pushed Exit ; finished Case @Error = 3 ;The InputBox failed to open Exit ; finished EndSelect #EndRegion --- CodeWizard generated code End --- Thank you all!! And thank you, ioa747!! Edited February 7 by Diana (Cda) ioa747 1
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